filters

dbase.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2002 by Thomas Franke and Andreas Pietzowski <andreas@pietzowski.de>
00003                          Ariya Hidayat <ariyahidayat@yahoo.de>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #ifndef DBASE_H
00022 #define DBASE_H
00023 
00024 #include <qdatastream.h>
00025 #include <qdatetime.h>
00026 #include <qfile.h>
00027 #include <qstring.h>
00028 #include <qstringlist.h>
00029 
00030 class DBaseField
00031 {
00032   public:
00033     QString name;
00034     enum { Unknown, Character, Date, Numeric, Logical, Memo } type; 
00035     unsigned length;
00036     unsigned decimals;
00037 };
00038 
00039 class DBase
00040 {
00041 
00042   public:
00043     DBase();
00044     ~DBase();
00045 
00046     QPtrList<DBaseField> fields;
00047 
00048     bool load( const QString& filename );
00049     QStringList readRecord( unsigned recno );
00050     void close();
00051 
00052     unsigned recordCount(){ return m_recordCount; }
00053     int version(){ return m_version; } 
00054     QDate lastUpdate(){ return m_lastUpdate; }
00055 
00056   private:
00057 
00058     QFile m_file;
00059     QDataStream m_stream;
00060     int m_version;
00061     QDate m_lastUpdate;
00062     unsigned m_recordCount;
00063     unsigned m_headerLength;
00064     unsigned m_recordLength;
00065 };
00066 
00067 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys