Browse Source

improve ConsoleCommand interface

Kolja Strohm 1 month ago
parent
commit
202c5df23c
2 changed files with 5 additions and 5 deletions
  1. 1 1
      Console.cpp
  2. 4 4
      Console.h

+ 1 - 1
Console.cpp

@@ -16,7 +16,7 @@ ConsoleCommand::ConsoleCommand(Text name)
 
 ConsoleCommand::~ConsoleCommand() {}
 
-Text& Framework::ConsoleCommand::getName()
+const Text& Framework::ConsoleCommand::getName() const
 {
     return name;
 }

+ 4 - 4
Console.h

@@ -53,7 +53,7 @@ namespace Framework
          *
          * \return the name
          */
-        DLLEXPORT Text& getName();
+        DLLEXPORT const Text& getName() const;
         /**
          * calculates autocomplete posibilities when the user presses the tab
          * key and wants to use this command
@@ -64,9 +64,9 @@ namespace Framework
          * \param possibilities the array to which the
          * possibilities should be added
          */
-        virtual void addAutocompletePossibilities(RCArray<Text>& args,
+        virtual void addAutocompletePossibilities(const RCArray<Text>& args,
             bool appendToLast,
-            RCArray<Text>& possibilities)
+            RCArray<Text>& possibilities) const
             = 0;
         /**
          * executes the command
@@ -74,7 +74,7 @@ namespace Framework
          * \param args the arguments that the user has passed to the command
          * \return true if the command was executed successfully
          */
-        virtual bool execute(RCArray<Text>& args) = 0;
+        virtual bool execute(RCArray<Text>& args) const = 0;
     };
 
     /**