00001 // LICENSE: (Please see the file COPYING for details) 00002 // 00003 // NUS - Nemesis Utilities System: A C++ application development framework 00004 // Copyright (C) 2006, 2008 Otavio Rodolfo Piske 00005 // 00006 // This file is part of NUS 00007 // 00008 // This library is free software; you can redistribute it and/or 00009 // modify it under the terms of the GNU Lesser General Public 00010 // License as published by the Free Software Foundation version 2.1 00011 // of the License. 00012 // 00013 // This library is distributed in the hope that it will be useful, 00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 // Lesser General Public License for more details. 00017 // 00018 // You should have received a copy of the GNU Lesser General Public 00019 // License along with this library; if not, write to the Free Software 00020 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00021 // 00022 #ifndef NVTYPE_H 00023 #define NVTYPE_H 00024 00025 #include "nobject.h" 00026 #include "nstring.h" 00027 #include "ndatastream.h" 00028 00029 00039 class NVtype { 00040 public: 00041 enum Type { 00042 VOID, 00043 CHAR, 00044 INT32, 00045 UINT32, 00046 INT64, 00047 UINT64, 00048 STRING, 00049 DATASTREAM 00050 }; 00051 00052 00056 NVtype(void); 00057 00062 NVtype(const NVtype &other); 00063 00068 explicit NVtype(char val); 00069 00074 explicit NVtype(nint32 val); 00075 00080 explicit NVtype(nuint32 val); 00081 00086 explicit NVtype(nint64 val); 00087 00092 explicit NVtype(nuint64 val); 00093 00098 NVtype(const NString &str); 00099 00100 00105 explicit NVtype(const NDataStream &str); 00106 00107 00111 Type getType() const; 00112 00113 00118 char toChar() const; 00119 00124 nint32 toInt32() const; 00125 00130 nuint32 toUInt32() const; 00131 00136 nint64 toInt64() const; 00137 00142 nuint64 toUInt64() const; 00143 00148 NString toString() const; 00149 00154 NDataStream toStream() const; 00155 00156 00161 nuint32 getSize() const; 00162 00168 NVtype &operator=(const NVtype &rhs); 00169 00175 bool operator==(const NVtype &rhs) const; 00176 00182 bool operator!=(const NVtype &rhs) const; 00183 00184 private: 00185 NDataStream m_data; 00186 Type m_type; 00187 }; 00188 00189 00190 #endif // NVTYPE_H