* @param mclass The object type of this mode handler, one of ModeHandler::Class
*/
ModeHandler(Module* me, const std::string& name, char modeletter, ParamSpec params, ModeType type, Class mclass = MC_OTHER);
- virtual CullResult cull();
+ virtual CullResult cull() CXX11_OVERRIDE;
virtual ~ModeHandler();
/** Register this object in the ModeParser
*/
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
/**
* 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
*/
* 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.
/** For user modes, return the current parameter, if any
*/
- virtual std::string GetUserParameter(User* useor);
+ virtual std::string GetUserParameter(const User* user) const;
/**
* Called when a channel mode change access check for your mode occurs.
/**
* Removes this prefix mode from all users on the given channel
- * @param chan The channel which the server wants to remove your mode from
+ * @param channel The channel which the server wants to remove your mode from
* @param changelist Mode change list to populate with the removal of this mode
*/
void RemoveMode(Channel* channel, Modes::ChangeList& changelist);
* 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.
*/
static void InitBuiltinModes();
+ static bool IsModeChar(char chr);
+
/** Tidy a banmask. This makes a banmask 'acceptable' if fields are left out.
* E.g.
*
return (this->type_id == MC_PREFIX ? static_cast<PrefixMode*>(this) : NULL);
}
+inline const PrefixMode* ModeHandler::IsPrefixMode() const
+{
+ return (this->type_id == MC_PREFIX ? static_cast<const PrefixMode*>(this) : NULL);
+}
+
inline ListModeBase* ModeHandler::IsListModeBase()
{
return (this->type_id == MC_LIST ? reinterpret_cast<ListModeBase*>(this) : NULL);
}
+inline const ListModeBase* ModeHandler::IsListModeBase() const
+{
+ return (this->type_id == MC_LIST ? reinterpret_cast<const ListModeBase*>(this) : NULL);
+}
+
inline ParamModeBase* ModeHandler::IsParameterMode()
{
return (this->type_id == MC_PARAM ? reinterpret_cast<ParamModeBase*>(this) : NULL);
}
+
+inline const ParamModeBase* ModeHandler::IsParameterMode() const
+{
+ return (this->type_id == MC_PARAM ? reinterpret_cast<const ParamModeBase*>(this) : NULL);
+}