diff options
author | dec05eba <dec05eba@protonmail.com> | 2018-02-01 21:15:13 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-08-18 23:25:12 +0200 |
commit | 1c7e6e074155499155adbbb651db1c66f1762ba2 (patch) | |
tree | c08a95e772c8e23228a2be78e308aba313034f26 /include/User.hpp | |
parent | bd2bd91ac947a7b1f6d097d7efa4b0ab2041d4db (diff) |
Sync time with ntp server, starting with basic operations
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 |