X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/64b687f8ec36a103865044613cb0f42f98aeda3a..2de285bd51f7e0c3f245b7f9d7144343b983ca44:/stglibs/srvconf.lib/parsers/resetable_utils.h 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