Xbase64 4.0.1
C++ Library for handling Xbase (DBF) format type files
Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Static Protected Attributes | Friends
xb::xbXBase Class Reference

xbXbase class. More...

#include <xbxbase.h>

Inheritance diagram for xb::xbXBase:
xb::xbTblMgr xb::xbSsv

Public Member Functions

 xbXBase ()
 Class Constructor. More...
 
 ~xbXBase ()
 Class Deconstructor. More...
 
xbInt16 CloseAllTables ()
 Close all tables / files. More...
 
xbInt16 CreateFqn (const xbString &sDirIn, const xbString &sNameIn, const xbString &sExtIn, xbString &sFqfnOut)
 Fully qualified file name from a directory, filename and extension. More...
 
void DisableMsgLogging ()
 
void EnableMsgLogging ()
 
xbInt16 FlushLog ()
 
const xbStringGetLogFqFileName () const
 
xbBool GetLogStatus () const
 
xbInt16 OpenHighestVersion (const xbString &sTableName, const xbString &sAlias, xbDbf &dbf, int dummy)
 
xbInt16 OpenHighestVersion (const xbString &sTableName, const xbString &sAlias, xbDbf **dbf)
 
xbDbfOpen (const xbString &sTableName, xbInt16 &iRc)
 Open highest qualified class available for dbf file. More...
 
xbDbfOpen (const xbString &sTableName, const xbString &sAlias, xbInt16 iOpenMode, xbInt16 iShareMode, xbInt16 iVersion, xbInt16 &iRc)
 Open highest qualified class available for dbf file. More...
 
void SetLogSize (size_t lSize)
 
size_t GetLogSize () const
 
xbInt16 WriteLogMessage (const xbString &sLogMessage, xbInt16 iOutputOpt=0)
 
xbInt16 WriteLogBytes (xbUInt32 lCnt, const char *p)
 
void xbSleep (xbInt32 lMillisecs)
 Cross platform sleep function. More...
 
xbInt16 GetCmdLineOpt (xbInt32 lArgc, char **argv, const char *sOptRqst, xbString &sParmOut)
 Parse commmand line options for a given parm request. More...
 
xbInt16 GetCmdLineOpt (xbInt32 lArgc, char **argv, xbString &sOptRqst, xbString &sParmOut)
 Parse commmand line options for a given parm request. More...
 
xbInt16 AddTblToTblList (xbDbf *d, const xbString &sFqTblName)
 
xbInt16 AddTblToTblList (xbDbf *d, const xbString &sFqTblName, const xbString &sTblAlias)
 
xbInt16 DisplayTableList () const
 
xbDbfGetDbfPtr (const xbString &sTblAlias) const
 
xbDbfGetDbfPtr (xbInt16 sItemNo) const
 
xbTblListGetTblListEntry (xbDbf *d)
 
xbInt16 GetOpenTableCount () const
 
xbInt16 RemoveTblFromTblList (const xbString &sTblAlias)
 
xbInt16 RemoveTblFromTblList (xbDbf *d)
 
void DisplayError (xbInt16 ErrorCode) const
 Display error message on console for a given error number. More...
 
xbStringGetDefaultDateFormat () const
 Get the default date format. More...
 
xbStringGetDataDirectory () const
 Get the current data directory. More...
 
xbStringGetTempDirectory () const
 Get the current temp directory. More...
 
void GetHomeDir (xbString &sHomeDirOut)
 Get home directory. More...
 
xbInt16 GetEndianType () const
 Get the Endian type. More...
 
const char * GetErrorMessage (xbInt16 ErrorCode) const
 Get an error message. More...
 
char GetPathSeparator () const
 Get the OS dependent path separator. More...
 
void SetDataDirectory (const xbString &sDataDirectory)
 Set the data directory. More...
 
void SetDefaultDateFormat (const xbString &sDefaultDateFormat)
 Set the default date format. More...
 
void SetTempDirectory (const xbString &sTempDirectory)
 Set the temp directory. More...
 
xbBool BitSet (unsigned char c, xbInt16 iBitNo) const
 Check a bit in a one byte field and see if it is set. More...
 
void BitDump (unsigned char c) const
 
void BitDump (char c) const
 
xbBool GetDefaultAutoCommit () const
 Get the default auto commit setting. More...
 
void SetDefaultAutoCommit (xbBool bDefaultAutoCommit)
 Set the default auto commit. More...
 
xbStringGetLogDirectory () const
 
