From f73e89a716db7f71382f3716d2141c170a57ca2e Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sat, 6 Aug 2016 09:05:50 +0100 Subject: Add information of types of options --- src/string.hh | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/string.hh') diff --git a/src/string.hh b/src/string.hh index d7e0e56c..74fbb51a 100644 --- a/src/string.hh +++ b/src/string.hh @@ -128,6 +128,7 @@ public: void resize(ByteCount size, char c); static const String ms_empty; + static constexpr const char* option_type_name = "str"; union Data { @@ -305,6 +306,10 @@ inline String operator"" _str(const char* str, size_t) int str_to_int(StringView str); // throws on error Optional str_to_int_ifp(StringView str); +inline String option_to_string(StringView opt) { return opt.str(); } +inline void option_from_string(StringView str, String& opt) { opt = str.str(); } +inline bool option_add(String& opt, StringView val) { opt += val; return not val.empty(); } + template struct InplaceString { -- cgit v1.2.3