/*
* Ascent MMORPG Server
* Copyright (C) 2005-2007 Ascent Team
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
*/
#if !defined(FIELD_H)
#define FIELD_H
class Field
{
public:
inline void SetValue(char* value) { mValue = value; }
inline const char *GetString() { return mValue; }
inline float GetFloat() { return mValue ? static_cast(atof(mValue)) : 0; }
inline bool GetBool() { return mValue ? atoi(mValue) > 0 : false; }
inline uint8 GetUInt8() { return mValue ? static_cast(atol(mValue)) : 0; }
inline int8 GetInt8() { return mValue ? static_cast(atol(mValue)) : 0; }
inline uint16 GetUInt16() { return mValue ? static_cast(atol(mValue)) : 0; }
inline uint32 GetUInt32() { return mValue ? static_cast(atol(mValue)) : 0; }
inline uint32 GetInt32() { return mValue ? static_cast(atol(mValue)) : 0; }
uint64 GetUInt64()
{
if(mValue)
{
uint64 value;
sscanf(mValue,I64FMTD,&value);
return value;
}
else
return 0;
}
private:
char *mValue;
};
#endif