X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/baaffcbb18847d38ac7413c91abc361eaad8007b..34d407f7df45b5faaa25a92a04e8582f95162f31:/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