identt
BaseUtils.hpp
Go to the documentation of this file.
1 
33 #ifndef _IDENTT_UTILS_BASEUTILS_HPP_
34 #define _IDENTT_UTILS_BASEUTILS_HPP_
35 
36 #include <glog/logging.h>
37 
38 #include <string>
39 #include <memory>
40 #include <exception>
41 
42 #define IDENTT_SERVICE_SCOPE_HTTP 0x0001
43 #define IDENTT_SERVICE_SCOPE_HTTPS 0x0002
44 
45 #define THREEPID_DEFAULT_ALGO "ed25519"
46 #define THREEPID_DEFAULT_ALGO_ID "0"
47 #define THREEPID_DEFAULT_ALGO_WITH_ID THREEPID_DEFAULT_ALGO ":" THREEPID_DEFAULT_ALGO_ID
48 #define THREEPID_SESSION_VALID_LIFETIME_MS 3 * 24 * 60 * 60 * 1000
49 
50 #define BULK_LOOKUP_CHUNK_SIZE 100
51 namespace identt {
52 class JdException : public std::exception {
53 protected:
54  std::string msg_;
55  int err_;
56 public:
57  explicit JdException() : msg_(""), err_(0) {}
58  explicit JdException(const char* msg) : msg_(msg), err_(0) {}
59  explicit JdException(std::string& msg) : msg_(msg), err_(0) {}
60  explicit JdException(std::string msg) : msg_(msg), err_(0) {}
61  explicit JdException(const char* msg, int err) : msg_(msg),err_(err) {}
62  explicit JdException(std::string& msg, int err) : msg_(msg),err_(err) {}
63  explicit JdException(std::string msg, int err) : msg_(msg),err_(err) {}
64  virtual ~JdException() throw () {}
65  virtual const char* what() const throw ()
66  {
67  return msg_.c_str();
68  }
69  virtual int ecode() const throw ()
70  {
71  return err_;
72  }
73 };
74 
76 
77 class InitialException : public JdException {
78  using JdException::JdException;
79 };
80 class ConfigException : public JdException {
81  using JdException::JdException;
82 };
84  using JdException::JdException;
85 };
87  using JdException::JdException;
88 };
89 class BadDataException : public JdException {
90  using JdException::JdException;
91 };
92 class BadJsonException : public JdException {
93  using JdException::JdException;
94 };
95 class BadCodeException : public JdException {
96  using JdException::JdException;
97 };
98 
99 
100 } // namespace identt
101 #endif // _IDENTT_UTILS_BASEUTILS_HPP_
Definition: BaseUtils.hpp:92
Definition: BaseUtils.hpp:77
Definition: BaseUtils.hpp:80
Definition: BaseUtils.hpp:83
Definition: BaseUtils.hpp:86
Definition: BaseUtils.hpp:52
Definition: CryptoBase.hpp:49
Definition: BaseUtils.hpp:89
Definition: BaseUtils.hpp:95