ANNA Suite  2020b
Multipurpose development suite for Telco applications
ResultCode.hpp
Go to the documentation of this file.
1 // ANNA - Anna is Not Nothingness Anymore //
2 // //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
4 // //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
7 
8 
9 #ifndef anna_ldap_ResultCode_hpp
10 #define anna_ldap_ResultCode_hpp
11 
12 #include <string>
13 
14 namespace anna {
15 
16 namespace ldap {
17 
18 class Session;
19 
26 class ResultCode {
27 public:
31  ResultCode() : a_value(0) {;}
32 
37  bool isOk() const { return a_value == 0; }
38 
49  bool isInvalidCredential() const ;
50 
59  bool isOperationsError() const ;
60 
69  bool isProtocolError() const ;
70 
79  bool isTimeLimitExceeded() const ;
80 
89  bool isSizeLimitExceeded() const ;
90 
99  bool isAuthMethodNotSupported() const ;
100 
109  bool isStrongAuthRequired() const ;
110 
119  bool isSASLBindInProgress() const ;
120 
131  bool isAttrError() const ;
132 
142  bool isNameError() const ;
143 
156  bool isSecurityError() const ;
157 
167  bool isServiceError() const ;
168 
177  bool isTimeout() const ;
178 
187  bool isUnavailable() const ;
188 
197  bool isServerDown() const ;
198 
207  bool isLocalError() const ;
208 
217  bool isDecodingError() const ;
218 
227  bool isFilterError() const ;
228 
237  bool isConnectError() const ;
238 
243  int getValue() const { return a_value; }
244 
249  const std::string& getText() const { return a_text; }
250 
255 // void setValue (const int value) { a_value = value; }
256 
261 // void setText (const std::string& text) { a_text = text; }
262 
266  void clear() { a_value = 0; a_text.clear(); }
267 
274  a_value = other.a_value;
275  a_text = other.a_text;
276  return *this;
277  }
278 
285  ResultCode& operator= (const int ldap_result) ;
286 
287  bool operator == (const int n) const { return a_value == n; }
288  bool operator != (const int n) const { return a_value != n; }
289  bool operator < (const int n) const { return a_value < n; }
290  bool operator <= (const int n) const { return a_value <= n; }
291 
296  const std::string asString() const ;
297 
298 private:
299  int a_value;
300  std::string a_text;
301 
302  ResultCode(const int ldap_method_result);
303 
304  void setValue(const int ldap_method_result, const int ldap_method_error) ;
305 
306  bool extractResultCode(const Session*) ;
307 
308  friend class Session;
309 };
310 
311 }
312 }
313 
314 #endif
315 
bool isSecurityError() const
Definition: Session.hpp:38
void clear()
Definition: ResultCode.hpp:266
const std::string & getText() const
Definition: ResultCode.hpp:249
Definition: ResultCode.hpp:26
bool isSASLBindInProgress() const
bool isStrongAuthRequired() const
bool isProtocolError() const
bool isNameError() const
bool isLocalError() const
bool isServerDown() const
bool isTimeLimitExceeded() const
bool isAuthMethodNotSupported() const
bool isUnavailable() const
bool operator<(const int n) const
Definition: ResultCode.hpp:289
bool isConnectError() const
bool isInvalidCredential() const
bool isServiceError() const
bool operator<=(const int n) const
Definition: ResultCode.hpp:290
bool operator==(const int n) const
Definition: ResultCode.hpp:287
bool isOperationsError() const
bool isSizeLimitExceeded() const
const std::string asString() const
bool operator!=(const int n) const
Definition: ResultCode.hpp:288
ResultCode & operator=(const ResultCode &other)
Definition: ResultCode.hpp:273
Definition: app.hpp:12
bool isTimeout() const
bool isAttrError() const
bool isDecodingError() const
ResultCode()
Definition: ResultCode.hpp:31
int getValue() const
Definition: ResultCode.hpp:243
bool isOk() const
Definition: ResultCode.hpp:37
bool isFilterError() const