// Represent // // Douglas Thrift // // $Id$ #include "DataType.hpp" const ext::Vector& DataType::enumerate() { if (enumeration.IsEmpty()) { _foru (type, TYPE_bool, TYPE_ext_String + 1) enumeration.InsertLast(Type(type)); } return enumeration; } ext::Vector DataType::enumeration; DataType& DataType::operator=(const ext::String& string) { if (enumeration.IsEmpty()) enumerate(); ext::Vector::ConstIterator found(enumeration.Find(string)); if (found != enumeration.End()) type = *found; return *this; } DataType::operator ext::String() const { switch (type) { default: return "bool"; case TYPE_char: return "char"; case TYPE_short: return "short"; case TYPE_unsigned_short: return "unsigned short"; case TYPE_int: return "int"; case TYPE_unsigned_int: return "unsigned int"; case TYPE_long: return "long"; case TYPE_unsigned_long: return "unsigned long"; case TYPE_float: return "float"; case TYPE_double: return "double"; case TYPE_std_string: return "std::string"; case TYPE_ext_String: return "ext::String"; } }