| 1 |
/* Copyright (C) 1992-1998 The Geometry Center |
| 2 |
* Copyright (C) 1998-2000 Stuart Levy, Tamara Munzner, Mark Phillips |
| 3 |
* |
| 4 |
* This file is part of Geomview. |
| 5 |
* |
| 6 |
* Geomview is free software; you can redistribute it and/or modify it |
| 7 |
* under the terms of the GNU Lesser General Public License as published |
| 8 |
* by the Free Software Foundation; either version 2, or (at your option) |
| 9 |
* any later version. |
| 10 |
* |
| 11 |
* Geomview is distributed in the hope that it will be useful, but |
| 12 |
* WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 |
* Lesser General Public License for more details. |
| 15 |
* |
| 16 |
* You should have received a copy of the GNU Lesser General Public |
| 17 |
* License along with Geomview; see the file COPYING. If not, write |
| 18 |
* to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, |
| 19 |
* USA, or visit http://www.gnu.org. |
| 20 |
*/ |
| 21 |
#ifndef _QV_FIELD_DATA_ |
| 22 |
#define _QV_FIELD_DATA_ |
| 23 |
|
| 24 |
#include <QvBasic.h> |
| 25 |
#include <QvPList.h> |
| 26 |
#include <QvString.h> |
| 27 |
|
| 28 |
class QvField; |
| 29 |
class QvInput; |
| 30 |
class QvNode; |
| 31 |
|
| 32 |
class QvFieldData { |
| 33 |
public: |
| 34 |
QvFieldData() {} |
| 35 |
~QvFieldData(); |
| 36 |
|
| 37 |
void addField(QvNode *defObject, const char *fieldName, |
| 38 |
const QvField *field); |
| 39 |
|
| 40 |
int getNumFields() const { return fields.getLength(); } |
| 41 |
|
| 42 |
const QvName & getFieldName(int index) const; |
| 43 |
|
| 44 |
QvField * getField(const QvNode *object, |
| 45 |
int index) const; |
| 46 |
|
| 47 |
void addEnumValue(const char *typeName, |
| 48 |
const char *valName, int val); |
| 49 |
void getEnumData(const char *typeName, int &num, |
| 50 |
const int *&vals, const QvName *&names); |
| 51 |
|
| 52 |
QvBool read(QvInput *in, QvNode *object, |
| 53 |
QvBool errorOnUnknownField = TRUE) const; |
| 54 |
|
| 55 |
QvBool read(QvInput *in, QvNode *object, |
| 56 |
const QvName &fieldName, |
| 57 |
QvBool &foundName) const; |
| 58 |
|
| 59 |
QvBool readFieldTypes(QvInput *in, QvNode *object); |
| 60 |
|
| 61 |
private: |
| 62 |
QvPList fields; |
| 63 |
QvPList enums; |
| 64 |
}; |
| 65 |
|
| 66 |
#endif /* _QV_FIELD_DATA_ */ |