CMGDK r49-rc2
|
#include <hgl/db/cdbfield.h>
名字空间 | |
namespace | hgl |
__MAKE_HGL__&&!__MAKE_PLUGIN__ | |
namespace | hgl::cdb |
Chinese DataBase用名字空间 | |
宏定义 | |
#define | FIELD_GET_FUNC(func_name, type_name) |
#define | FIELD_GET_ARRAY_FUNC(func_name, type_name, cbt_name) |
函数 | |
Field * | hgl::cdb::CreateField (const WideString &name, FieldType &ft, Stream *str=NULL, int count=0) |
hgl::cdb::FIELD_GET_FUNC (GetInteger, int) | |
hgl::cdb::FIELD_GET_FUNC (GetUInteger, uint) | |
hgl::cdb::FIELD_GET_FUNC (GetFloat, float) | |
hgl::cdb::FIELD_GET_ARRAY_FUNC (GetInt8Array, int8, cbtInt8) | |
hgl::cdb::FIELD_GET_ARRAY_FUNC (GetInt16Array, int16, cbtInt16) | |
hgl::cdb::FIELD_GET_ARRAY_FUNC (GetInt32Array, int32, cbtInt32) | |
hgl::cdb::FIELD_GET_ARRAY_FUNC (GetUint8Array, uint8, cbtUint8) | |
hgl::cdb::FIELD_GET_ARRAY_FUNC (GetUint16Array, uint16, cbtUint16) | |
hgl::cdb::FIELD_GET_ARRAY_FUNC (GetUint32Array, uint32, cbtUint32) | |
hgl::cdb::FIELD_GET_ARRAY_FUNC (GetFloatArray, float, cbtFloat) |
#define FIELD_GET_ARRAY_FUNC | ( | func_name, | |
type_name, | |||
cbt_name | |||
) |
bool FieldFixed::func_name(int index,type_name *buf, int start,int number) \ { \ if(index<0 \ ||index>=Count \ ||Type.base!=cbt_name)return(false); \ \ if(start==-1&&number==-1) \ { \ start=0; \ number=Type.count; \ } \ else \ if(start<0 \ ||start>=Type.count \ ||start+number>Type.count) \ return(false); \ \ memcpy(buf,data+Type.size*index+start*sizeof(type_name),number*sizeof(type_name)); \ return(true); \ }
#define FIELD_GET_FUNC | ( | func_name, | |
type_name | |||
) |
bool FieldFixed::func_name(int index,type_name &value) \ { \ if(index<0 \ ||index>=Count \ ||Type.base<cbtInt8 \ ||Type.base>cbtFloat)return(false); \ \ if(Type.base==cbtInt8 ) value=*(int8 * )(data+(index));else \ if(Type.base==cbtInt16 ) value=*(int16 * )(data+(index<<1));else \ if(Type.base==cbtInt32 ) value=*(int32 * )(data+(index<<2));else \ if(Type.base==cbtUint8 ) value=*(uint8 * )(data+(index));else \ if(Type.base==cbtUint16 ) value=*(uint16 *)(data+(index<<1));else \ if(Type.base==cbtUint32 ) value=*(uint32 *)(data+(index<<2));else \ if(Type.base==cbtFloat ) value=*(float * )(data+(index<<2));else \ return(false); \ \ return(true); \ }