From 52e4d9c96c83ca4bbbeb487966ac2897a384907d Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Mon, 2 Sep 2013 12:25:54 +0200 Subject: Add ModeHandler::IsListModeBase() and MC_LIST --- include/mode.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/mode.h b/include/mode.h index e20815549..bfe4041b9 100644 --- a/include/mode.h +++ b/include/mode.h @@ -85,6 +85,7 @@ enum ParamSpec }; class PrefixMode; +class ListModeBase; /** Each mode is implemented by ONE ModeHandler class. * You must derive ModeHandler and add the child class to @@ -106,6 +107,7 @@ class CoreExport ModeHandler : public ServiceProvider enum Class { MC_PREFIX, + MC_LIST, MC_OTHER }; @@ -178,10 +180,17 @@ class CoreExport ModeHandler : public ServiceProvider bool IsListMode() const { return list; } /** - * Returns a PrefixMode* if this mode is a prefix mode, NULL otherwise + * Check whether this mode is a prefix mode + * @return non-NULL if this mode is a prefix mode, NULL otherwise */ PrefixMode* IsPrefixMode(); + /** + * Check whether this mode handler inherits from ListModeBase + * @return non-NULL if this mode handler inherits from ListModeBase, NULL otherwise + */ + ListModeBase* IsListModeBase(); + /** * Returns the mode's type */ @@ -678,3 +687,8 @@ inline PrefixMode* ModeHandler::IsPrefixMode() { return (this->type_id == MC_PREFIX ? static_cast(this) : NULL); } + +inline ListModeBase* ModeHandler::IsListModeBase() +{ + return (this->type_id == MC_LIST ? reinterpret_cast(this) : NULL); +} -- cgit v1.2.3