📄 ds_database.h
字号:
#ifndef __DS_DATABASE_H__
#define __DS_DATABASE_H__
typedef int BOOL; /* b */
#define FALSE 0
#define TRUE 1
typedef unsigned char BYTE; /* by */
typedef unsigned short WORD; /* w */
typedef signed short SHORT; /* sn */
typedef int INT; /* n */
typedef unsigned int UINT; /* n */
typedef unsigned long DWORD; /* dw */
typedef signed long LONG; /* l */
typedef float FLOAT; /* f */
#define FT_NULL 0
#define FT_I1 1
#define FT_UI1 FT_I1+1
#define FT_I2 FT_I1+2
#define FT_UI2 FT_I1+3
#define FT_I4 FT_I1+4
#define FT_UI4 FT_I1+5
#define FT_R4 FT_I1+6
#define FT_R8 FT_I1+7
#define FT_BYTE FT_UI1
#define FT_CHAR FT_I1
#define FT_WORD FT_UI2
#define FT_SHORT FT_I2
#define FT_DWORD FT_UI4
#define FT_LONG FT_I4
#define FT_FLOAT FT_R4
#define FT_DOUBLE FT_R8
#define FT_INT FT_I1+8
#define FT_STR FT_I1+9
#define FT_VOID FT_I1+10
#define TABLE_NAME_MAXLEN 20
#define FIELD_NAME_MAXLEN 10
#define VIEW_NAME_MAXLEN 20
#define HTABLE void*
#define HVIEW void*
#define VPOSITION void*
typedef enum
{
OPER_ADD,
OPER_DELETE,
OPER_MODIFY,
}OPER_TYPE;
typedef struct
{
UINT index;
char name[FIELD_NAME_MAXLEN+1];
BYTE type;
long size;
}TB_FIELD;
typedef struct{
union {
char cVal; // FT_I1.
BYTE bVal; // FT_UI1.
short iVal; // FT_I2.
unsigned short uiVal; // FT_UI2.
long lVal; // FT_I4.
unsigned long ulVal; // FT_UI4.
float fltVal; // FT_R4.
// double dblVal; // FT_R8.
int intVal; // FT_INT
char* pStrVal; // FT_STR
void* pVoidVal; // FT_VOID
};
}TB_VARIANT;
typedef long (*DSV_FILTERPROC)( HVIEW hView, VPOSITION pos );
typedef long (*DSV_COMPAREPROC)( TB_VARIANT*, TB_VARIANT*, BYTE );
typedef void (*DSV_NOTIFYPROC)( HVIEW hView, OPER_TYPE, VPOSITION pos, INT field );
////////////////////// Table /////////////////////////////////////////
HTABLE DST_CreateTable( const char* table_name, UINT field_num );
BOOL DST_DestroyTable( HTABLE hTable );
BOOL DST_SetFieldInfo( HTABLE hTable, UINT field_index, TB_FIELD fieldinfo );
BOOL DST_GetFieldInfo( HTABLE hTable, UINT field_index, TB_FIELD* fieldinfo );
BOOL DST_AddRecord( HTABLE hTable );
BOOL DST_DeleteCurRecord( HTABLE hTable );
BOOL DST_SetFieldValue( HTABLE hTable, UINT field_index, TB_VARIANT field_value );
BOOL DST_GetFieldValue( HTABLE hTable, UINT field_index, TB_VARIANT* field_value );
void DST_MoveNext( HTABLE hTable );
void DST_MovePrev( HTABLE hTable );
void DST_MoveFirst( HTABLE hTable );
void DST_MoveLast( HTABLE hTable );
int DST_GetRecordCount( HTABLE hTable );
BOOL DST_IsTable( HTABLE hTable );
BYTE DST_GetFieldType( HTABLE hTable, UINT field_index );
////////////////////// View /////////////////////////////////////////
HVIEW DSV_CreateView( HTABLE hTable, const char* view_name, UINT field_num );
BOOL DSV_DestroyView( HVIEW hView );
BOOL DSV_GetFieldInfo( HVIEW hView, UINT field_index, TB_FIELD* fieldinfo );
BOOL DSV_AttachField( HVIEW hView, UINT view_field, UINT table_field );
BOOL DSV_GetFieldInfo( HVIEW hView, UINT field_index, TB_FIELD* fieldinfo );
BOOL DSV_AddRecord( HVIEW hView );
BOOL DSV_DeleteRecord( HVIEW hView );
BOOL DSV_SetFieldValue( HVIEW hView, UINT field_index, TB_VARIANT field_value );
BOOL DSV_GetFieldValue( HVIEW hView, UINT field_index, TB_VARIANT* field_value );
void DSV_MoveNext( HVIEW hView );
void DSV_MovePrev( HVIEW hView );
void DSV_MoveFirst( HVIEW hView );
void DSV_MoveLast( HVIEW hView );
int DSV_GetRecordCount( HVIEW hView );
BOOL DSV_IsView( HVIEW hView );
void DSV_RefreshView( HVIEW hView );
void DSV_Clear( HVIEW hView );
BOOL DSV_IsEOF( HVIEW hView );
BOOL DSV_IsBOF( HVIEW hView );
void DSV_SetAbsolutePostion( HVIEW hView, VPOSITION pos );
INT DSV_GetFieldCount( HVIEW hView );
BOOL DSV_SetOrder( HVIEW hView, UINT field, DSV_COMPAREPROC compareproc );
BOOL DSV_SetFilter( HVIEW hView, DSV_FILTERPROC filterproc );
BOOL DSV_SetNotify( HVIEW hView, DSV_NOTIFYPROC notifyproc );
INT DSV_GetRecordIndex( HVIEW hView );
BOOL DSV_CreateMainIndex( HVIEW hView );
BOOL DSV_SetAbsoluteIndex( HVIEW hView, UINT record_index );
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -