X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=contrib%2Fldapc%2B%2B%2Fexamples%2Fmain.cpp;h=3e42e8a1ed090a1134527ddbc1ff76bb5a16dbad;hb=4317c7ce54ceb41d57e6ec83f547edfaeedb574b;hp=8fff4d4a1ede39662d820aeebc70afc96a7332f3;hpb=3f4c09183f64891da5888035c7fdff800791c80f;p=openldap diff --git a/contrib/ldapc++/examples/main.cpp b/contrib/ldapc++/examples/main.cpp index 8fff4d4a1e..3e42e8a1ed 100644 --- a/contrib/ldapc++/examples/main.cpp +++ b/contrib/ldapc++/examples/main.cpp @@ -1,10 +1,11 @@ +// $OpenLDAP$ /* - * Copyright 2000, OpenLDAP Foundation, All Rights Reserved. + * Copyright 2000-2012 The OpenLDAP Foundation, All Rights Reserved. * COPYING RESTRICTIONS APPLY, see COPYRIGHT file */ -#include -#include +#include +#include #include "LDAPConnection.h" #include "LDAPConstraints.h" #include "LDAPSearchReference.h" @@ -14,9 +15,8 @@ #include "LDAPEntry.h" #include "LDAPException.h" #include "LDAPModification.h" -#include "LDAPReferralException.h" -#include"debug.h" +#include "debug.h" int main(){ LDAPConstraints* cons=new LDAPConstraints; @@ -25,13 +25,13 @@ int main(){ cons->setServerControls(ctrls); LDAPConnection *lc=new LDAPConnection("localhost",9009); lc->setConstraints(cons); - cout << "----------------------doing bind...." << endl; + std::cout << "----------------------doing bind...." << std::endl; try{ lc->bind("cn=Manager,o=Organisation,c=DE" , "secret",cons); - cout << lc->getHost() << endl; + std::cout << lc->getHost() << std::endl; bool result = lc->compare("cn=Manager,o=Organisation,c=DE", LDAPAttribute("cn","Manaer")); - cout << "Compare: " << result << endl; + std::cout << "Compare: " << result << std::endl; LDAPAttributeList* attrs=new LDAPAttributeList(); StringList values; @@ -52,30 +52,30 @@ int main(){ if (entries != 0){ LDAPEntry* entry = entries->getNext(); if(entry != 0){ - cout << *(entry) << endl; + std::cout << *(entry) << std::endl; } while(entry){ try{ entry = entries->getNext(); if(entry != 0){ - cout << *(entry) << endl; + std::cout << *(entry) << std::endl; } delete entry; }catch(LDAPReferralException e){ - cout << "Caught Referral" << endl; + std::cout << "Caught Referral" << std::endl; } } } lc->unbind(); delete lc; - }catch (LDAPException e){ - cout << "------------------------- caught Exception ---------"<< endl; - cout << e << endl; + }catch (LDAPException &e){ + std::cout << "-------------- caught Exception ---------"<< std::endl; + std::cout << e << std::endl; } /* - cout << "--------------------starting search" << endl; + std::cout << "--------------------starting search" << std::endl; LDAPAttributeList* attrs=new LDAPAttributeList(); StringList values; values.add("top"); @@ -105,28 +105,28 @@ int main(){ case LDAP_RES_SEARCH_ENTRY : res2= (LDAPSearchResult*)res; entry= res2->getEntry(); - cout << "Entry: " << *entry << endl; + std::cout << "Entry: " << *entry << std::endl; delete res; res=q->getNext(); break; case LDAP_RES_SEARCH_REFERENCE : - cout << "Reference: " << endl; + std::cout << "Reference: " << std::endl; delete res; res=q->getNext(); break; default : - cout << ( *(LDAPResult*) res) << endl; + std::cout << ( *(LDAPResult*) res) << std::endl; delete res; - cout << "-----------------search done" << endl; + std::cout << "-----------------search done" << std::endl; cont=false; break; } } delete q; }catch (LDAPException e){ - cout << "----------------error during search" << endl; + std::cout << "----------------error during search" << std::endl; delete q; - cout << e << endl; + std::cout << e << std::endl; } lc->unbind(); */