File indexing completed on 2025-01-12 13:05:38
0001 /* This file is part of the KDE project 0002 Copyright (C) 2002 by Thomas Franke and Andreas Pietzowski <andreas@pietzowski.de> 0003 Ariya Hidayat <ariyahidayat@yahoo.de> 0004 0005 This library is free software; you can redistribute it and/or 0006 modify it under the terms of the GNU Library General Public 0007 License as published by the Free Software Foundation; either 0008 version 2 of the License, or (at your option) any later version. 0009 0010 This library is distributed in the hope that it will be useful, 0011 but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0013 Library General Public License for more details. 0014 0015 You should have received a copy of the GNU Library General Public License 0016 along with this library; see the file COPYING.LIB. If not, write to 0017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0018 * Boston, MA 02110-1301, USA. 0019 */ 0020 0021 #ifndef DBASE_H 0022 #define DBASE_H 0023 0024 #include <QDataStream> 0025 #include <QDateTime> 0026 #include <QFile> 0027 #include <QString> 0028 #include <QStringList> 0029 #include <QList> 0030 0031 class DBaseField 0032 { 0033 public: 0034 QString name; 0035 enum { Unknown, Character, Date, Numeric, Logical, Memo } type; 0036 unsigned length; 0037 unsigned decimals; 0038 }; 0039 0040 class DBase 0041 { 0042 0043 public: 0044 DBase(); 0045 ~DBase(); 0046 0047 QList<DBaseField*> fields; 0048 0049 bool load(const QString& filename); 0050 QStringList readRecord(unsigned recno); 0051 void close(); 0052 0053 unsigned recordCount() { 0054 return m_recordCount; 0055 } 0056 int version() { 0057 return m_version; 0058 } 0059 QDate lastUpdate() { 0060 return m_lastUpdate; 0061 } 0062 0063 private: 0064 0065 QFile m_file; 0066 QDataStream m_stream; 0067 int m_version; 0068 QDate m_lastUpdate; 0069 unsigned m_recordCount; 0070 unsigned m_headerLength; 0071 unsigned m_recordLength; 0072 }; 0073 0074 #endif