Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

tabledef.h

Go to the documentation of this file.
00001 /*
00002                              This file is part of the OPIE Project
00003                =.
00004              .=l.            Copyright (c)  2002 Dan Williams <drw@handhelds.org>
00005            .>+-=
00006  _;:,     .>    :=|.         This file is free software; you can
00007 .> <`_,   >  .   <=          redistribute it and/or modify it under
00008 :`=1 )Y*s>-.--   :           the terms of the GNU General Public
00009 .="- .-=="i,     .._         License as published by the Free Software
00010  - .   .-<_>     .<>         Foundation; either version 2 of the License,
00011      ._= =}       :          or (at your option) any later version.
00012     .%`+i>       _;_.
00013     .i_,=:_.      -<s.       This file is distributed in the hope that
00014      +  .  -:.       =       it will be useful, but WITHOUT ANY WARRANTY;
00015     : ..    .:,     . . .    without even the implied warranty of
00016     =_        +     =;=|`    MERCHANTABILITY or FITNESS FOR A
00017   _.=:.       :    :=>`:     PARTICULAR PURPOSE. See the GNU General
00018 ..}^=.=       =       ;      Public License for more details.
00019 ++=   -.     .`     .:
00020  :     =  ...= . :.=-        You should have received a copy of the GNU
00021  -.   .:....=;==+<;          General Public License along with this file;
00022   -_. . .   )=.  =           see the file COPYING. If not, write to the
00023     --        :-=`           Free Software Foundation, Inc.,
00024                              59 Temple Place - Suite 330,
00025                              Boston, MA 02111-1307, USA.
00026 
00027 */
00028 
00029 #ifndef TABLEDEF_H
00030 #define TABLEDEF_H
00031 
00032 #include <qstring.h>
00033 #include <qstringlist.h>
00034 #include <qlist.h>
00035 
00036 
00037 
00038 // --- ColumnDef -------------------------------------------------------------
00039 class ColumnDef
00040 {
00041     public:
00042         enum ColumnType {
00043             typeString=0x1,
00044             typeList=0x2,
00045             typeUnique=0x80000000
00046         };
00047 
00048         // Constructor
00049         ColumnDef(const char *sName, ColumnType type, const char *sNewValue);
00050 
00051         // add column value
00052         void addColumnValue(const QString &Value);
00053         void addColumnValue(const char *sValue);
00054 
00055         // member functions
00056         const QString getName() { return(_sName); }
00057         const QString getNewValue() { return(_sNewValue); }
00058 
00059         // test for type
00060         int isType(ColumnType x) { return( (_type & 0x00ffffff)==x ); }
00061         int hasFlag(ColumnType x) { return( (_type & x) ); }
00062 
00063         // get value list
00064         QStringList &getValueList() { return(_valueList); }
00065 
00066     private:
00067         QString _sName;
00068         QString _sNewValue;
00069         enum ColumnType _type;
00070         QStringList _valueList;
00071 };
00072 
00073 typedef QList<ColumnDef> ColumnDefList;
00074 
00075 
00076 // --- TableDef ---------------------------------------------------------------
00077 class TableDef
00078 {
00079     public:
00080         // Constructor & Destructor
00081         TableDef(const char *sName);
00082         virtual ~TableDef();
00083 
00084         // adds a column definition
00085         virtual void addColumnDef(ColumnDef *pDef);
00086 
00087         // movement operators
00088         ColumnDef *first() { return(_vColumns.first() ); }
00089         ColumnDef *last() { return(_vColumns.last() ); }
00090         ColumnDef *next() { return(_vColumns.next() ); }
00091         ColumnDef *prev() { return(_vColumns.prev() ); }
00092         ColumnDef *at(int i) { return(_vColumns.at(i)); }
00093 
00094     protected:
00095         QString _sName;
00096         ColumnDefList _vColumns;
00097 };
00098 
00099 #endif

Generated on Sat Nov 5 16:16:47 2005 for OPIE by  doxygen 1.4.2