From 5f7464d90d0bfe641dd2c7bbbca6e78d92d9d818 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Thu, 16 Mar 2017 09:57:39 +0000 Subject: Try to clean up option include a bit --- src/option_types.hh | 50 +++----------------------------------------------- 1 file changed, 3 insertions(+), 47 deletions(-) (limited to 'src/option_types.hh') diff --git a/src/option_types.hh b/src/option_types.hh index 0193c821..ec7796f6 100644 --- a/src/option_types.hh +++ b/src/option_types.hh @@ -1,14 +1,13 @@ #ifndef option_types_hh_INCLUDED #define option_types_hh_INCLUDED +#include "option.hh" #include "exception.hh" #include "string.hh" #include "units.hh" #include "coord.hh" #include "array_view.hh" #include "hash_map.hh" -#include "flags.hh" -#include "enum.hh" #include #include @@ -39,7 +38,7 @@ inline bool option_add(int& opt, StringView str) opt += val; return val != 0; } -inline StringView option_type_name(Meta::Type) { return "int"; } +constexpr StringView option_type_name(Meta::Type) { return "int"; } inline String option_to_string(size_t opt) { return to_string(opt); } inline void option_from_string(StringView str, size_t& opt) { opt = str_to_int(str); } @@ -54,7 +53,7 @@ inline void option_from_string(StringView str, bool& opt) else throw runtime_error("boolean values are either true, yes, false or no"); } -inline StringView option_type_name(Meta::Type) { return "bool"; } +constexpr StringView option_type_name(Meta::Type) { return "bool"; } constexpr char list_separator = ':'; @@ -233,27 +232,6 @@ inline String option_to_string(const LineAndColumn) { return true; } - -constexpr Array, 4> enum_desc(Meta::Type) -{ - return { { - { DebugFlags::Hooks, "hooks" }, - { DebugFlags::Shell, "shell" }, - { DebugFlags::Profile, "profile" }, - { DebugFlags::Keys, "keys" } - } }; -} - template{}))> EnableIfWithBitOps option_to_string(Flags flags) { @@ -314,25 +292,6 @@ EnableIfWithBitOps option_add(Flags& opt, StringView str) return res != (Flags)0; } -template -struct PrefixedList -{ - P prefix; - Vector list; -}; - -template -inline bool operator==(const PrefixedList& lhs, const PrefixedList& rhs) -{ - return lhs.prefix == rhs.prefix and lhs.list == rhs.list; -} - -template -inline bool operator!=(const PrefixedList& lhs, const PrefixedList& rhs) -{ - return not (lhs == rhs); -} - template inline String option_to_string(const PrefixedList& opt) { @@ -354,9 +313,6 @@ inline bool option_add(PrefixedList& opt, StringView str) return option_add(opt.list, str); } -template -using TimestampedList = PrefixedList; - } #endif // option_types_hh_INCLUDED -- cgit v1.2.3