-
Notifications
You must be signed in to change notification settings - Fork 1
/
tag.hpp
48 lines (38 loc) · 1.02 KB
/
tag.hpp
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/* tag.hpp -- identifies class by string name or 4-byte integer
*
* Ryan McDougall
*/
#ifndef TAG_H_
#define TAG_H_
namespace Scaffold
{
typedef unsigned int tag_t;
struct Tag
{
typedef std::set <Tag> Set;
typedef std::vector <Tag> List;
Tag ();
Tag (const string &n, unsigned int seed = 0);
Tag (const char *n, unsigned int seed = 0);
bool operator== (const Tag &r) const;
bool operator!= (const Tag &r) const;
bool operator< (const Tag &r) const;
bool operator> (const Tag &r) const;
string name;
tag_t number;
};
class Tagged
{
public:
Tagged (const Tag &t);
Tag tag() const;
string name() const;
bool operator== (const Tagged &r) const;
bool operator!= (const Tagged &r) const;
bool operator< (const Tagged &r) const;
bool operator> (const Tagged &r) const;
private:
Tag tag_;
};
}
#endif //TAG_H_