From f543e3486f3e3ffbd7e34f94edf928fa52d1baf2 Mon Sep 17 00:00:00 2001 From: johanengelen Date: Wed, 6 Feb 2008 22:41:42 +0000 Subject: [PATCH] add extra note of importance to EnumDataConverter and add is_valid_id method --- src/util/enums.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/util/enums.h b/src/util/enums.h index 909765216..69514b202 100644 --- a/src/util/enums.h +++ b/src/util/enums.h @@ -12,7 +12,9 @@ /* IMPORTANT * When initializing the EnumData struct, you cannot use _(...) to translate strings. - * Instead, one must use N_(...) and do the translation every time the string is retreived. + * Instead, one must use N_(...) and do the translation every time the string is retreived. + * + * Note that get_id_from_key and get_id_from_label return 0 if it cannot find an entry for that key string */ @@ -71,6 +73,11 @@ public: return false; } + bool is_valid_id(const E e) const + { + return ( (int)e < end ); + } + const Glib::ustring& get_label(const E e) const { return _data[e].label; -- 2.30.2