00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "nvtype.h"
00023
00024 NVtype::NVtype(void)
00025 : m_data(),
00026 m_type(NVtype::VOID)
00027 {
00028
00029 }
00030
00031
00032 NVtype::NVtype(const NVtype &other)
00033 : m_data(),
00034 m_type(NVtype::VOID)
00035 {
00036 m_data = other.m_data;
00037 m_type = other.m_type;
00038 }
00039
00040 NVtype::NVtype(char val)
00041 : m_data(),
00042 m_type(NVtype::CHAR)
00043 {
00044 m_data.set(&val, 1);
00045 }
00046
00047
00048 NVtype::NVtype(nint32 val)
00049 : m_data(),
00050 m_type(NVtype::INT32)
00051 {
00052 m_data.set(val);
00053 }
00054
00055 NVtype::NVtype(nuint32 val)
00056 : m_data(),
00057 m_type(NVtype::UINT32)
00058 {
00059 m_data.set(val);
00060 }
00061
00062 NVtype::NVtype(nint64 val)
00063 : m_data(),
00064 m_type(NVtype::INT64)
00065 {
00066 m_data.set(val);
00067 }
00068
00069 NVtype::NVtype(nuint64 val)
00070 : m_data(),
00071 m_type(NVtype::UINT64)
00072 {
00073 m_data.set(val);
00074 }
00075
00076 NVtype::NVtype(const NString &str)
00077 : m_data(),
00078 m_type(NVtype::STRING)
00079 {
00080 m_data.set(str);
00081 }
00082
00083 NVtype::NVtype(const NDataStream &str)
00084 : m_data(),
00085 m_type(NVtype::DATASTREAM)
00086 {
00087 m_data = str;
00088 }
00089
00090 NVtype::Type NVtype::getType() const {
00091 return m_type;
00092 }
00093
00094 char NVtype::toChar() const {
00095 return m_data.toChar();
00096 }
00097
00098 nint32 NVtype::toInt32() const {
00099 return m_data.toInt32();
00100 }
00101
00102 nuint32 NVtype::toUInt32() const {
00103 return m_data.toInt32();
00104 }
00105
00106 nint64 NVtype::toInt64() const {
00107 return m_data.toInt64();
00108 }
00109
00110 nuint64 NVtype::toUInt64() const {
00111 return m_data.toInt64();
00112 }
00113
00114 NString NVtype::toString() const {
00115 return m_data.toString();
00116 }
00117
00118 NDataStream NVtype::toStream() const {
00119 return m_data;
00120 }
00121
00122
00123 nuint32 NVtype::getSize() const {
00124 return m_data.size();
00125 }
00126
00127
00128 NVtype &NVtype::operator=(const NVtype &rhs) {
00129 m_data = rhs.m_data;
00130 m_type = rhs.m_type;
00131 }
00132
00133 bool NVtype::operator==(const NVtype &rhs) const {
00134 if (m_type != rhs.m_type) {
00135 return false;
00136 }
00137
00138 return (m_data == rhs.m_data);
00139 }
00140
00141
00142 bool NVtype::operator!=(const NVtype &rhs) const {
00143 if (m_type != rhs.m_type) {
00144 return true;
00145 }
00146
00147 return (m_data != rhs.m_data);
00148 }