diff options
Diffstat (limited to 'include/User.hpp')
-rw-r--r-- | include/User.hpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/include/User.hpp b/include/User.hpp index 727bbcf..e542434 100644 --- a/include/User.hpp +++ b/include/User.hpp @@ -1,15 +1,32 @@ #pragma once -#include <opendht/crypto.h> #include <string> +#include <stdexcept> namespace odhtdb { + class UserNameTooLongException : public std::runtime_error + { + public: + UserNameTooLongException(const std::string &userName) : + std::runtime_error(std::string("The username ") + userName + " is longer than 255 bytes") + { + + } + }; + class User { public: + const std::string& getName() const { return name; } + protected: + User(const std::string &_name) : name(_name) + { + if(name.size() > 255) + throw UserNameTooLongException(name); + } private: - dht::crypto::PublicKey publicKey; + // TODO: Add public key std::string name; }; }
\ No newline at end of file |