| 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_SUB_NODE_ |
| 22 |
#define _QV_SUB_NODE_ |
| 23 |
|
| 24 |
#include <QvFieldData.h> |
| 25 |
#include <QvNode.h> |
| 26 |
|
| 27 |
#define QV_NODE_HEADER(className) \ |
| 28 |
public: \ |
| 29 |
className(); \ |
| 30 |
virtual ~className(); \ |
| 31 |
virtual void traverse(QvState *state); \ |
| 32 |
virtual void ToWebOOGL(QvState *state); \ |
| 33 |
private: \ |
| 34 |
static QvBool firstInstance; \ |
| 35 |
static QvFieldData *fieldData; \ |
| 36 |
virtual QvFieldData *getFieldData() { return fieldData; } |
| 37 |
|
| 38 |
#define QV_NODE_SOURCE(className) \ |
| 39 |
QvFieldData *className::fieldData; \ |
| 40 |
QvBool className::firstInstance = TRUE; |
| 41 |
|
| 42 |
#define QV_NODE_CONSTRUCTOR(className) \ |
| 43 |
if (fieldData == NULL) \ |
| 44 |
fieldData = new QvFieldData; \ |
| 45 |
else \ |
| 46 |
firstInstance = FALSE; \ |
| 47 |
isBuiltIn = FALSE; \ |
| 48 |
|
| 49 |
#define QV_NODE_IS_FIRST_INSTANCE() (firstInstance == TRUE) |
| 50 |
|
| 51 |
#define QV_NODE_ADD_FIELD(fieldName) \ |
| 52 |
if (firstInstance) \ |
| 53 |
fieldData->addField(this, QV__QUOTE(fieldName), &this->fieldName); \ |
| 54 |
this->fieldName.setContainer(this); |
| 55 |
|
| 56 |
#define QV_NODE_DEFINE_ENUM_VALUE(enumType,enumValue) \ |
| 57 |
if (firstInstance) \ |
| 58 |
fieldData->addEnumValue(QV__QUOTE(enumType), \ |
| 59 |
QV__QUOTE(enumValue), enumValue) |
| 60 |
|
| 61 |
#endif /* _QV_SUB_NODE_ */ |
| 62 |
|