| 1 | /****************************************************************************
|
|---|
| 2 | ** varlist.h - class for handling a list of string vars
|
|---|
| 3 | ** Copyright (C) 2001, 2002 Justin Karneges
|
|---|
| 4 | **
|
|---|
| 5 | ** This program is free software; you can redistribute it and/or
|
|---|
| 6 | ** modify it under the terms of the GNU General Public License
|
|---|
| 7 | ** as published by the Free Software Foundation; either version 2
|
|---|
| 8 | ** of the License, or (at your option) any later version.
|
|---|
| 9 | **
|
|---|
| 10 | ** This program 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
|
|---|
| 13 | ** GNU General Public License for more details.
|
|---|
| 14 | **
|
|---|
| 15 | ** You should have received a copy of the GNU General Public License
|
|---|
| 16 | ** along with this program; if not, write to the Free Software
|
|---|
| 17 | ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
|---|
| 18 | **
|
|---|
| 19 | ****************************************************************************/
|
|---|
| 20 |
|
|---|
| 21 | #ifndef VARLIST_H
|
|---|
| 22 | #define VARLIST_H
|
|---|
| 23 |
|
|---|
| 24 | #include<qstring.h>
|
|---|
| 25 | #include<qstringlist.h>
|
|---|
| 26 | #include<qvaluelist.h>
|
|---|
| 27 | #include<qdom.h>
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 | class VarListItem
|
|---|
| 31 | {
|
|---|
| 32 | public:
|
|---|
| 33 | VarListItem() { }
|
|---|
| 34 |
|
|---|
| 35 | const QString & key() const { return v_key; }
|
|---|
| 36 | const QString & data() const { return v_data; }
|
|---|
| 37 |
|
|---|
| 38 | void setKey(const QString &s) { v_key = s; }
|
|---|
| 39 | void setData(const QString &s) { v_data = s; }
|
|---|
| 40 |
|
|---|
| 41 | private:
|
|---|
| 42 | QString v_key;
|
|---|
| 43 | QString v_data;
|
|---|
| 44 | };
|
|---|
| 45 |
|
|---|
| 46 | class VarList : public QValueList<VarListItem>
|
|---|
| 47 | {
|
|---|
| 48 | public:
|
|---|
| 49 | VarList();
|
|---|
| 50 |
|
|---|
| 51 | void set(const QString &, const QString &);
|
|---|
| 52 | void unset(const QString &);
|
|---|
| 53 | const QString & get(const QString &);
|
|---|
| 54 |
|
|---|
| 55 | VarList::Iterator findByKey(const QString &);
|
|---|
| 56 | VarList::Iterator findByNum(int);
|
|---|
| 57 |
|
|---|
| 58 | QStringList varsToStringList();
|
|---|
| 59 | QDomElement toXml(QDomDocument &doc, const QString &tagName);
|
|---|
| 60 | void fromXml(const QDomElement &);
|
|---|
| 61 | };
|
|---|
| 62 |
|
|---|
| 63 | #endif
|
|---|