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 { TYPE_bool, TYPE_char, TYPE_short, TYPE_unsigned_short, TYPE_int, TYPE_unsigned_int, TYPE_long, TYPE_unsigned_long, TYPE_float, TYPE_double, TYPE_std_string, TYPE_ext_String }; |
20 |
private: |
21 |
Type type; |
22 |
static ext::Vector<DataType> enumeration; |
23 |
public: |
24 |
DataType(Type type = TYPE_bool) : type(type) {} |
25 |
DataType(const ext::String& string) : type(TYPE_bool) { operator=(string); } |
26 |
static const ext::Vector<DataType>& enumerate(); |
27 |
DataType& operator=(Type type) { this->type = type; return *this; } |
28 |
DataType& operator=(const ext::String& string); |
29 |
bool operator==(const DataType& data) const { return type == data.type; } |
30 |
bool operator==(Type type) const { return this->type == type; } |
31 |
bool operator==(const ext::String& string) const { return operator ext::String() == string; } |
32 |
bool operator!=(const DataType& data) const { return type != data.type; } |
33 |
bool operator!=(Type type) const { return this->type != type; } |
34 |
bool operator!=(const ext::String& string) const { return operator ext::String() != string; } |
35 |
operator Type() const { return type; } |
36 |
operator ext::String() const; |
37 |
}; |
38 |
|
39 |
#endif // _DataType_hpp_ |