Diffstat (limited to 'noncore/apps/checkbook/tabledef.h') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/checkbook/tabledef.h | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/noncore/apps/checkbook/tabledef.h b/noncore/apps/checkbook/tabledef.h new file mode 100644 index 0000000..5891ad7 --- a/dev/null +++ b/noncore/apps/checkbook/tabledef.h | |||
@@ -0,0 +1,99 @@ | |||
1 | /* | ||
2 | This file is part of the OPIE Project | ||
3 | =. | ||
4 | .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org> | ||
5 | .>+-= | ||
6 | _;:, .> :=|. This file is free software; you can | ||
7 | .> <`_, > . <= redistribute it and/or modify it under | ||
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
9 | .="- .-=="i, .._ License as published by the Free Software | ||
10 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
11 | ._= =} : or (at your option) any later version. | ||
12 | .%`+i> _;_. | ||
13 | .i_,=:_. -<s. This file is distributed in the hope that | ||
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
15 | : .. .:, . . . without even the implied warranty of | ||
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
18 | ..}^=.= = ; Public License for more details. | ||
19 | ++= -. .` .: | ||
20 | : = ...= . :.=- You should have received a copy of the GNU | ||
21 | -. .:....=;==+<; General Public License along with this file; | ||
22 | -_. . . )=. = see the file COPYING. If not, write to the | ||
23 | -- :-=` Free Software Foundation, Inc., | ||
24 | 59 Temple Place - Suite 330, | ||
25 | Boston, MA 02111-1307, USA. | ||
26 | |||
27 | */ | ||
28 | |||
29 | #ifndef TABLEDEF_H | ||
30 | #define TABLEDEF_H | ||
31 | |||
32 | #include <qstring.h> | ||
33 | #include <qstringlist.h> | ||
34 | #include <qlist.h> | ||
35 | |||
36 | |||
37 | |||
38 | // --- ColumnDef ------------------------------------------------------------- | ||
39 | class ColumnDef | ||
40 | { | ||
41 | public: | ||
42 | enum ColumnType { | ||
43 | typeString=0x1, | ||
44 | typeList=0x2, | ||
45 | typeUnique=0x80000000 | ||
46 | }; | ||
47 | |||
48 | // Constructor | ||
49 | ColumnDef(const char *sName, ColumnType type, const char *sNewValue); | ||
50 | |||
51 | // add column value | ||
52 | void addColumnValue(const QString &Value); | ||
53 | void addColumnValue(const char *sValue); | ||
54 | |||
55 | // member functions | ||
56 | const QString getName() { return(_sName); } | ||
57 | const QString getNewValue() { return(_sNewValue); } | ||
58 | |||
59 | // test for type | ||
60 | int isType(ColumnType x) { return( (_type & 0x00ffffff)==x ); } | ||
61 | int hasFlag(ColumnType x) { return( (_type & x) ); } | ||
62 | |||
63 | // get value list | ||
64 | QStringList &getValueList() { return(_valueList); } | ||
65 | |||
66 | private: | ||
67 | QString _sName; | ||
68 | QString _sNewValue; | ||
69 | enum ColumnType _type; | ||
70 | QStringList _valueList; | ||
71 | }; | ||
72 | |||
73 | typedef QList<ColumnDef> ColumnDefList; | ||
74 | |||
75 | |||
76 | // --- TableDef --------------------------------------------------------------- | ||
77 | class TableDef | ||
78 | { | ||
79 | public: | ||
80 | // Constructor & Destructor | ||
81 | TableDef(const char *sName); | ||
82 | virtual ~TableDef(); | ||
83 | |||
84 | // adds a column definition | ||
85 | virtual void addColumnDef(ColumnDef *pDef); | ||
86 | |||
87 | // movement operators | ||
88 | ColumnDef *first() { return(_vColumns.first() ); } | ||
89 | ColumnDef *last() { return(_vColumns.last() ); } | ||
90 | ColumnDef *next() { return(_vColumns.next() ); } | ||
91 | ColumnDef *prev() { return(_vColumns.prev() ); } | ||
92 | ColumnDef *at(int i) { return(_vColumns.at(i)); } | ||
93 | |||
94 | protected: | ||
95 | QString _sName; | ||
96 | ColumnDefList _vColumns; | ||
97 | }; | ||
98 | |||
99 | #endif | ||