X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Fmode.h;h=35af686854cefd497b49f0b82d3cf3edd6b6a962;hb=0c3b041d1b36d1515913da5230399b379a802b81;hp=64829845f805c503979f912901c241b9a6d242de;hpb=19f0c09aa783cc3b945c880d509c1da8bc8e0275;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/mode.h b/include/mode.h index 64829845f..35af68685 100644 --- a/include/mode.h +++ b/include/mode.h @@ -184,6 +184,12 @@ class CoreExport ModeHandler : public ServiceProvider */ PrefixMode* IsPrefixMode(); + /** + * Check whether this mode is a prefix mode + * @return non-NULL if this mode is a prefix mode, NULL otherwise + */ + const PrefixMode* IsPrefixMode() const; + /** * Check whether this mode handler inherits from ListModeBase * @return non-NULL if this mode handler inherits from ListModeBase, NULL otherwise @@ -192,10 +198,22 @@ class CoreExport ModeHandler : public ServiceProvider /** * Check whether this mode handler inherits from ListModeBase + * @return non-NULL if this mode handler inherits from ListModeBase, NULL otherwise + */ + const ListModeBase* IsListModeBase() const; + + /** + * Check whether this mode handler inherits from ParamModeBase * @return non-NULL if this mode handler inherits from ParamModeBase, NULL otherwise */ ParamModeBase* IsParameterMode(); + /** + * Check whether this mode handler inherits from ParamModeBase + * @return non-NULL if this mode handler inherits from ParamModeBase, NULL otherwise + */ + const ParamModeBase* IsParameterMode() const; + /** * Returns the mode's type */ @@ -214,7 +232,7 @@ class CoreExport ModeHandler : public ServiceProvider * Returns the mode character this handler handles. * @return The mode character */ - inline char GetModeChar() { return mode; } + char GetModeChar() const { return mode; } /** Return the id of this mode which is used in User::modes and * Channel::modes as the index to determine whether a mode is set. @@ -450,7 +468,7 @@ class CoreExport ModeWatcher : public classbase * Get the mode type being watched * @return The mode type being watched (user or channel) */ - ModeType GetModeType(); + ModeType GetModeType() const { return m_type; } /** * Before the mode character is processed by its handler, this method will be called. @@ -790,12 +808,27 @@ inline PrefixMode* ModeHandler::IsPrefixMode() return (this->type_id == MC_PREFIX ? static_cast(this) : NULL); } +inline const PrefixMode* ModeHandler::IsPrefixMode() const +{ + return (this->type_id == MC_PREFIX ? static_cast(this) : NULL); +} + inline ListModeBase* ModeHandler::IsListModeBase() { return (this->type_id == MC_LIST ? reinterpret_cast(this) : NULL); } +inline const ListModeBase* ModeHandler::IsListModeBase() const +{ + return (this->type_id == MC_LIST ? reinterpret_cast(this) : NULL); +} + inline ParamModeBase* ModeHandler::IsParameterMode() { return (this->type_id == MC_PARAM ? reinterpret_cast(this) : NULL); } + +inline const ParamModeBase* ModeHandler::IsParameterMode() const +{ + return (this->type_id == MC_PARAM ? reinterpret_cast(this) : NULL); +}