/usr/include/vdkxdb2/vdkxtable.h is in libvdkxdb2-dev 2.4.0-3.3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | /*
* ===========================
* VDK Visual Development Kit
* xdb subsystem
* Version 0.1
* Revision 0.0
* April 2000
* ===========================
*
* Copyright (C) 1998, Mario Motta
* Developed by Mario Motta <mmotta@guest.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library 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.
*/
#ifndef _vdkxdbtable_h
#define _vdkxdbtable_h
#include <vdk/vdkstring.h>
#include <vdk/vdkprops.h>
#include <vdk/dlist.h>
#include <xbase/dbf.h>
#include <xbase/ndx.h>
// see into xdb/xdb/dbf.h
typedef xbSchema VDKXRecordTemplate ;
class VDKXDatabase;
class VDKXTableIndex;
typedef VDKList<VDKXTableIndex> IndexList;
typedef VDKListIterator<VDKXTableIndex> IndexListIterator;
/*!
\class VDKXTable
\brief Provides a xbDbf wrapper
Since it is a derived class of xbDbf, most behaviours are inherited.
Refer to xdb reference for further informations.
*/
class VDKXTable: public xbDbf
{
protected:
//! table name
VDKString name;
//! indexes list
IndexList iList;
void SetOrder(xbShort ndx);
bool open;
VDKXTableIndex* activeIndex;
public:
/*
table properties
*/
//! table size in records
VDKReadOnlyValueProp<VDKXTable,xbLong> Size;
/*!
sets/gets active index ordinal position.
Setting Order to -1 no active index will be used.
*/
VDKReadWriteValueProp<VDKXTable,xbShort> Order;
/*!
sets/gets active index
Setting Order to NULL no active index will be used.
\param name index file name
*/
void SetOrder(char* name);
/*!
If false all record marked for deletion
will be ignored on common table operations.
*/
VDKReadWriteValueProp<VDKXTable,bool> ShowDeleted;
//---------------------------------------------
/*
Internal use only (mainly for builder)
User don't care.
*/
VDKReadWriteValueProp<VDKXTable,bool> Active;
//---------------------------------------------
/*!
Constructor
\param owner owner xdb
\param name table name can be either with or without .dbf extension
*/
VDKXTable(VDKXDatabase* owner, char* name);
//! Destructor
virtual ~VDKXTable();
//! Returns table name
VDKString Name() { return name; }
/*!
Creates a table
\param tpl a VDKXRecordTemplate
\param overwrite if true and table exist will be truncated and
overwritten.
Returns:
\arg XB_NO_ERROR no errors
\arg XB_FILE_EXISTS file exist and overwrite flag = false
\arg XB_OPEN_ERROR couldn't open file
\arg XB_NO_MEMORY mem allocation error
\arg XB_WRITE_ERROR couldn't write on device
*/
xbShort Create(VDKXRecordTemplate* tpl, bool overwrite = false);
/*!
Opens table.
Returns:
\arg XB_NO_ERROR no errors
\arg XB_OPEN_ERROR couldn't open file
\arg XB_NO_MEMORY mem allocation error
\arg XB_WRITE_ERROR couldn't write on device
\arg XB_NOT_XBASE not an xdb file type
*/
xbShort Open(void);
/*!
Close table and all associated indexes.
Returns:
\arg XB_NO_ERROR no errors
\arg XB_NOT_OPEN file wasn't opened
*/
xbShort Close(void);
/*!
Removes an index from table
\param name index name.
Returns true on success
*/
bool RemoveIndex(char* name);
/*!
Returns an index given a name
\param name index name
Returns (VDKXTableIndex*) NULL on failure
*/
VDKXTableIndex* Index(char* name);
/*!
Returns an index given an ordinal position
\param order index ordinal position
Returns (VDKXTableIndex*) NULL on failure
*/
VDKXTableIndex* Index(xbShort order);
/*!
Moves database pointer to first logical record.
If there is no active index moves on first phisical record
If ShowDeleted property is fale (default)moves to
first logical/phisical undeleted record.
Returns:
\arg XB_NO_ERROR no errors
\arg XB_INVALID_RECORD invalid record number
\arg XB_LOCK_FAILED couldn't lock file
\arg XB_NOT_OPEN file not open
\arg XB_SEEK_ERROR seek routine error
\arg XB_WRITE_ERROR couldn't write
*/
xbShort First();
/*!
Moves database pointer to last logical record
If there is no active index moves on last phisical record
If ShowDeleted property is fale (default)moves to
last logical/phisical undeleted record.
Returns:
\arg XB_NO_ERROR no errors
\arg XB_INVALID_RECORD invalid record number
\arg XB_LOCK_FAILED couldn't lock file
\arg XB_NOT_OPEN file not open
\arg XB_SEEK_ERROR seek routine error
\arg XB_WRITE_ERROR couldn't write
*/
xbShort Last();
/*!
Moves database pointer to next logical record
If there is no active index moves on next phisical record
If ShowDeleted property is fale (default)moves to
next logical/phisical undeleted record.
Returns:
\arg XB_NO_ERROR no errors
\arg XB_INVALID_RECORD invalid record number
\arg XB_LOCK_FAILED couldn't lock file
\arg XB_NOT_OPEN file not open
\arg XB_SEEK_ERROR seek routine error
\arg XB_WRITE_ERROR couldn't write
*/
xbShort Next();
/*!
Moves database pointer to previous logical record
If there is no active index moves on previous phisical record
If ShowDeleted property is fale (default)moves to
previous logical/phisical undeleted record.
Returns:
\arg XB_NO_ERROR no errors
\arg XB_INVALID_RECORD invalid record number
\arg XB_LOCK_FAILED couldn't lock file
\arg XB_NOT_OPEN file not open
\arg XB_SEEK_ERROR seek routine error
\arg XB_WRITE_ERROR couldn't write
*/
xbShort Prev();
//! /internal
IndexList* NdxList() { return &iList; }
//! return if table is open or not
bool IsOpen() { return open; }
};
/*!
\class VDKXTableIndex
\brief Provides a table index
*/
class VDKXTableIndex: public xbNdx
{
protected:
VDKString name,key;
VDKXTable* table;
bool open;
public:
/*!
Constructor
\param owner VDKXtable that owns index
\param s index file name
*/
VDKXTableIndex(VDKXTable* owner, char* s);
//! Destructor
virtual ~VDKXTableIndex();
/*!
Creates an index
\param k index key (can be an expression as well)
\param unique if true allows duplicated keys
\param overwrite if true and table exist will be truncated and
overwritten.
Returns:
\arg XB_NO_ERROR no errors
\arg XB_OPEN_ERROR couldn't open file
\arg XB_NO_MEMORY mem allocation error
\arg XB_READ_ERROR couldn't read on device
\arg XB_INVALID_KEY_EXPRESSION bad index key expression
\arg XB_SEEK_ERROR seek error encountered
\arg XB_NOT_OPEN database wasn't opened
*/
xbShort Create(char* key,
bool unique = true ,
bool overwrite = false
);
//! Open index
xbShort Open(void);
/*!
Close index.
\arg Programming note:
Isn't necessary to explicitely close an index, closing the table
will close all associated indexes as well.
*/
xbShort Close(void);
//! return index name
VDKString Name() { return name; }
//! return index key
VDKString Key() { return key; }
//! return if index is open or not
bool IsOpen() { return open; }
};
#endif
|