filters

dbase.h
1/* This file is part of the KDE project
2 Copyright (C) 2002 by Thomas Franke and Andreas Pietzowski <andreas@pietzowski.de>
3 Ariya Hidayat <ariyahidayat@yahoo.de>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19*/
20
21#ifndef DBASE_H
22#define DBASE_H
23
24#include <tqdatastream.h>
25#include <tqdatetime.h>
26#include <tqfile.h>
27#include <tqstring.h>
28#include <tqstringlist.h>
29
30class DBaseField
31{
32 public:
33 TQString name;
34 enum { Unknown, Character, Date, Numeric, Logical, Memo } type;
35 unsigned length;
36 unsigned decimals;
37};
38
39class DBase
40{
41
42 public:
43 DBase();
44 ~DBase();
45
46 TQPtrList<DBaseField> fields;
47
48 bool load( const TQString& filename );
49 TQStringList readRecord( unsigned recno );
50 void close();
51
52 unsigned recordCount(){ return m_recordCount; }
53 int version(){ return m_version; }
54 TQDate lastUpdate(){ return m_lastUpdate; }
55
56 private:
57
58 TQFile m_file;
59 TQDataStream m_stream;
60 int m_version;
61 TQDate m_lastUpdate;
62 unsigned m_recordCount;
63 unsigned m_headerLength;
64 unsigned m_recordLength;
65};
66
67#endif