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

Method SaveDocFile

src/App/PropertyFile.cpp:430–452  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

428}
429
430void PropertyFileIncluded::SaveDocFile(Base::Writer& writer) const
431{
432 if (_cValue.empty()) {
433 Base::Console().warning("Empty filename in PropertyFileIncluded::SaveDocFile. "
434 "Nothing to do.\n");
435 return;
436 }
437
438 Base::ifstream from(Base::FileInfo(_cValue), std::ios::in | std::ios::binary);
439 if (!from) {
440 std::stringstream str;
441 str << "PropertyFileIncluded::SaveDocFile(): "
442 << "File '" << _cValue << "' in transient directory doesn't exist.";
443 throw Base::FileSystemError(str.str());
444 }
445
446 // copy plain data
447 unsigned char c;
448 std::ostream& to = writer.Stream();
449 while (from.get((char&)c)) {
450 to.put((char)c);
451 }
452}
453
454void PropertyFileIncluded::RestoreDocFile(Base::Reader& reader)
455{

Callers

nothing calls this directly

Calls 7

FileSystemErrorFunction · 0.85
FileInfoClass · 0.50
emptyMethod · 0.45
warningMethod · 0.45
strMethod · 0.45
getMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected