10 #include "model/Entity.h"
21 this->parent = (
Entity*)parent;
22 this->deleteChildren =
true;
31 QMutexLocker lo(&lockParent);
32 this->parent = (
Entity*)parent;
33 this->deleteChildren =
true;
43 QMutexLocker lo(&lockParent);
44 this->parent = (
Entity*)parent;
45 this->deleteChildren =
true;
52 while(children.size())
54 Entity *child = children.at(0);
72 for ( QMap<QString,QString>::iterator it = newatts.begin();
73 it != newatts.end(); ++it)
75 this->atts[it.key()] = it.value();
93 this->parent = parent;
96 bool Entity::addChild(
Entity *entity)
98 QMutexLocker locker(&lockChildren);
99 QString _id = entity->getUniqueId();
102 for(
int i = 0; i < children.size(); i++)
104 if(children.at(i)->getUniqueId() == _id )
107 children.push_back(entity);
117 for(
int i = 0; i < children.size(); i++)
119 if(children.at(i) == entity)
132 QMutexLocker locker(&lockAtts);
133 return atts.contains(name) ? atts[name] :
"";
137 QMap<QString,QString>::iterator &end)
140 begin = this->atts.begin();
141 end = this->atts.end();
147 return this->atts.contains(name);
150 QString Entity::getUniqueId()
155 QString Entity::getType()
161 Entity* Entity::getParent()
167 QString Entity::getParentUniqueId()
170 return parent->getUniqueId();
175 this->deleteChildren = _delete;
178 QVector <Entity *> Entity::getChildren()
180 return this->children;
187 for(
int i= 0; i < children.size(); i++)
189 Entity *child = children.at(i);
203 for (
int i = 0; i < children.size(); i++)
205 Entity *child = children.at(i);
213 for(
int i = 0; i < ntab; i++)
217 out.append(getType().toAscii());
218 foreach(QString attr, atts.keys()){
222 out += atts.value(attr);
227 out +=
" uniqueEntityId=\"";
228 out += getUniqueId();
233 for (
int i = 0; i < children.size(); i++)
235 Entity *child = children.at(i);
236 out += child->
toString(ntab+1, writeuid);
238 for(
int i = 0; i < ntab; i++)
254 return new Entity(getUniqueId(), getType(), this->atts);