From 1e65c589308e6176f4b27538f0b58bd75019f8ba Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Wed, 6 Feb 2008 22:41:42 +0000 Subject: add extra note of importance to EnumDataConverter and add is_valid_id method (bzr r4671) --- src/util/enums.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') 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; -- cgit v1.2.3