xbStringGetLogFileName () const
 
void SetLogDirectory (const xbString &sLogDirectory)
 
void SetLogFileName (const xbString &sLogFileName)
 
xbBool GetMultiUser () const
 Get the multi user setting. More...
 
void SetMultiUser (xbBool bMultiUser)
 Get the multi user setting. More...
 

Static Public Attributes

static const char * ErrorCodeText []
 

Protected Member Functions

xbInt16 GetFunctionInfo (const xbString &sExpLine, char &cReturnType, xbInt16 &iReturnLenCalc, xbInt32 &lReturnLenVal) const
 
void SetEndianType ()
 Set the endian type. More...
 

Static Protected Member Functions

static xbInt16 xbMemcmp (const unsigned char *s1, const unsigned char *s2, size_t n)
 Cross memcmp function. More...
 

Static Protected Attributes

static xbInt16 iEndianType = 0
 
static xbString sNullString = ""
 

Friends

class xbBcd
 
class xbExp
 

Detailed Description

xbXbase class.

The xbXBase class is the core class that needs to be in every application program.

Constructor & Destructor Documentation

◆ xbXBase()

xb::xbXBase::xbXBase ( )

Class Constructor.

◆ ~xbXBase()

xb::xbXBase::~xbXBase ( )

Class Deconstructor.

Member Function Documentation

◆ AddTblToTblList() [1/2]

xbInt16 xb::xbTblMgr::AddTblToTblList ( xbDbf d,
const xbString sFqTblName 
)
inherited

◆ AddTblToTblList() [2/2]

xbInt16 xb::xbTblMgr::AddTblToTblList ( xbDbf d,
const xbString sFqTblName,
const xbString sTblAlias 
)
inherited

◆ BitDump() [1/2]

void xb::xbSsv::BitDump ( char  c) const
inherited

◆ BitDump() [2/2]

void xb::xbSsv::BitDump ( unsigned char  c) const
inherited

◆ BitSet()

xbBool xb::xbSsv::BitSet ( unsigned char  c,
xbInt16  iBitNo 
) const
inherited

Check a bit in a one byte field and see if it is set.

Parameters
cOne byte char field to examine.
iBitNowhich bit to examine.
Returns
xbTrue Bit is set
xbFalse Bit is not set

◆ CloseAllTables()

xbInt16 xb::xbXBase::CloseAllTables ( )

Close all tables / files.

This closes everything and deletes references to the associated xbDbf objects.

Returns
Return Codes

◆ CreateFqn()

xbInt16 xb::xbXBase::CreateFqn ( const xbString sDirIn,
const xbString sNameIn,
const xbString sExtIn,
xbString sFqnOut 
)

Fully qualified file name from a directory, filename and extension.

Given a directory, file name and file extension as inputs, create a fully qualified file name.

Parameters
sDirInDirectory
sFileInFile Name
sExtInFile Extension
sFqnOutA fully qualifed unique file name as output
Returns
XB_INVALIED_PARAMETER or XB_NO_ERROR

◆ DisableMsgLogging()

void xb::xbXBase::DisableMsgLogging ( )

◆ DisplayError()

void xb::xbSsv::DisplayError ( xbInt16  iErrorCode) const
inherited

Display error message on console for a given error number.

Parameters
iErrorCodeError number to reference

◆ DisplayTableList()

xbInt16 xb::xbTblMgr::DisplayTableList ( ) const
inherited

◆ EnableMsgLogging()

void xb::xbXBase::EnableMsgLogging ( )

◆ FlushLog()

xbInt16 xb::xbXBase::FlushLog ( )

◆ GetCmdLineOpt() [1/2]

xbInt16 xb::xbXBase::GetCmdLineOpt ( xbInt32  lArgc,
char **  sArgv,
const char *  sOptRqst,
xbString sParmOut 
)

Parse commmand line options for a given parm request.

Parameters
lArgcValue passed from main( argc, argv[] )
sArgvValued passed from main
sOptRqstOption to search for in the arguments list
sParmOutString token immediately to the right of the the option request, if found
Returns
0 - paramater request not found
1 - Parameter found

◆ GetCmdLineOpt() [2/2]

xbInt16 xb::xbXBase::GetCmdLineOpt ( xbInt32  lArgc,
char **  sArgv,
xbString sOptRqst,
xbString sParmOut 
)

Parse commmand line options for a given parm request.

