blob: e54243485a7d857db6f7e6a5341691194b2f4656 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#pragma once
#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:
// TODO: Add public key
std::string name;
};
}
|