[Rel21] Stage 1 of updates for Rel21 Build System

This commit is contained in:
Antz 2015-07-28 10:59:34 +01:00 committed by Antz
parent 13292befd6
commit fdefc0869a
1951 changed files with 40474 additions and 252610 deletions

View file

@ -25,12 +25,21 @@
#ifndef FIELD_H
#define FIELD_H
#include "Common.h"
#include "Common/Common.h"
#include <mysql.h>
/**
* @brief
*
*/
class Field
{
public:
/**
* @brief
*
*/
enum DataTypes
{
DB_TYPE_UNKNOWN = 0x00,
@ -40,26 +49,95 @@ class Field
DB_TYPE_BOOL = 0x04
};
/**
* @brief
*
*/
Field() : mValue(NULL), mType(DB_TYPE_UNKNOWN) {}
/**
* @brief
*
* @param value
* @param type
*/
Field(const char* value, enum DataTypes type) : mValue(value), mType(type) {}
/**
* @brief
*
*/
~Field() {}
enum DataTypes GetType() const { return mType; }
/**
* @brief
*
* @return bool
*/
bool IsNULL() const { return mValue == NULL; }
/**
* @brief
*
* @return const char
*/
const char* GetString() const { return mValue; }
/**
* @brief
*
* @return std::string
*/
std::string GetCppString() const
{
return mValue ? mValue : ""; // std::string s = 0 have undefine result in C++
}
/**
* @brief
*
* @return float
*/
float GetFloat() const { return mValue ? static_cast<float>(atof(mValue)) : 0.0f; }
/**
* @brief
*
* @return bool
*/
bool GetBool() const { return mValue ? atoi(mValue) > 0 : false; }
/**
* @brief
*
* @return int32
*/
int32 GetInt32() const { return mValue ? static_cast<int32>(atol(mValue)) : int32(0); }
/**
* @brief
*
* @return uint8
*/
uint8 GetUInt8() const { return mValue ? static_cast<uint8>(atol(mValue)) : uint8(0); }
/**
* @brief
*
* @return uint16
*/
uint16 GetUInt16() const { return mValue ? static_cast<uint16>(atol(mValue)) : uint16(0); }
/**
* @brief
*
* @return int16
*/
int16 GetInt16() const { return mValue ? static_cast<int16>(atol(mValue)) : int16(0); }
/**
* @brief
*
* @return uint32
*/
uint32 GetUInt32() const { return mValue ? static_cast<uint32>(atol(mValue)) : uint32(0); }
/**
* @brief
*
* @return uint64
*/
uint64 GetUInt64() const
{
uint64 value = 0;
@ -70,15 +148,32 @@ class Field
}
void SetType(enum DataTypes type) { mType = type; }
// no need for memory allocations to store resultset field strings
// all we need is to cache pointers returned by different DBMS APIs
void SetValue(const char* value) { mValue = value; };
/**
* @brief no need for memory allocations to store resultset field strings
*
* all we need is to cache pointers returned by different DBMS APIs
*
* @param value
*/
void SetValue(const char* value) { mValue = value; }
private:
/**
* @brief
*
* @param
*/
Field(Field const&);
/**
* @brief
*
* @param
* @return Field &operator
*/
Field& operator=(Field const&);
const char* mValue;
const char* mValue; /**< TODO */
enum DataTypes mType;
};
#endif