]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/command_parse.h
Needs testbuilding in windows. I will probably do this in a minute.
[user/henk/code/inspircd.git] / include / command_parse.h
index b9e57035dde3a3406c3bae006c1525a3dd53e5c6..e8240fcf9bf1a57a501947ab39a46e79ae3d6795 100644 (file)
 #include "ctables.h"
 #include "typedefs.h"
 
+/** Required forward declaration
+ */
 class InspIRCd;
 
+/** A list of dll/so files containing the command handlers for the core
+ */
 typedef std::map<std::string, void*> SharedObjectList;
 
 /** This class handles command management and parsing.
@@ -28,7 +32,7 @@ typedef std::map<std::string, void*> SharedObjectList;
  * call command handlers by name, and chop up comma seperated
  * parameters into multiple calls.
  */
-class CommandParser : public classbase
+class CoreExport CommandParser : public classbase
 {
  private:
        /** The creator of this class
@@ -72,6 +76,12 @@ class CommandParser : public classbase
         */
        void LoadCommand(const char* name);
 
+       /** Removes a command if the sources match. Used as a helper for
+        *  safe hash_map delete while iter in RemoveCommands(const char* source).
+        */
+       void RemoveCommand(nspace::hash_map<std::string,command_t*>::iterator safei, const char* source);
+
+
  public:
        /** Command list, a hash_map of command names to command_t*
         */
@@ -105,6 +115,10 @@ class CommandParser : public classbase
         */
        CmdResult CallHandler(const std::string &commandname,const char** parameters, int pcnt, userrec *user);
 
+       /** Get the handler function for a command.
+        * @param commandname The command required. Always use uppercase for this parameter.
+        * @return a pointer to the command handler, or NULL
+        */
        command_t* GetHandler(const std::string &commandname);
 
        /** This function returns true if a command is valid with the given number of parameters and user.
@@ -175,8 +189,6 @@ class CommandParser : public classbase
         */
        bool RemoveCommands(const char* source);
 
-       void RemoveCommand(nspace::hash_map<std::string,command_t*>::iterator safei, const char* source);
-
        /** Add a new command to the commands hash
         * @param f The new command_t to add to the list
         * @param so_handle The handle to the shared object where the command can be found.
@@ -201,6 +213,32 @@ class cmd_reload : public command_t
        CmdResult Handle(const char** parameters, int pcnt, userrec *user);
 };
 
-
+/** A lookup table of values for multiplier characters used by
+ * InspIRCd::Duration(). In this lookup table, the indexes for
+ * the ascii values 'm' and 'M' have the value '60', the indexes
+ * for the ascii values 'D' and 'd' have a value of '86400', etc.
+ */
+const int duration_multi[] =
+{
+       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+       1, 1, 1, 1, 1, 1, 1, 1, 86400, 1, 1, 1, 3600,
+       1, 1, 1, 1, 60, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+       604800, 1, 31536000, 1, 1, 1, 1, 1, 1, 1, 1,
+       1, 1, 86400, 1, 1, 1, 3600, 1, 1, 1, 1, 60,
+       1, 1, 1, 1, 1, 1, 1, 1, 1, 604800, 1, 31536000,
+       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+       1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
+};
 
 #endif
+