⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dbf.h

📁 一个通讯管理机的源代码。比较好用。推荐
💻 H
📖 第 1 页 / 共 2 页
字号:
/***************************************************************************                          dbf.h  -  description                             -------------------    begin                : Thu Jan 17 2002    copyright            : (C) 2002 by     email                :  ***************************************************************************//*************************************************************************** *                                                                         * *   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 2 of the License, or     * *   (at your option) any later version.                                   * *                                                                         * ***************************************************************************//*  $Id: dbf.h,v 1.8 2001/01/13 20:20:53 dbryson Exp $    Xbase project source code    This file contains the Class definition for a xbDBF object.    Copyright (C) 1997  StarTech, Gary A. Kunkel       This library is free software; you can redistribute it and/or    modify it under the terms of the GNU Lesser General Public    License as published by the Free Software Foundation; either    version 2.1 of the License, or (at your option) any later version.    This library 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    Lesser General Public License for more details.    You should have received a copy of the GNU Lesser General Public    License along with this library; if not, write to the Free Software    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA    Contact:      Mail:        Technology Associates, Inc.        XBase Project        1455 Deming Way #11        Sparks, NV 89434        USA      Email:        xbase@techass.com      See our website at:        xdb.sourceforge.net    V 1.0    10/10/97   - Initial release of software    V 1.3    11/30/97   - Added memo field processing    V 1.6a   4/1/98     - Added expression support    V 1.6b   4/8/98     - Numeric index keys    V 1.7.4d 10/28/98   - Added support for OS2/DOS/Win/NT locking    V 1.8    11/29/98   - New class names and types     V 1.9.2  9/14/99    - Updated EOR and EOF processing*/#ifndef __XB_DBF_H__#define __XB_DBF_H__#ifdef __GNUG__#pragma interface#endif#ifdef __WIN32__#include "xbconfigw32.h"#else#include "xbconfig.h"#endif#include "xtypes.h"#include "xdate.h"#include <iostream.h>#include <stdio.h>/*! \file dbf.h*/#if defined(XB_INDEX_ANY)   class XBDLLEXPORT xbIndex;   class XBDLLEXPORT xbNdx;   class XBDLLEXPORT xbNtx;#endif/*****************************//* Field Types               */#define XB_CHAR_FLD      'C'#define XB_LOGICAL_FLD   'L'#define XB_NUMERIC_FLD   'N'#define XB_DATE_FLD      'D'#define XB_MEMO_FLD      'M'#define XB_FLOAT_FLD     'F'/*****************************//* File Status Codes         */#define XB_CLOSED  0#define XB_OPEN    1#define XB_UPDATED 2/*****************************//* Other defines             */#define XB_OVERLAY     1#define XB_DONTOVERLAY 0#define XB_CHAREOF  '\x1A'         /* end of DBF        */#define XB_CHARHDR  '\x0D'         /* header terminator *///! Used to define the fields in a database (DBF file)./*!  Generally one would define an xbSchema array to be passed  to xbDbf::CreateDatabase() to define the fields in the database.  For example, one might create a declaration as follows:    \code    xbSchema MyRecord[] =   {    { "FIRSTNAME", XB_CHAR_FLD,     15, 0 },    { "LASTNAME",  XB_CHAR_FLD,     20, 0 },    { "BIRTHDATE", XB_DATE_FLD,      8,  0 },    { "AMOUNT",    XB_NUMERIC_FLD,   9,  2 },    { "SWITCH",    XB_LOGICAL_FLD,   1,  0 },    { "FLOAT1",    XB_FLOAT_FLD,     9,  2 },    { "FLOAT2",    XB_FLOAT_FLD,     9,  1 },    { "FLOAT3",    XB_FLOAT_FLD,     9,  2 },    { "FLOAT4",    XB_FLOAT_FLD,     9,  3 },    { "MEMO1",     XB_MEMO_FLD,     10, 0 },    { "ZIPCODE",   XB_NUMERIC_FLD,   5,  0 },          { "",0,0,0 }  };  \endcode    Note that the last xbSchema in an array must be a "null" entry like the   one above:    \code    { "",0,0,0 }  \endcode    To indicate the end of the array.*/struct XBDLLEXPORT xbSchema {   char      FieldName[11];   char      Type;// xbUShort  FieldLen;       /* does not work */// xbUShort  NoOfDecs;       /* does not work */   unsigned  char FieldLen;  /* fields are stored as one byte on record*/   unsigned  char NoOfDecs;};//! Defines a field in an XBase file header (DBF file header)/*!  This structure is only used internally by the xbDbf class.*/struct XBDLLEXPORT xbSchemaRec {   char     FieldName[11];   char     Type;            /* field type */   char     *Address;        /* pointer to field in record buffer 1 */// xbUShort FieldLen;        /* does not work */// xbUShort NoOfDecs;        /* does not work */   unsigned char FieldLen;   /* fields are stored as one byte on record */   unsigned char NoOfDecs;   char     *Address2;       /* pointer to field in record buffer 2 */   char     *fp;             /* pointer to null terminated buffer for field */                             /* see method GetString */   xbShort  LongFieldLen;    /* to handle long field lengths */};//! xbIxList struct/*!  Internal use only.*/struct XBDLLEXPORT xbIxList {   xbIxList * NextIx;   xbString IxName;#if defined(XB_INDEX_ANY)   xbIndex  * index;   xbShort  Unique;   xbShort  KeyUpdated;#endif};//! xbMH struct/*!  Internal use only.*/#ifdef XB_MEMO_FIELDSstruct XBDLLEXPORT xbMH{                      /* memo header                    */   xbLong  NextBlock;             /* pointer to next block to write */   char    FileName[8];           /* name of dbt file               */   char    Version;               /* not sure                       */   xbShort BlockSize;             /* memo file block size           */};#endif//! xbDbf class/*!  The xbDbf class encapsulates an xbase DBF database file.  It includes  all dbf access, field access, and locking methods.*/class XBDLLEXPORT xbDbf {public:   xbDbf( xbXBase * );   xbXBase  *xbase;               /* linkage to main base class *///   char EofChar[10];/* datafile methods */#if defined(XB_INDEX_ANY)   xbShort   AddIndexToIxList(xbIndex *, const char *IndexName);   xbShort   RemoveIndexFromIxList( xbIndex * );#endif   xbShort   AppendRecord( void );   xbShort   BlankRecord( void );   xbLong    CalcCheckSum( void );   xbShort   CloseDatabase(bool deleteIndexes = 0);   xbShort   CopyDbfStructure( const char *, xbShort );   xbShort   CreateDatabase( const char * Name, xbSchema *, const xbShort Overlay );   //! Return the current position in the dbf file   /*!   */   xbLong    DbfTell( void ) { return ftell( fp ); }   //! Delete all records   /*!   */   xbShort   DeleteAllRecords( void ) { return DeleteAll(0); }   xbShort   DeleteRecord( void );#ifdef XBASE_DEBUG   xbShort   DumpHeader( xbShort );#endif   xbShort   DumpRecord( xbULong );   //! Return number of fields   /*!   */   xbLong    FieldCount( void ) { return NoOfFields; }   //! Return Dbf name   /*!   */   xbString& GetDbfName( void ) { return DatabaseName; }   //! Return status   /*!   */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -