]> git.sur5r.net Git - openldap/blobdiff - contrib/ldapc++/src/LDAPException.h
Entry rwlock is no longer needed as concurrency is managed
[openldap] / contrib / ldapc++ / src / LDAPException.h
index 79c46ca237cf794aae9e8362bd2a367fb5f5476c..be4873a534da85c1248ecaa89c9a21d8b8d0a562 100644 (file)
@@ -3,26 +3,69 @@
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
-// $Id: LDAPException.h,v 1.6 2000/08/31 17:43:48 rhafer Exp $
 
 #ifndef LDAP_EXCEPTION_H
 #define LDAP_EXCEPTION_H
 
 #include <iostream>
-#include "LDAPAsynConnection.h"
+#include <string>
 
+class LDAPAsynConnection;
+
+/**
+ * This class is only thrown as an Exception and used to signalize error
+ * conditions during LDAP-operations
+ */
 class LDAPException{
+               
+       public :
+        /**
+         * Constructs a LDAPException-object from the parameters
+         * @param res_code A valid LDAP result code.
+         * @param err_std::string    An addional error message for the error
+         *                      that happend (optional)
+         */
+               LDAPException(int res_code, const std::string& err_string=std::string());
+               
+        /**
+         * Constructs a LDAPException-object from the error state of a
+         * LDAPAsynConnection-object
+         * @param lc A LDAP-Connection for that an error has happend. The
+         *          Constructor tries to read its error state.
+         */
+        LDAPException(const LDAPAsynConnection *lc);
+
+        /**
+         * Destructor
+         */
+        virtual ~LDAPException();
+
+        /**
+         * @return The Result code of the object
+         */
+        
+               int getResultCode() const;
+
+        /**
+         * @return The error message that is corresponding to the result
+         *          code .
+         */
+               const std::string& getResultMsg() const;
+        
+        /**
+         * @return The addional error message of the error (if it was set)
+         */
+        const std::string& getServerMsg() const;
+
+        /**
+         * This method can be used to dump the data of a LDAPResult-Object.
+         * It is only useful for debugging purposes at the moment
+         */
+               friend std::ostream& operator << (std::ostream &s, LDAPException e);
 
        private :
                int m_res_code;
-               char* m_res_string;
-               char* m_err_string;
-               
-       public :
-               LDAPException(int res_code, char *err_string=0);
-               LDAPException(const LDAPAsynConnection *lc);
-               int getResultCode();
-               char* getResultMsg();
-               friend ostream& operator << (ostream &s, LDAPException e);
+               std::string m_res_string;
+               std::string m_err_string;
 };
 #endif //LDAP_EXCEPTION_H