Merge branch 'refs/heads/double-precision-werner'

Conflicts:
	src/App/Document.cpp
	src/App/PropertyGeo.cpp
	src/App/PropertyStandard.cpp
	src/Base/Reader.cpp
	src/Base/Reader.h
	src/Gui/propertyeditor/PropertyItem.cpp
	src/Mod/Fem/Gui/ViewProviderFemMesh.cpp
	src/Mod/Inspection/Gui/ViewProviderInspection.cpp
	src/Mod/Mesh/App/MeshProperties.cpp
	src/Mod/Part/App/TopoShapeFacePyImp.cpp
	src/Mod/PartDesign/App/FeatureRevolution.cpp
This commit is contained in:
jriegel
2013-09-26 00:05:05 +02:00
69 changed files with 1116 additions and 415 deletions

View File

@@ -65,6 +65,6 @@ void Persistence::SaveDocFile (Writer &/*writer*/) const
{
}
void Persistence::RestoreDocFile(Reader &/*reader*/, const int DocumentSchema)
void Persistence::RestoreDocFile(Reader &/*reader*/)
{
}

View File

@@ -33,7 +33,7 @@
namespace Base
{
typedef std::istream Reader;
class Reader;
class Writer;
class XMLReader;
@@ -145,7 +145,7 @@ public:
* \endcode
* @see Base::Reader,Base::XMLReader
*/
virtual void RestoreDocFile(Reader &/*reader*/, const int DocumentSchema);
virtual void RestoreDocFile(Reader &/*reader*/);
};
} //namespace Base

View File

@@ -60,7 +60,7 @@ using namespace std;
// ---------------------------------------------------------------------------
Base::XMLReader::XMLReader(const char* FileName, std::istream& str)
: DocumentSchema(0), Level(0), _File(FileName)
: DocumentSchema(0), ProgramVersion(""), FileVersion(0), Level(0), _File(FileName)
{
#ifdef _MSC_VER
str.imbue(std::locale::empty());
@@ -304,7 +304,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 {
jt->Object->RestoreDocFile(zipstream, DocumentSchema);
jt->Object->RestoreDocFile(Base::Reader(zipstream,DocumentSchema));
}
catch(...) {
// For any exception we just continue with the next file.
@@ -472,3 +472,21 @@ void Base::XMLReader::warning(const XERCES_CPP_NAMESPACE_QUALIFIER SAXParseExcep
void Base::XMLReader::resetErrors()
{
}
// ----------------------------------------------------------
Base::Reader::Reader(std::istream& str, int version)
: std::istream(str.rdbuf()), _str(str), fileVersion(version)
{
}
int Base::Reader::getFileVersion() const
{
return fileVersion;
}
std::istream& Base::Reader::getStream()
{
return this->_str;
}

View File

@@ -167,6 +167,8 @@ public:
int DocumentSchema;
/// Version of FreeCAD that wrote this document
std::string ProgramVersion;
/// Version of the file format
int FileVersion;
protected:
/// read the next element
@@ -230,6 +232,18 @@ protected:
std::vector<std::string> FileNames;
};
class BaseExport Reader : public std::istream
{
public:
Reader(std::istream&, int version);
int getFileVersion() const;
std::istream& getStream();
private:
std::istream& _str;
int fileVersion;
};
}

View File

@@ -49,7 +49,7 @@ using namespace zipios;
// ---------------------------------------------------------------------------
Writer::Writer(void)
: indent(0),forceXML(false)
: indent(0),forceXML(false),fileVersion(1)
{
indBuf[0] = '\0';
}
@@ -98,6 +98,16 @@ bool Writer::isForceXML(void)
return forceXML;
}
void Writer::setFileVersion(int v)
{
fileVersion = v;
}
int Writer::getFileVersion() const
{
return fileVersion;
}
std::string Writer::addFile(const char* Name,const Base::Persistence *Object)
{
// always check isForceXML() before requesting a file!

View File

@@ -62,6 +62,8 @@ public:
void setForceXML(bool on);
/// check on state
bool isForceXML(void);
void setFileVersion(int);
int getFileVersion() const;
/// insert a file as CDATA section in the XML file
void insertAsciiFile(const char* FileName);
@@ -106,6 +108,7 @@ protected:
char indBuf[256];
bool forceXML;
int fileVersion;
};