+ save Brep in binary format for recovery files
This commit is contained in:
@@ -319,7 +319,7 @@ void Base::XMLReader::readFiles(zipios::ZipInputStream &zipstream) const
|
||||
// no file name for the current entry in the zip was registered.
|
||||
if (jt != FileList.end()) {
|
||||
try {
|
||||
Base::Reader reader(zipstream,DocumentSchema);
|
||||
Base::Reader reader(zipstream, jt->FileName, DocumentSchema);
|
||||
jt->Object->RestoreDocFile(reader);
|
||||
}
|
||||
catch(...) {
|
||||
@@ -506,11 +506,16 @@ void Base::XMLReader::resetErrors()
|
||||
|
||||
// ----------------------------------------------------------
|
||||
|
||||
Base::Reader::Reader(std::istream& str, int version)
|
||||
: std::istream(str.rdbuf()), _str(str), fileVersion(version)
|
||||
Base::Reader::Reader(std::istream& str, const std::string& name, int version)
|
||||
: std::istream(str.rdbuf()), _str(str), _name(name), fileVersion(version)
|
||||
{
|
||||
}
|
||||
|
||||
std::string Base::Reader::getFileName() const
|
||||
{
|
||||
return this->_name;
|
||||
}
|
||||
|
||||
int Base::Reader::getFileVersion() const
|
||||
{
|
||||
return fileVersion;
|
||||
|
||||
@@ -257,12 +257,14 @@ protected:
|
||||
class BaseExport Reader : public std::istream
|
||||
{
|
||||
public:
|
||||
Reader(std::istream&, int version);
|
||||
int getFileVersion() const;
|
||||
Reader(std::istream&, const std::string&, int version);
|
||||
std::istream& getStream();
|
||||
std::string getFileName() const;
|
||||
int getFileVersion() const;
|
||||
|
||||
private:
|
||||
std::istream& _str;
|
||||
std::string _name;
|
||||
int fileVersion;
|
||||
};
|
||||
|
||||
|
||||
@@ -108,6 +108,24 @@ int Writer::getFileVersion() const
|
||||
return fileVersion;
|
||||
}
|
||||
|
||||
void Writer::setMode(const std::string& mode)
|
||||
{
|
||||
Modes.insert(mode);
|
||||
}
|
||||
|
||||
bool Writer::getMode(const std::string& mode) const
|
||||
{
|
||||
std::set<std::string>::const_iterator it = Modes.find(mode);
|
||||
return (it != Modes.end());
|
||||
}
|
||||
|
||||
void Writer::clearMode(const std::string& mode)
|
||||
{
|
||||
std::set<std::string>::iterator it = Modes.find(mode);
|
||||
if (it != Modes.end())
|
||||
Modes.erase(it);
|
||||
}
|
||||
|
||||
std::string Writer::addFile(const char* Name,const Base::Persistence *Object)
|
||||
{
|
||||
// always check isForceXML() before requesting a file!
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#define BASE_WRITER_H
|
||||
|
||||
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
@@ -80,6 +81,12 @@ public:
|
||||
virtual void writeFiles(void)=0;
|
||||
/// get all registered file names
|
||||
const std::vector<std::string>& getFilenames() const;
|
||||
/// Set mode
|
||||
void setMode(const std::string& mode);
|
||||
/// Get mode
|
||||
bool getMode(const std::string& mode) const;
|
||||
/// Clear mode
|
||||
void clearMode(const std::string& mode);
|
||||
//@}
|
||||
|
||||
/** @name pretty formating for XML */
|
||||
@@ -105,6 +112,7 @@ protected:
|
||||
};
|
||||
std::vector<FileEntry> FileList;
|
||||
std::vector<std::string> FileNames;
|
||||
std::set<std::string> Modes;
|
||||
|
||||
short indent;
|
||||
char indBuf[1024];
|
||||
|
||||
Reference in New Issue
Block a user