Parameters
lArgcValue passed from main( argc, argv[] )
sArgvValued passed from main
sOptRqstOption to search for in the arguments list
sParmOutString token immediately to the right of the the option request, if found
Returns
0 - paramater request not found
1 - Parameter found

◆ GetDataDirectory()

xbString & xb::xbSsv::GetDataDirectory ( ) const
inherited

Get the current data directory.

Returns
xbString containing the current data directory where the database files are stored.

◆ GetDbfPtr() [1/2]

xbDbf * xb::xbTblMgr::GetDbfPtr ( const xbString sTblAlias) const
inherited

◆ GetDbfPtr() [2/2]

xbDbf * xb::xbTblMgr::GetDbfPtr ( xbInt16  sItemNo) const
inherited

◆ GetDefaultAutoCommit()

xbBool xb::xbSsv::GetDefaultAutoCommit ( ) const
inherited

Get the default auto commit setting.

When auto commit is enabled, the library will automatically post any updates when moving off an updated record or closing files. If auto commit is disabled, the application program will need to explicitly update the tables using using dbf->Put() and dbf->AppendRecord().

Returns
xbTrue if auto commit is turned on
xbFalse is auto commit is turned off

◆ GetDefaultDateFormat()

xbString & xb::xbSsv::GetDefaultDateFormat ( ) const
inherited

Get the default date format.

Returns
xbString containing the default date format.

◆ GetEndianType()

xbInt16 xb::xbSsv::GetEndianType ( ) const
inherited

Get the Endian type.

Returns
B - Big endian
L - Little endian

◆ GetErrorMessage()

const char * xb::xbSsv::GetErrorMessage ( xbInt16  iErrorCode) const
inherited

Get an error message.

Parameters
iErrorCodeErrorCode is the error number of description to be returned.
Returns
Returns a pointer to a string containing a text description for the error code.

◆ GetFunctionInfo()

xbInt16 xb::xbXBase::GetFunctionInfo ( const xbString sExpLine,
char &  cReturnType,
xbInt16 &  iReturnLenCalc,
xbInt32 &  lReturnLenVal 
) const
protected

◆ GetHomeDir()

void xb::xbSsv::GetHomeDir ( xbString sHomeDirOut)
inherited

Get home directory.

Parameters
sHomeDirOut- Output home directory for current user.

◆ GetLogDirectory()

xbString & xb::xbSsv::GetLogDirectory ( ) const
inherited

◆ GetLogFileName()

xbString & xb::xbSsv::GetLogFileName ( ) const
inherited

◆ GetLogFqFileName()

const xbString & xb::xbXBase::GetLogFqFileName ( ) const

◆ GetLogSize()

size_t xb::xbXBase::GetLogSize ( ) const

◆ GetLogStatus()

xbBool xb::xbXBase::GetLogStatus ( ) const

◆ GetMultiUser()

xbBool xb::xbSsv::GetMultiUser ( ) const
inherited

Get the multi user setting.

Returns
xbTrue - Multi user mode turned on.
xbFalse - Multi user mode turned off.

◆ GetOpenTableCount()

xbInt16 xb::xbTblMgr::GetOpenTableCount ( ) const
inherited

◆ GetPathSeparator()

char xb::xbSsv::GetPathSeparator ( ) const
inherited

Get the OS dependent path separator.

Returns
Returns '\' for windows environment, otherwise returns '/'.

◆ GetTblListEntry()

xbTblList * xb::xbTblMgr::GetTblListEntry ( xbDbf d)
inherited

◆ GetTempDirectory()

xbString & xb::xbSsv::GetTempDirectory ( ) const
inherited

Get the current temp directory.

Returns
xbString containing the current data directory where the database files are stored.

◆ Open() [1/2]

xbDbf * xb::xbXBase::Open ( const xbString sTableName,
const xbString sAlias,
xbInt16  iOpenMode,
xbInt16  iShareMode,
xbInt16  iRequestVersion,
xbInt16 &  iRc 
)

Open highest qualified class available for dbf file.

This routine can open various versions of the dbf file dependent on the iVersion field

Parameters
sTableName- Table name to open.
sAlias- Optional alias name.
iOpenMode- XB_READ_WRITE or XB_READ
iShareMode- XB_SINGLE_USER or XB_MULTI_USER
iRequestVersion0 - Highest available 4 - Version four dbf 3 - Version three dbf
iRc- Return code from open request
Returns
param dbf - Output pointer to dbf file opened or null if error

◆ Open() [2/2]

