X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/908dee0db9288bb455e9f1b68dd81ab50897a677..de7760b87ad8ca38954140a738d66a133f7021f0:/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