| 428 | } |
| 429 | |
| 430 | void 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 | |
| 454 | void PropertyFileIncluded::RestoreDocFile(Base::Reader& reader) |
| 455 | { |