ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/Represent/DataType.cpp
Revision: 380
Committed: 2004-12-23T01:07:33-08:00 (20 years, 6 months ago) by douglas
File size: 1302 byte(s)
Log Message:
Moo!

File Contents

# User Rev Content
1 douglas 380 // Represent
2     //
3     // Douglas Thrift
4     //
5     // $Id$
6    
7     #include "DataType.hpp"
8    
9     const ext::Vector<DataType>& DataType::enumerate()
10     {
11     if (enumeration.IsEmpty())
12     {
13     _foru (type, TYPE_bool, TYPE_ext_String + 1) enumeration.InsertLast(Type(type));
14     }
15    
16     return enumeration;
17     }
18    
19     ext::Vector<DataType> DataType::enumeration;
20    
21     DataType& DataType::operator=(const ext::String& string)
22     {
23     if (enumeration.IsEmpty()) enumerate();
24    
25     ext::Vector<DataType>::ConstIterator found(enumeration.Find(string));
26    
27     if (found != enumeration.End()) type = *found;
28    
29     return *this;
30     }
31    
32     DataType::operator ext::String() const
33     {
34     switch (type)
35     {
36     case TYPE_bool:
37     return "bool";
38     case TYPE_char:
39     return "char";
40     case TYPE_short:
41     return "short";
42     case TYPE_unsigned_short:
43     return "unsigned short";
44     case TYPE_int:
45     return "int";
46     case TYPE_unsigned_int:
47     return "unsigned int";
48     case TYPE___int8:
49     return "__int8";
50     case TYPE___int16:
51     return "__int16";
52     case TYPE___int32:
53     return "__int32";
54     case TYPE___int64:
55     return "__int64";
56     case TYPE_long:
57     return "long";
58     case TYPE_unsigned_long:
59     return "unsigned_long";
60     case TYPE_float:
61     return "float";
62     case TYPE_double:
63     return "double";
64     case TYPE_std_string:
65     return "std::string";
66     case TYPE_ext_String:
67     return "ext::String";
68     default:
69     return ext::String();
70     }
71     }

Properties

Name Value
svn:eol-style native
svn:keywords Id