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

📄 dbf.h

📁 一个通讯管理机的源代码。比较好用。推荐
💻 H
📖 第 1 页 / 共 2 页
字号:
   xbShort   GetDbfStatus( void ) { return DbfStatus; }   xbShort   GetFirstRecord( void );   xbShort   GetLastRecord( void );   xbShort   GetNextRecord( void );   xbShort   GetPrevRecord( void );   //! Return current record number   /*!   */   xbLong    GetCurRecNo( void ) { return CurRec; }   xbShort   GetRecord( xbULong );   //! Return a pointer to the record buffer   /*!   */   char *    GetRecordBuf( void ) { return RecBuf; }   //! Return record length   /*!   */   xbShort   GetRecordLen( void ) { return RecordLen; }   xbShort   NameSuffixMissing( xbShort, const char * );   xbLong    NoOfRecords( void );   xbLong    PhysicalNoOfRecords(void);   xbShort   OpenDatabase( const char * );   xbShort   PackDatabase(xbShort LockWaitOption,                          void (*packStatusFunc)(xbLong itemNum, xbLong numItems) = 0,                          void (*indexStatusFunc)(xbLong itemNum, xbLong numItems) = 0);   xbShort   PutRecord(void); // Put record to current position   xbShort   PutRecord(xbULong);   xbShort   RebuildAllIndices(void (*statusFunc)(xbLong itemNum, xbLong numItems) = 0);   xbShort   RecordDeleted( void );   //! Set number of records to zero????   /*!   */   void      ResetNoOfRecs( void ) { NoOfRecs = 0L; }   xbShort   SetVersion( xbShort );   //! Undelete all records   /*!   */   xbShort   UndeleteAllRecords( void ) { return DeleteAll(1); }   xbShort   UndeleteRecord( void );   xbShort   Zap( xbShort );/* field methods */   const char *GetField(xbShort FieldNo) const; // Using internal static buffer   const char *GetField(const char *Name) const;   xbShort   GetField( xbShort FieldNo, char *Buf) const;   xbShort   GetRawField(const xbShort FieldNo, char *Buf) const;   xbShort   GetField( xbShort FieldNo, char *Buf, xbShort RecBufSw) const;   xbShort   GetField( const char *Name, char *Buf) const;   xbShort   GetRawField(const char *Name, char *Buf) const;   xbShort   GetField( const char *Name, char *Buf, xbShort RecBufSw) const;   xbShort   GetField(xbShort FieldNo, xbString&, xbShort RecBufSw ) const;   xbShort   GetFieldDecimal( const xbShort );   xbShort   GetFieldLen( const xbShort );   char *    GetFieldName( const xbShort );   xbShort   GetFieldNo( const char * FieldName ) const;   char      GetFieldType( const xbShort FieldNo ) const;   xbShort   GetLogicalField( const xbShort FieldNo );   xbShort   GetLogicalField( const char * FieldName );   char *    GetStringField( const xbShort FieldNo );   char *    GetStringField( const char * FieldName );   xbShort   PutField( const xbShort, const char * );   xbShort   PutRawField( const xbShort FieldNo, const char *buf );   xbShort   PutField( const char *Name, const char *buf);   xbShort   PutRawField( const char *Name, const char *buf );   xbShort   ValidLogicalData( const char * );   xbShort   ValidNumericData( const char * );   xbLong    GetLongField( const char *FieldName) const;   xbLong    GetLongField( const xbShort FieldNo) const;   xbShort   PutLongField( const xbShort, const xbLong );   xbShort   PutLongField( const char *, const xbLong);   xbFloat   GetFloatField( const char * FieldName );   xbFloat   GetFloatField( const xbShort FieldNo );   xbShort   PutFloatField( const char *, const xbFloat);   xbShort   PutFloatField( const xbShort, const xbFloat);   xbDouble  GetDoubleField(const char *);   xbDouble  GetDoubleField(const xbShort, xbShort RecBufSw = 0);   xbShort   PutDoubleField(const char *, const xbDouble);   xbShort   PutDoubleField(const xbShort, const xbDouble);#ifdef XB_LOCKING_ON   xbShort   LockDatabase( const xbShort, const xbShort, const xbULong );   xbShort   ExclusiveLock( const xbShort );   xbShort   ExclusiveUnlock( void );#ifndef HAVE_FCNTL   xbShort   UnixToDosLockCommand( const xbShort WaitOption,             const xbShort LockType ) const;#endif#else   xbShort   LockDatabase( const xbShort, const xbShort, const xbLong )     { return XB_NO_ERROR; }   xbShort   ExclusiveLock( const xbShort ) { return XB_NO_ERROR; };   xbShort   ExclusiveUnlock( void )      { return XB_NO_ERROR; };#endif   //! Turn autolock on   /*!   */   void    AutoLockOn( void )  { AutoLock = 1; }   //! Turn autolock off   /*!   */   void    AutoLockOff( void ) { AutoLock = 0; }   //! Return whether or not autolocking is on or off   /*!   */   xbShort GetAutoLock(void) { return AutoLock; }#ifdef XB_MEMO_FIELDS   xbShort   GetMemoField( const xbShort FieldNo,const xbLong len,             char * Buf, const xbShort LockOption );   xbLong    GetMemoFieldLen( const xbShort FieldNo );   xbShort   UpdateMemoData( const xbShort FieldNo, const xbLong len,              const char * Buf, const xbShort LockOption );   xbShort   MemoFieldExists( const xbShort FieldNo ) const;   xbShort   LockMemoFile( const xbShort WaitOption, const xbShort LockType );   xbShort   MemoFieldsPresent( void ) const;   xbLong    CalcLastDataBlock();   xbShort   FindBlockSetInChain( const xbLong BlocksNeeded, const xbLong               LastDataBlock, xbLong & Location, xbLong &PreviousNode );   xbShort   GetBlockSetFromChain( const xbLong BlocksNeeded, const xbLong               Location, const xbLong PreviousNode );#ifdef XBASE_DEBUG   xbShort   DumpMemoFreeChain( void );   void      DumpMemoHeader( void ) const;   void      DumpMemoBlock( void ) const;#endif#endif   //! Turn on "real" deletes   /*!     This should be done before creating a database (with     xbDbf::CreateDatatabase()) and thereafter before opening    a database with xbDbfCreateDatabase().        You cannot "turn on" real deletes once a database has been created    and records added.   */   void      RealDeleteOn(void) { RealDelete = 1; if(fp) ReadHeader(1); }   /*! Turn off "real" deletes   */   void      RealDeleteOff(void) { RealDelete = 0; if(fp) ReadHeader(1); }   //! Return whether "real" deletes are on or off   /*!     Use this to determine if "real deletes" are being used with    the database.   */   xbShort   GetRealDelete(void) { return RealDelete; }#if defined(XB_INDEX_ANY)   xbShort   IndexCount(void);   xbIndex   *GetIndex(xbShort indexNum);#endifprotected:   xbString DatabaseName;   xbShort  XFV;                  /* xBASE file version            */   xbShort  NoOfFields;   char   DbfStatus;              /* 0 = closed                                     1 = open                                     2 = updates pending           */   FILE   *fp;                    /* file pointer                  */   xbSchemaRec *SchemaPtr;        /* Pointer to field data         */   char   *RecBuf;                /* Pointer to record buffer      */   char   *RecBuf2;               /* Pointer to original rec buf   */#ifdef XB_MEMO_FIELDS   FILE    *mfp;                  /* memo file pointer             */   void    *mbb;                  /* memo block buffer             */   xbMH     MemoHeader;           /* memo header structure         */   xbShort  mfield1;              /* memo block field one FF       */   xbShort  MStartPos;            /* memo start pos of data        */   xbLong   MFieldLen;            /* memo length of data           */   xbLong   NextFreeBlock;        /* next free block in free chain */   xbLong   FreeBlockCnt;         /* count of free blocks this set */   xbLong   MNextBlockNo;         /* free block chain              */   xbLong   MNoOfFreeBlocks;      /* free block chain              */   xbLong   CurMemoBlockNo;       /* Current block no loaded       */#endif/* Next seven variables are read directly off the database header *//* Don't change the order of the following seven items            */   char   Version;   char   UpdateYY;   char   UpdateMM;   char   UpdateDD;//   xbLong   NoOfRecs;//   xbShort  HeaderLen;//   xbShort  RecordLen;   xbULong  NoOfRecs;   xbUShort HeaderLen;   xbUShort RecordLen;//#ifdef XB_REAL_DELETE   xbULong  FirstFreeRec;   xbULong  RealNumRecs;//#endif   xbIxList * MdxList;   xbIxList * NdxList;   xbIxList * FreeIxList;   xbULong  CurRec;               /* Current record or zero   */   xbShort  AutoLock;             /* Auto update option 0 = off  *///#ifdef XB_REAL_DELETE   xbShort  RealDelete;           /* real delete option 0 = off *///#endif#ifdef XB_LOCKING_ON   xbShort CurLockType;           /* current type of file lock */   xbShort CurLockCount;          /* number of current file locks */   xbULong CurLockedRecNo;        /* currently locked record no */   xbShort CurRecLockType;        /* current type of rec lock held (F_RDLOCK or F_WRLCK) */   xbShort CurRecLockCount;       /* number of current record locks */   xbShort CurMemoLockType;       /* current type of memo lock */   xbShort CurMemoLockCount;      /* number of current memo locks */#endif   xbShort   DeleteAll( xbShort );   void    InitVars( void );   xbShort   PackDatafiles(void (*statusFunc)(xbLong itemNum, xbLong numItems) = 0);   xbShort   ReadHeader( xbShort );   xbShort   WriteHeader( const xbShort );#ifdef XB_MEMO_FIELDS   xbShort   AddMemoData( const xbShort FieldNo, const xbLong Len, const char * Buf );   xbShort   CreateMemoFile( void );   xbShort   DeleteMemoField( const xbShort FieldNo );   xbShort   GetDbtHeader( const xbShort Option );   xbShort   GetMemoBlockSize( void ) { return MemoHeader.BlockSize; }   xbShort   OpenMemoFile( void );   xbShort   PutMemoData( const xbLong StartBlock, const xbLong BlocksNeeded,             const xbLong Len, const char * Buf );   xbShort   ReadMemoBlock( const xbLong BlockNo, const xbShort Option);   xbShort   SetMemoBlockSize( const xbShort );   xbShort   UpdateHeadNextNode( void ) const;   xbShort   WriteMemoBlock( const xbLong BlockNo, const xbShort Option );   xbShort   IsType3Dbt( void ) const { return( Version==(char)0x83 ? 1:0 ); }   xbShort   IsType4Dbt( void ) const            {return (( Version==(char)0x8B || Version==(char)0x8E ) ? 1:0 );}#endif};#endif      // __XB_DBF_H__

⌨️ 快捷键说明

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