X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/1b2ab8e6d556a8ed30d4feadc72263b3f4c86665..95fbaf3fe639c84d7aab1d8c25cecdb9f8e7072a:/stglibs/srvconf.lib/parsers/resetable_utils.h?ds=sidebyside diff --git a/stglibs/srvconf.lib/parsers/resetable_utils.h b/stglibs/srvconf.lib/parsers/resetable_utils.h index ed1cd305..088cb327 100644 --- a/stglibs/srvconf.lib/parsers/resetable_utils.h +++ b/stglibs/srvconf.lib/parsers/resetable_utils.h @@ -22,6 +22,7 @@ #define __STG_STGLIBS_SRVCONF_RESETABLE_UTILS_H__ #include "stg/resetable.h" +#include "stg/common.h" #include #include @@ -30,6 +31,7 @@ namespace STG { template +inline void appendResetable(std::ostream & stream, const std::string & name, const T & value) { if (!value.empty()) @@ -37,12 +39,31 @@ if (!value.empty()) } template +inline void appendResetable(std::ostream & stream, const std::string & name, size_t suffix, const T & value) { if (!value.empty()) stream << "<" << name << suffix << " value=\"" << value.data() << "\"/>"; } +inline +RESETABLE MaybeEncode(const RESETABLE & value) +{ +RESETABLE res; +if (!value.empty()) + res = Encode12str(value.data()); +return res; +} + +inline +RESETABLE MaybeIconv(const RESETABLE & value, const std::string & fromEncoding, const std::string & toEncoding) +{ +RESETABLE res; +if (!value.empty()) + res = IconvString(value.data(), fromEncoding, toEncoding); +return res; +} + } // namespace STG #endif