xbDbf * xb::xbXBase::Open ( const xbString sTableName,
xbInt16 &  iRc 
)

Open highest qualified class available for dbf file.

This routine opens the highest available version of the dbf file. Defaults to XB_READ_WRITE and XB_MULTI_USER mode.

Returns
param dbf - Output pointer to dbf file opened or null if error

◆ OpenHighestVersion() [1/2]

xbInt16 xb::xbXBase::OpenHighestVersion ( const xbString sTableName,
const xbString sAlias,
xbDbf dbf,
int  dummy 
)

◆ OpenHighestVersion() [2/2]

xbInt16 xb::xbXBase::OpenHighestVersion ( const xbString sTableName,
const xbString sAlias,
xbDbf **  dbf 
)

◆ RemoveTblFromTblList() [1/2]

xbInt16 xb::xbTblMgr::RemoveTblFromTblList ( const xbString sTblAlias)
inherited

◆ RemoveTblFromTblList() [2/2]

xbInt16 xb::xbTblMgr::RemoveTblFromTblList ( xbDbf d)
inherited

◆ SetDataDirectory()

void xb::xbSsv::SetDataDirectory ( const xbString sDataDirectory)
inherited

Set the data directory.

Parameters
sDataDirectorySet the data directory.

◆ SetDefaultAutoCommit()

void xb::xbSsv::SetDefaultAutoCommit ( xbBool  bDefaultAutoCommit)
inherited

Set the default auto commit.

Disabling auto commit requires the application execute explicit updates using dbf->Put() and dbf->AppendRecord(). With auto commit on, the library posts updates automatically when moving off the current record or closing a file.

Parameters
bDefaultAutoCommitxbTrue - Enable default auto commit.
xbFalse - Disable default auto commit.

◆ SetDefaultDateFormat()

void xb::xbSsv::SetDefaultDateFormat ( const xbString sDefaultDateFormat)
inherited

Set the default date format.

Parameters
sDefaultDateFormatSet the default date format.

◆ SetEndianType()

void xb::xbSsv::SetEndianType ( )
protectedinherited

Set the endian type.

This routine determines the Endian-ness at run time instead of compile time as some processers (ie; Sparc,ARM) can be switched either way. This routine is called automatically by the library at startup and does not need to be called in an application program.

◆ SetLogDirectory()

void xb::xbSsv::SetLogDirectory ( const xbString sLogDirectory)
inherited

◆ SetLogFileName()

void xb::xbSsv::SetLogFileName ( const xbString sLogFileName)
inherited

◆ SetLogSize()

void xb::xbXBase::SetLogSize ( size_t  lSize)

◆ SetMultiUser()

void xb::xbSsv::SetMultiUser ( xbBool  bMultiUser)
inherited

Get the multi user setting.

Parameters
bMultiUserxbTrue - Turn on Multi user mode.
xbFalse - Turn off Multi user mode.

◆ SetTempDirectory()

void xb::xbSsv::SetTempDirectory ( const xbString sTempDirectory)
inherited

Set the temp directory.

Parameters
sTempDirectorySet the data direcroty.

◆ WriteLogBytes()

xbInt16 xb::xbXBase::WriteLogBytes ( xbUInt32  lCnt,
const char *  p 
)

◆ WriteLogMessage()

xbInt16 xb::xbXBase::WriteLogMessage ( const xbString sLogMessage,
xbInt16  iOutputOpt = 0 
)

◆ xbMemcmp()

xbInt16 xb::xbXBase::xbMemcmp ( const unsigned char *  s1,
const unsigned char *  s2,
size_t  n 
)
staticprotected

Cross memcmp function.

Parameters
s1Left operand to compare.
s2Right operand to compare.
nNumber of bytes to compare.
Returns
1 s1 > s2
0 s1 == s2
-1 s1 < s2

◆ xbSleep()

void xb::xbXBase::xbSleep ( xbInt32  lMillisecs)

Cross platform sleep function.

Parameters
lMillisecsMilliseconds to sleep.

Friends And Related Function Documentation

◆ xbBcd

friend class xbBcd
friend

◆ xbExp

friend class xbExp
friend

Field Documentation

◆ ErrorCodeText

const char* xb::xbSsv::ErrorCodeText[]
staticinherited

◆ iEndianType

xbInt16 xb::xbSsv::iEndianType = 0
staticprotectedinherited

◆ sNullString

xbString xb::xbSsv::sNullString = ""
staticprotectedinherited

The documentation for this class was generated from the following files: