📄 field.h
字号:
/* Copyright(C) 1999, 2000 by JiangSu Bell Software CO.,LTD. */
/*
Name: field.h Version: 1.0.0
Created by HanBing Date: 2000-08-08
Comment:
Modified:
1) 2000-08-08 HanBing - Create;
*/
#ifndef __FIELD__
#define __FIELD__
/* Define Data types for Field */
typedef enum DataBaseTypes
{
VoidT,
IntT,
FloatT,
CharT
} DataType;
/*
Class: CField Version: 1.0
Created by HanBing Date: 2000-08-08
Implementation File: field.cpp
Comment:
Modified
1) 2000-08-08 HanBing - Create;
*/
class CField
{
public:
CField( const char *pcName=NULL, DataType type=VoidT, unsigned short len=255, unsigned short key=0 );
~CField();
/* oprators for copy */
CField& operator = ( CField& Field );
/* oprators for set value */
long operator = ( long Value );
inline int operator = ( int Value )
{
return (long)operator = ( long(Value) );
}
double operator = ( double Value );
inline float operator = ( float Value )
{
return (float)operator = ( double(Value) );
}
char* operator = ( const char* Value );
/* functions for get value */
long& Int();
double& Float();
char* Char();
/*
Name: Buff()
Create by HanBing Date: 2000-08-08
Define in Class: CField File: field.h
Comment: Get the Field's buffer pointer;
Parameters:
Return Value: the Field' buffer pointer
Modified:
1) 2000-08-08 HanBing - Create;
*/
inline unsigned char* Buff()
{
return (unsigned char*)FieldValue;
}
/* Set the Field's name */
void SetName( const char *pcName );
/* Set the Field's type and length */
void SetType( DataType type, unsigned short len );
/* Set the Field's key */
void SetKey( unsigned short order );
void Set( const char *pcName=NULL, DataType type=VoidT, unsigned short len=255, unsigned short key=0 )
{
SetName( pcName );
if ( type != FieldType || len!= FieldLen )
SetType( type, len );
SetKey( key );
}
/*
Name: Name()
Create by HanBing Date: 2000-08-08
Define in Class: CField File: field.h
Comment: Get the Field's name;
Parameters:
Return Value: the Field's name;
Modified:
1) 2000-08-08 HanBing - Create;
*/
inline const char* Name()
{
return FieldName;
}
/*
Name: Type()
Create by HanBing Date: 2000-08-08
Define in Class: CField File: field.h
Comment: Get the Field's type;
Parameters:
Return Value: the Field's type;
Modified:
1) 2000-08-08 HanBing - Create;
*/
inline DataType Type()
{
return FieldType;
}
/*
Name: Len()
Create by HanBing Date: 2000-08-08
Define in Class: CField File: field.h
Comment: Get the Field's Length;
Parameters:
Return Value: the Field's Length;
Modified:
1) 2000-08-08 HanBing - Create;
*/
inline unsigned short Len()
{
return FieldLen;
}
/*
Name: Key()
Create by HanBing Date: 2000-08-08
Define in Class: CField File: field.h
Comment: Get the Field's Key order;
Parameters:
Return Value: if the Field is not a key, return 0
else return the key's order
Modified:
1) 2000-08-08 HanBing - Create;
*/
inline unsigned short Key()
{
return KeyOrder;
}
/*
Name: IsNull()
Create by HanBing Date: 2000-08-08
Define in Class: CField File: field.h
Comment: Get whether the Field's value is NULL;
Parameters:
Return Value: if the Field's value is NULL, return true
else return false
Modified:
1) 2000-08-08 HanBing - Create;
*/
inline bool IsNull()
{
return ( Null ? true : false );
}
inline void SetNull()
{
Null = -1;
}
inline short& State()
{
return Null;
}
void Print();
private:
char *FieldName;
void *FieldValue;
DataType FieldType;
unsigned short FieldLen;
unsigned short KeyOrder;
short Null;
};
#endif __FIELD__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -