2 * Copyright (C) 2005-2008 MaNGOS <http://getmangos.com/>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 DB_TYPE_UNKNOWN
= 0x00,
29 DB_TYPE_STRING
= 0x01,
30 DB_TYPE_INTEGER
= 0x02,
37 Field(const char *value
, enum DataTypes type
);
41 enum DataTypes
GetType() const { return mType
; }
43 const char *GetString() const { return mValue
; }
44 std::string
GetCppString() const
46 return mValue
? mValue
: ""; // std::string s = 0 have undefine result in C++
48 float GetFloat() const { return mValue
? static_cast<float>(atof(mValue
)) : 0.0f
; }
49 bool GetBool() const { return mValue
? atoi(mValue
) > 0 : false; }
50 int32
GetInt32() const { return mValue
? static_cast<int32
>(atol(mValue
)) : int32(0); }
51 uint8
GetUInt8() const { return mValue
? static_cast<uint8
>(atol(mValue
)) : uint8(0); }
52 uint16
GetUInt16() const { return mValue
? static_cast<uint16
>(atol(mValue
)) : uint16(0); }
53 int16
GetInt16() const { return mValue
? static_cast<int16
>(atol(mValue
)) : int16(0); }
54 uint32
GetUInt32() const { return mValue
? static_cast<uint32
>(atol(mValue
)) : uint32(0); }
55 uint64
GetUInt64() const
60 sscanf(mValue
,I64FMTD
,&value
);
67 void SetType(enum DataTypes type
) { mType
= type
; }
69 void SetValue(const char *value
);