blob: 96795c592ec4bfad337b4789f48c135442b43206 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
#include <QvInput.h>
#include <QvReadError.h>
#include <QvFieldData.h>
#include <QvChildList.h>
#include <QvGroup.h>
QV_NODE_SOURCE(QvGroup);
QvGroup::QvGroup()
{
children = new QvChildList();
QV_NODE_CONSTRUCTOR(QvGroup);
isBuiltIn = TRUE;
}
QvGroup::~QvGroup()
{
delete children;
}
QvNode *
QvGroup::getChild(int index) const
{
return(*children)[index];
}
int
QvGroup::getNumChildren() const
{
return children->getLength();
}
QvChildList *
QvGroup::getChildren() const
{
return children;
}
QvBool
QvGroup::readInstance(QvInput *in)
{
QvName typeString;
QvFieldData *fieldData = getFieldData();
if (! isBuiltIn) {
if (in->read(typeString, TRUE)) {
if (typeString == "fields") {
if (! fieldData->readFieldTypes(in, this)) {
QvReadError::post(in, "Bad field specifications for node");
return FALSE;
}
}
else
in->putBack(typeString.getString());
}
}
return (fieldData->read(in, this, FALSE) && readChildren(in));
}
QvBool
QvGroup::readChildren(QvInput *in)
{
QvNode *child;
QvBool ret = TRUE;
while (TRUE) {
if (read(in, child)) {
if (child != NULL)
children->append(child);
else
break;
}
else {
ret = FALSE;
break;
}
}
return ret;
}
|