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

Method Restore

src/App/PropertyFile.cpp:397–428  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

395}
396
397void PropertyFileIncluded::Restore(Base::XMLReader& reader)
398{
399 reader.readElement("FileIncluded");
400 if (reader.hasAttribute("file")) {
401 string file(reader.getAttribute<const char*>("file"));
402 if (!file.empty()) {
403 // initiate a file read
404 reader.addFile(file.c_str(), this);
405 // is in the document transient path
406 aboutToSetValue();
407 _cValue = getDocTransientPath() + "/" + file;
408 _BaseFileName = file;
409 hasSetValue();
410 }
411 }
412 // section is XML stream
413 else if (reader.hasAttribute("data")) {
414 string file(reader.getAttribute<const char*>("data"));
415 if (!file.empty()) {
416 // is in the document transient path
417 aboutToSetValue();
418 _cValue = getDocTransientPath() + "/" + file;
419 reader.readBinFile(_cValue.c_str());
420 reader.readEndElement("FileIncluded");
421 _BaseFileName = file;
422 // set read-only after restoring the file
423 Base::FileInfo fi(_cValue.c_str());
424 fi.setPermissions(Base::FileInfo::ReadOnly);
425 hasSetValue();
426 }
427 }
428}
429
430void PropertyFileIncluded::SaveDocFile(Base::Writer& writer) const
431{

Callers

nothing calls this directly

Calls 8

readElementMethod · 0.80
hasAttributeMethod · 0.80
readBinFileMethod · 0.80
readEndElementMethod · 0.80
setPermissionsMethod · 0.80
emptyMethod · 0.45
addFileMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected