1 |
// Represent |
2 |
// |
3 |
// Douglas Thrift |
4 |
// |
5 |
// $Id$ |
6 |
|
7 |
#ifndef _DataType_hpp_ |
8 |
#define _DataType_hpp_ |
9 |
|
10 |
#include "Represent.hpp" |
11 |
|
12 |
#ifdef MENES_PRAGMA_ONCE |
13 |
#pragma once |
14 |
#endif |
15 |
|
16 |
class DataType |
17 |
{ |
18 |
public: |
19 |
enum Type |
20 |
{ |
21 |
TYPE_bool, |
22 |
TYPE_char, |
23 |
TYPE_short, |
24 |
TYPE_unsigned_short, |
25 |
TYPE_int, |
26 |
TYPE_unsigned_int, |
27 |
TYPE___int8, |
28 |
TYPE___int16, |
29 |
TYPE___int32, |
30 |
TYPE___int64, |
31 |
TYPE_long, |
32 |
TYPE_unsigned_long, |
33 |
TYPE_float, |
34 |
TYPE_double, |
35 |
TYPE_std_string, |
36 |
TYPE_ext_String |
37 |
}; |
38 |
private: |
39 |
Type type; |
40 |
static ext::Vector<DataType> enumeration; |
41 |
public: |
42 |
DataType(Type type = TYPE_bool) : type(type) {} |
43 |
DataType(const ext::String& string) : type(TYPE_bool) { operator=(string); } |
44 |
static const ext::Vector<DataType>& enumerate(); |
45 |
DataType& operator=(Type type) { this->type = type; return *this; } |
46 |
DataType& operator=(const ext::String& string); |
47 |
bool operator==(const DataType& data) const { return type == data.type; } |
48 |
bool operator==(Type type) const { return this->type == type; } |
49 |
bool operator==(const ext::String& string) const { return operator ext::String() == string; } |
50 |
bool operator!=(const DataType& data) const { return type != data.type; } |
51 |
bool operator!=(Type type) const { return this->type != type; } |
52 |
bool operator!=(const ext::String& string) const { return operator ext::String() != string; } |
53 |
operator Type() const { return type; } |
54 |
operator ext::String() const; |
55 |
}; |
56 |
|
57 |
#endif // _DataType_hpp_ |