]> git.mxchange.org Git - simgear.git/blobdiff - simgear/misc/commands.hxx
Simplified the command-manager interface.
[simgear.git] / simgear / misc / commands.hxx
index 6cfc53810e1d82840878141ef7cb303bbec64e5e..55f193b48c6cbcd4415da46e9838ceb11e65b4ac 100644 (file)
 #define __COMMANDS_HXX
 
 
-#include <string>
+#include <simgear/compiler.h>
+
+#include STL_STRING
 #include <map>
 #include <vector>
 
 #include "props.hxx"
 
-using std::string;
-using std::map;
-using std::vector;
+SG_USING_STD(string);
+SG_USING_STD(map);
+SG_USING_STD(vector);
 
 
 /**
  * Manage commands.
  *
  * <p>This class allows the application to register and unregister
- * commands, and provides shortcuts for executing them.  Commands
- * are simple functions that take a const pointer to an SGPropertyNode
- * as an argument and return a bool value indicating success or failure.
- * The property node may be ignored, or it may contain values that
- * the command uses as parameters.</p>
- *
- * <p>There are convenience methods for invoking a command function
- * with no arguments or with a single, primitive argument.</p>
+ * commands, and provides shortcuts for executing them.  Commands are
+ * simple functions that take a const pointer to an SGPropertyNode:
+ * the function may use the nodes children as parameters.</p>
  *
  * @author David Megginson, david@megginson.com
  */
@@ -93,9 +90,6 @@ public:
   /**
    * Execute a command.
    *
-   * This is the primary method for invoking a command; the others
-   * are convenience methods that invoke this one indirectly.
-   * 
    * @param name The name of the command.
    * @param arg A const pointer to an SGPropertyNode.  The node
    * may have a value and/or children, etc., so that it is possible
@@ -105,104 +99,6 @@ public:
    */
   virtual bool execute (const string &name, const SGPropertyNode * arg) const;
 
-
-  /**
-   * Execute a command with no argument.
-   *
-   * The command function will receive a pointer to a property node
-   * with no value and no children.
-   *
-   * @param name The name of the command.
-   * @return true if the command is present and executes successfully,
-   * false otherwise.
-   */
-  virtual bool execute (const string &name) const;
-
-
-  /**
-   * Execute a command with a single bool argument.
-   *
-   * The command function will receive a pointer to a property node
-   * with a bool value and no children.
-   *
-   * @param name The name of the command.
-   * @param arg The bool argument to the command.
-   * @return true if the command is present and executes successfully,
-   * false otherwise.
-   */
-  virtual bool execute (const string &name, bool arg) const;
-
-
-  /**
-   * Execute a command with a single int argument.
-   *
-   * The command function will receive a pointer to a property node
-   * with a int value and no children.
-   *
-   * @param name The name of the command.
-   * @param arg The int argument to the command.
-   * @return true if the command is present and executes successfully,
-   * false otherwise.
-   */
-  virtual bool execute (const string &name, int arg) const;
-
-
-  /**
-   * Execute a command with a single long argument.
-   *
-   * The command function will receive a pointer to a property node
-   * with a long value and no children.
-   *
-   * @param name The name of the command.
-   * @param arg The long argument to the command.
-   * @return true if the command is present and executes successfully,
-   * false otherwise.
-   */
-  virtual bool execute (const string &name, long arg) const;
-
-
-  /**
-   * Execute a command with a single float argument.
-   *
-   * The command function will receive a pointer to a property node
-   * with a float value and no children.
-   *
-   * @param name The name of the command.
-   * @param arg The float argument to the command.
-   * @return true if the command is present and executes successfully,
-   * false otherwise.
-   */
-  virtual bool execute (const string &name, float arg) const;
-
-
-  /**
-   * Execute a command with a single double argument.
-   *
-   * The command function will receive a pointer to a property node
-   * with a double value and no children.
-   *
-   * @param name The name of the command.
-   * @param arg The double argument to the command.
-   * @return true if the command is present and executes successfully,
-   * false otherwise.
-   */
-  virtual bool execute (const string &name, double arg) const;
-
-
-  /**
-   * Execute a command with a single string argument.
-   *
-   * The command function will receive a pointer to a property node
-   * with a string value and no children.
-   *
-   * @param name The name of the command.
-   * @param arg The string argument to the command.
-   * @return true if the command is present and executes successfully,
-   * false otherwise.
-   */
-  virtual bool execute (const string &name, string arg) const;
-
-
 private:
 
   typedef map<string,command_t> command_map;
@@ -210,6 +106,6 @@ private:
 
 };
 
-#endif __COMMANDS_HXX
+#endif // __COMMANDS_HXX
 
 // end of commands.hxx