diff --git a/src/App/DynamicProperty.cpp b/src/App/DynamicProperty.cpp index 5471d2c82d..e59e8a8b86 100644 --- a/src/App/DynamicProperty.cpp +++ b/src/App/DynamicProperty.cpp @@ -304,31 +304,6 @@ std::string DynamicProperty::getUniquePropertyName(const char *Name) const } } -std::string DynamicProperty::encodeAttribute(const std::string& str) const -{ - std::string tmp; - for (std::string::const_iterator it = str.begin(); it != str.end(); ++it) { - if (*it == '<') - tmp += "<"; - else if (*it == '"') - tmp += """; - else if (*it == '\'') - tmp += "'"; - else if (*it == '&') - tmp += "&"; - else if (*it == '>') - tmp += ">"; - else if (*it == '\r') - tmp += " "; - else if (*it == '\n') - tmp += " "; - else - tmp += *it; - } - - return tmp; -} - void DynamicProperty::Save (Base::Writer &writer) const { //extenions must be saved first, as they need to be read and initialised before properties (as diff --git a/src/App/DynamicProperty.h b/src/App/DynamicProperty.h index 52ec7013c6..94847d6cd8 100644 --- a/src/App/DynamicProperty.h +++ b/src/App/DynamicProperty.h @@ -118,8 +118,6 @@ public: //@} private: - /// Encodes an attribute upon saving. - std::string encodeAttribute(const std::string&) const; std::string getUniquePropertyName(const char *Name) const; private: diff --git a/src/App/Property.cpp b/src/App/Property.cpp index d495a4224a..2738527a9c 100644 --- a/src/App/Property.cpp +++ b/src/App/Property.cpp @@ -155,33 +155,6 @@ void Property::Paste(const Property& /*from*/) assert(0); } -std::string Property::encodeAttribute(const std::string& str) -{ - std::string tmp; - for (std::string::const_iterator it = str.begin(); it != str.end(); ++it) { - if (*it == '<') - tmp += "<"; - else if (*it == '\"') - tmp += """; - else if (*it == '\'') - tmp += "'"; - else if (*it == '&') - tmp += "&"; - else if (*it == '>') - tmp += ">"; - else if (*it == '\r') - tmp += " "; - else if (*it == '\n') - tmp += " "; - else if (*it == '\t') - tmp += " "; - else - tmp += *it; - } - - return tmp; -} - //************************************************************************** //************************************************************************** // PropertyLists diff --git a/src/App/Property.h b/src/App/Property.h index b8daf080d8..83727038f4 100644 --- a/src/App/Property.h +++ b/src/App/Property.h @@ -149,8 +149,6 @@ public: virtual Property *Copy(void) const = 0; /// Paste the value from the property (mainly for Undo/Redo and transactions) virtual void Paste(const Property &from) = 0; - /// Encodes an attribute upon saving. - static std::string encodeAttribute(const std::string&); friend class PropertyContainer; diff --git a/src/Base/Persistence.cpp b/src/Base/Persistence.cpp index 7054d6acb9..ed00e82e3e 100644 --- a/src/Base/Persistence.cpp +++ b/src/Base/Persistence.cpp @@ -68,3 +68,30 @@ void Persistence::SaveDocFile (Writer &/*writer*/) const void Persistence::RestoreDocFile(Reader &/*reader*/) { } + +std::string Persistence::encodeAttribute(const std::string& str) +{ + std::string tmp; + for (std::string::const_iterator it = str.begin(); it != str.end(); ++it) { + if (*it == '<') + tmp += "<"; + else if (*it == '\"') + tmp += """; + else if (*it == '\'') + tmp += "'"; + else if (*it == '&') + tmp += "&"; + else if (*it == '>') + tmp += ">"; + else if (*it == '\r') + tmp += " "; + else if (*it == '\n') + tmp += " "; + else if (*it == '\t') + tmp += " "; + else + tmp += *it; + } + + return tmp; +} diff --git a/src/Base/Persistence.h b/src/Base/Persistence.h index a095236f54..b54dd3d95d 100644 --- a/src/Base/Persistence.h +++ b/src/Base/Persistence.h @@ -146,6 +146,8 @@ public: * @see Base::Reader,Base::XMLReader */ virtual void RestoreDocFile(Reader &/*reader*/); + /// Encodes an attribute upon saving. + static std::string encodeAttribute(const std::string&); }; } //namespace Base diff --git a/src/Mod/Sketcher/App/Constraint.cpp b/src/Mod/Sketcher/App/Constraint.cpp index 2bdbe740bf..281e2aa772 100644 --- a/src/Mod/Sketcher/App/Constraint.cpp +++ b/src/Mod/Sketcher/App/Constraint.cpp @@ -175,7 +175,7 @@ unsigned int Constraint::getMemSize (void) const void Constraint::Save (Writer &writer) const { - std::string encodeName = App::Property::encodeAttribute(Name); + std::string encodeName = encodeAttribute(Name); writer.Stream() << writer.ind() << "