VOResource.cpp 5.02 KB
Newer Older
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
/*************************************************************************
 *   Copyright (C) 2007 by Oliver Bock                                   *
 *   bock@tfh-berlin.de                                                  *
 *                                                                       *
 *   This file is part of Fidelity.                                      *
 *                                                                       *
 *   Fidelity is free software: you can redistribute it and/or modify    *
 *   it under the terms of the GNU General Public License as published   *
 *   by the Free Software Foundation, version 3 of the License.          *
 *                                                                       *
 *   Fidelity is distributed in the hope that it will be useful,         *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of      *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the        *
 *   GNU General Public License for more details.                        *
 *                                                                       *
 *   You should have received a copy of the GNU General Public License   *
 *   along with Fidelity. If not, see <http://www.gnu.org/licenses/>.    *
 *                                                                       *
 *************************************************************************/

#include "VOResource.h"

Fidelity::Common::VOResource::VOResource()
{
	initAttributes();
}

Fidelity::Common::VOResource::~VOResource()
{
	delete m_InfoList;
	delete m_CooSysList;
	delete m_ParamList;
	delete m_LinkList;
	delete m_TableList;
35
	delete m_ResourceList;
36
37
38
39
40
41
42
43
44
}

void Fidelity::Common::VOResource::initAttributes()
{
	m_InfoList = new QList<VOInfo*>();
	m_CooSysList = new QList<VOCooSys*>();
	m_ParamList = new QList<VOParam*>();
	m_LinkList = new QList<VOLink*>();
	m_TableList = new QList<VOTable*>();
45
	m_ResourceList = new QList<VOResource*>();
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
}


bool Fidelity::Common::VOResource::buildXml(QDomElement* parent)
{
	parent->setTagName("RESOURCE");

	QDomDocument doc = parent->ownerDocument();

	if (!m_ID.isEmpty()) {
		parent->setAttribute("ID", m_ID);
	}

	if (!m_Name.isEmpty()) {
		parent->setAttribute("name", m_Name);
	}

	if (!m_Type.isEmpty()) {
		parent->setAttribute("type", m_Type);
	}

	if (!m_UType.isEmpty()) {
		parent->setAttribute("utype", m_UType);
	}

	if (!m_Description.isEmpty()) {
		QDomElement tag = doc.createElement("DESCRIPTION");
		parent->appendChild(tag);
		QDomText text = doc.createTextNode(m_Description);
		tag.appendChild(text);
	}

	if (!m_CooSysList->isEmpty()) {
		for (int i = 0;i < m_CooSysList->size();i++) {
			QDomElement tag = doc.createElement("COOSYS");
			if(m_CooSysList->at(i)->buildXml(&tag) == false) {
				return(false);
			}
			parent->appendChild(tag);
		}
	}

	if (!m_ParamList->isEmpty()) {
		for (int i = 0;i < m_ParamList->size();i++) {
			QDomElement tag = doc.createElement("PARAM");
			if(m_ParamList->at(i)->buildXml(&tag) == false) {
				return(false);
			}
			parent->appendChild(tag);
		}
	}

	if (!m_LinkList->isEmpty()) {
		for (int i = 0;i < m_LinkList->size();i++) {
			QDomElement tag = doc.createElement("LINK");
			if(m_LinkList->at(i)->buildXml(&tag) == false) {
				return(false);
			}
			parent->appendChild(tag);
		}
	}

	if (!m_TableList->isEmpty()) {
		for (int i = 0;i < m_TableList->size();i++) {
			QDomElement tag = doc.createElement("TABLE");
			if(m_TableList->at(i)->buildXml(&tag) == false) {
				return(false);
			}
			parent->appendChild(tag);
		}
	}
117
118
119
120
121
122
123
124
125
126

	if (!m_ResourceList->isEmpty()) {
		for (int i = 0;i < m_ResourceList->size();i++) {
			QDomElement tag = doc.createElement("RESOURCE");
			if(m_ResourceList->at(i)->buildXml(&tag) == false) {
				return(false);
			}
			parent->appendChild(tag);
		}
	}
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205

	return(true);
}


void Fidelity::Common::VOResource::setID(QString new_var)
{
	m_ID = new_var;
}

QString Fidelity::Common::VOResource::ID()
{
	return m_ID;
}

void Fidelity::Common::VOResource::setName(QString new_var)
{
	m_Name = new_var;
}

QString Fidelity::Common::VOResource::Name()
{
	return m_Name;
}

void Fidelity::Common::VOResource::setType(QString new_var)
{
	m_Type = new_var;
}

QString Fidelity::Common::VOResource::Type()
{
	return m_Type;
}

void Fidelity::Common::VOResource::setUType(QString new_var)
{
	m_UType = new_var;
}

QString Fidelity::Common::VOResource::UType()
{
	return m_UType;
}

void Fidelity::Common::VOResource::setDescription(QString new_var)
{
	m_Description = new_var;
}

QString Fidelity::Common::VOResource::Description()
{
	return m_Description;
}

QList<VOInfo*>* Fidelity::Common::VOResource::InfoList()
{
	return m_InfoList;
}

QList<VOCooSys*>* Fidelity::Common::VOResource::CooSysList()
{
	return m_CooSysList;
}

QList<VOParam*>* Fidelity::Common::VOResource::ParamList()
{
	return m_ParamList;
}

QList<VOLink*>* Fidelity::Common::VOResource::LinkList()
{
	return m_LinkList;
}

QList<VOTable*>* Fidelity::Common::VOResource::TableList()
{
	return m_TableList;
}
206
207
208
209
210

QList<VOResource*>* Fidelity::Common::VOResource::ResourceList()
{
	return m_ResourceList;
}