]> git.stg.codes - stg.git/blobdiff - stglibs/srvconf.lib/parsers/chg_service.cpp
Ticket. The time_t currentTime parameter added in
[stg.git] / stglibs / srvconf.lib / parsers / chg_service.cpp
index 2eed494f8c1d244bae90bb231ba7512c1a0bc918..6bea75653c9143da9ed90069fd44f86da5724061 100644 (file)
@@ -20,6 +20,8 @@
 
 #include "chg_service.h"
 
 
 #include "chg_service.h"
 
+#include "resetable_utils.h"
+
 #include "stg/service_conf.h"
 #include "stg/common.h"
 
 #include "stg/service_conf.h"
 #include "stg/common.h"
 
 
 using namespace STG;
 
 
 using namespace STG;
 
-namespace
-{
-
-template <typename T>
-void appendResetable(std::ostream & stream, const std::string & name, const T & value)
-{
-if (!value.empty())
-    stream << "<" << name << " value=\"" << value.data() << "\"/>";
-}
-
-} // namespace anonymous
-
-std::string CHG_SERVICE::Serialize(const SERVICE_CONF_RES & conf)
+std::string CHG_SERVICE::Serialize(const SERVICE_CONF_RES & conf, const std::string & /*encoding*/)
 {
 std::ostringstream stream;
 
 {
 std::ostringstream stream;
 
-appendResetable(stream, "name", conf.name);
-appendResetable(stream, "comment", conf.comment);
-appendResetable(stream, "cost", conf.cost);
-appendResetable(stream, "payDay", conf.payDay);
+appendResetableAttr(stream, "name", conf.name);
+appendResetableAttr(stream, "comment", MaybeEncode(conf.comment));
+appendResetableAttr(stream, "cost", conf.cost);
+appendResetableAttr(stream, "payDay", conf.payDay);
 
 return stream.str();
 }
 
 return stream.str();
 }