MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / Restore

Method Restore

src/Mod/TechDraw/App/PropertyGeomFormatList.cpp:157–194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

155}
156
157void PropertyGeomFormatList::Restore(Base::XMLReader &reader)
158{
159 // read my element
160 reader.clearPartialRestoreObject();
161 reader.readElement("GeomFormatList");
162 // get the value of my attribute
163 int count = reader.getAttribute<long>("count");
164 std::vector<GeomFormat*> values;
165 values.reserve(count);
166 for (int i = 0; i < count; i++) {
167 reader.readElement("GeomFormat");
168 const char* TypeName = reader.getAttribute<const char*>("type");
169 GeomFormat *newG = static_cast<GeomFormat *>(Base::Type::fromName(TypeName).createInstance());
170 newG->Restore(reader);
171
172 if(reader.testStatus(Base::XMLReader::ReaderStatus::PartialRestoreInObject)) {
173 Base::Console().error("GeomFormat \"%s\" within a PropertyGeomFormatList was subject to a partial restore.\n", reader.localName());
174 if(isOrderRelevant()) {
175 // Pushes the best try by the GeomFormat class
176 values.push_back(newG);
177 }
178 else {
179 delete newG;
180 }
181 reader.clearPartialRestoreObject();
182 }
183 else {
184 values.push_back(newG);
185 }
186
187 reader.readEndElement("GeomFormat");
188 }
189
190 reader.readEndElement("GeomFormatList");
191
192 // assignment
193 setValues(values);
194}
195
196App::Property *PropertyGeomFormatList::Copy() const
197{

Callers

nothing calls this directly

Calls 11

isOrderRelevantFunction · 0.85
setValuesFunction · 0.85
readElementMethod · 0.80
reserveMethod · 0.80
localNameMethod · 0.80
readEndElementMethod · 0.80
createInstanceMethod · 0.45
testStatusMethod · 0.45
errorMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected