35 #ifndef _ConsoleCommand_H__ 36 #define _ConsoleCommand_H__ 137 if (this->command_->getExecutor() && this->command_->getExecutor()->getFunctor() && this->command_->getExecutor()->getFunctor()->getFullIdentifier() ==
typeid(
F))
143 this->command_->setFunction(
createFunctor(
function), bForce);
148 template <
class F,
class O>
154 if (this->command_->getExecutor() && this->command_->getExecutor()->getFunctor() && this->command_->getExecutor()->getFunctor()->getFullIdentifier() ==
typeid(
F))
161 this->command_->setFunction(
createFunctor(
function,
object), bForce);
167 {
if (this->command_) { this->command_->
setFunction(functor, bForce); }
return *
this; }
170 {
if (this->command_) { this->command_->
setFunction(executor, bForce); }
return *
this; }
174 {
if (this->command_) { this->command_->
pushFunction(); }
return *
this; }
180 template <
class F,
class O>
185 {
if (this->command_) { this->command_->
pushFunction(functor, bForce); }
return *
this; }
188 {
if (this->command_) { this->command_->
pushFunction(executor, bForce); }
return *
this; }
192 {
if (this->command_) { this->command_->
popFunction(); }
return *
this; }
196 {
if (this->command_) { this->command_->
resetFunction(); }
return *
this; }
200 {
if (this->command_) { this->command_->
setObject(
object); }
return *
this; }
203 {
if (this->command_) { this->command_->
pushObject(
object); }
return *
this; }
206 {
if (this->command_) { this->command_->
popObject(); }
return *
this; }
210 {
if (this->command_) { this->command_->
setActive(bActive); }
return *
this; }
213 {
return this->setActive(
true); }
216 {
return this->setActive(
false); }
220 {
if (this->command_) { this->command_->
setHidden(bHidden); }
return *
this; }
223 {
return this->setHidden(
true); }
226 {
return this->setHidden(
false); }
230 {
if (this->command_) { this->command_->
defaultValues(arg1); }
return *
this; }
233 {
if (this->command_) { this->command_->
defaultValues(arg1, arg2); }
return *
this; }
236 {
if (this->command_) { this->command_->
defaultValues(arg1, arg2, arg3); }
return *
this; }
239 {
if (this->command_) { this->command_->
defaultValues(arg1, arg2, arg3, arg4); }
return *
this; }
242 {
if (this->command_) { this->command_->
defaultValues(arg1, arg2, arg3, arg4, arg5); }
return *
this; }
245 {
if (this->command_) { this->command_->
defaultValue(index, arg); }
return *
this; }
249 {
if (this->command_) { this->command_->
accessLevel(level); }
return *
this; }
253 {
if (this->command_) { this->command_->
argumentCompleter(index, completer); }
return *
this; }
260 {
if (this->command_) { this->command_->changeKeybindMode(mode); }
return *
this; }
281 {
return this->baseName_; }
286 {
return this->baseFunctor_; }
290 { this->bActive_ = bActive;
return *
this; }
293 {
return this->setActive(
true); }
296 {
return this->setActive(
false); }
300 { this->bHidden_ = bHidden;
return *
this; }
303 {
return this->setHidden(
true); }
306 {
return this->setHidden(
false); }
308 bool isActive()
const;
309 bool hasAccess()
const;
312 {
return this->bHidden_; }
318 const std::string& getDescriptionParam(
unsigned int index)
const;
321 const std::string& getDescriptionReturnvalue(
int index)
const;
332 { this->accessLevel_ = level;
return *
this; }
335 {
return this->accessLevel_; }
345 this->inputConfiguredParam(0);
351 { this->keybindMode_ = mode;
return *
this; }
354 {
return this->keybindMode_; }
360 { this->inputConfiguredParam_ = index;
return *
this; }
363 {
return this->inputConfiguredParam_; }
370 {
return this->names_; }
378 bool setFunction(
const ExecutorPtr& executor,
bool bForce =
false);
379 bool setFunction(
const FunctorPtr& functor,
bool bForce =
false);
380 void pushFunction(
const ExecutorPtr& executor,
bool bForce =
false);
381 void pushFunction(
const FunctorPtr& functor,
bool bForce =
false);
384 void resetFunction();
386 bool setObject(
void*
object);
387 void pushObject(
void*
object);
389 void* getObject()
const;
std::shared_ptr< Functor > FunctorPtr
Definition: FunctorPtr.h:57
ConsoleCommandManipulator & argumentCompleter(unsigned int index, ArgumentCompleter *completer)
Changes the argument completer for the given parameter.
Definition: ConsoleCommand.h:252
Declaration of all argument completion functions and macros used to define them.
Definition: InputPrereqs.h:82
FunctorPtr baseFunctor_
The functor that defines the header of the command-function.
Definition: ConsoleCommand.h:396
The ConsoleCommand class stores all information about a console command which can be executed by Comm...
Definition: ConsoleCommand.h:88
ConsoleCommandManipulator & setFunction(F function, bool bForce=false)
Changes the current function of the command.
Definition: ConsoleCommand.h:132
const std::string & getName() const
Returns the name that was first used for this command.
Definition: ConsoleCommand.h:280
ConsoleCommandManipulator & defaultValues(const MultiType &arg1, const MultiType &arg2)
Changes the default values of the current executor (doesn't modify executors on deeper levels of the ...
Definition: ConsoleCommand.h:232
ConsoleCommand & activate()
Activates the command.
Definition: ConsoleCommand.h:292
ConsoleCommand & inputConfiguredParam(int index)
Changes the input configured param to the given index.
Definition: ConsoleCommand.h:359
ConsoleCommandManipulator & pushFunction()
Pushes a copy of the current Executor on the command-stack, that can be altered without changing the ...
Definition: ConsoleCommand.h:173
Shared library macros, enums, constants and forward declarations for the core library ...
::std::string string
Definition: gtest-port.h:756
std::string string__bool(bool)
Definition: ConsoleCommand.h:57
std::vector< CommandName > names_
All names and aliases of this command.
Definition: ConsoleCommand.h:395
KeybindMode::Value getKeybindMode() const
Returns the keybind mode.
Definition: ConsoleCommand.h:353
std::string group_
Definition: ConsoleCommand.h:109
ConsoleCommandManipulator & setHidden(bool bHidden)
Changes the visibility of the command.
Definition: ConsoleCommand.h:219
std::string name_
Definition: ConsoleCommand.h:110
std::stack< Command > commandStack_
A stack of commands, used to push and pop different functions.
Definition: ConsoleCommand.h:399
Helper class that is used to put the current state of the ConsoleCommand on a stack.
Definition: ConsoleCommand.h:95
ConsoleCommandManipulator & defaultValues(const MultiType &arg1)
Changes the default values of the current executor (doesn't modify executors on deeper levels of the ...
Definition: ConsoleCommand.h:229
FunctorPtr functor_
The function that is used with the executor - has to be stored separatley because the executor is oft...
Definition: ConsoleCommand.h:98
LanguageEntryLabel description_
The description of the command.
Definition: ConsoleCommand.h:407
Client *client; The network/Client class This class implements all necessary function for the network...
Definition: Client.h:68
ConsoleCommandManipulator & resetFunction()
Sets the current function-pointer to nullptr, which also deactivates the command. ...
Definition: ConsoleCommand.h:195
ConsoleCommandManipulator & keybindMode(KeybindMode::Value mode)
Changes the keybind mode of the command.
Definition: ConsoleCommand.h:259
const FunctorPtr & getBaseFunctor() const
Returns the functor that defines the required header for this command (but isn't necessarily executed...
Definition: ConsoleCommand.h:285
ConsoleCommandManipulator & setFunction(const FunctorPtr &functor, bool bForce=false)
Changes the current Functor of the command.
Definition: ConsoleCommand.h:166
Definition: InputPrereqs.h:91
ExecutorPtr executor_
The executor.
Definition: ConsoleCommand.h:97
ConsoleCommandManipulator & setFunction(F function, O *object, bool bForce=false)
Changes the current function of the command.
Definition: ConsoleCommand.h:149
ConsoleCommandManipulator & defaultValues(const MultiType &arg1, const MultiType &arg2, const MultiType &arg3)
Changes the default values of the current executor (doesn't modify executors on deeper levels of the ...
Definition: ConsoleCommand.h:235
FunctorMemberPtr< O > createFunctor(R(O::*functionPointer)(Params...), OO *object)
Creates a new FunctorMember with the given function-pointer and an assigned object.
Definition: Functor.h:583
bool bActive_
True if the command should be active (it can still be inactive, for example if the function is missin...
Definition: ConsoleCommand.h:391
ConsoleCommandManipulator & popObject()
Removes the current object from the object-stack and restores the old object (or nullptr if there's n...
Definition: ConsoleCommand.h:205
const std::vector< CommandName > & getNames()
Definition: ConsoleCommand.h:369
Defines the name of a command, consisting of an optional group ("" means no group) and the name itsel...
Definition: ConsoleCommand.h:106
int inputConfiguredParam_
The input configured param.
Definition: ConsoleCommand.h:405
ConsoleCommand & setActive(bool bActive)
Changes the activity of the command.
Definition: ConsoleCommand.h:289
ConsoleCommandManipulator & deactivate()
Deactivates the command.
Definition: ConsoleCommand.h:215
false defaultValue(2, false).argumentCompleter(0
AccessLevel
Possible access levels: A command can only be executed if the program is in the state which is reques...
Definition: ConsoleCommand.h:65
Definition: CorePrereqs.h:127
ConsoleCommand & setAsInputCommand()
Defines the command to be an input command.
Definition: ConsoleCommand.h:341
std::vector< void * > objectStack_
A stack of objects, used to push and pop different objects for a function.
Definition: ConsoleCommand.h:400
AccessLevel accessLevel_
The access level (the state of the game in which you can access the command)
Definition: ConsoleCommand.h:393
Declaration of the orxonox::Executor class and the createExecutor() functions.
ConsoleCommandManipulator & pushObject(void *object)
Pushes a new object on the object-stack.
Definition: ConsoleCommand.h:202
ConsoleCommandManipulator & activate()
Activates the command.
Definition: ConsoleCommand.h:212
int getInputConfiguredParam() const
Returns the input configured param.
Definition: ConsoleCommand.h:362
ConsoleCommand & show()
Makes the command visible.
Definition: ConsoleCommand.h:305
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
bool bHidden_
True if the command is hidden (it is still executable, but not visible in the list of available comma...
Definition: ConsoleCommand.h:392
ARGUMENT_COMPLETION_FUNCTION_IMPLEMENTATION_MULTI() command(const std::string &fragment)
Returns a list of commands and groups and also supports auto-completion of the arguments of these com...
Definition: ArgumentCompletionFunctions.cc:178
Value
Definition: CorePrereqs.h:124
#define _CoreExport
Definition: CorePrereqs.h:61
ConsoleCommandManipulator getManipulator()
Returns a manipulator for this command.
Definition: ConsoleCommand.h:366
The MultiType can hold a value of many possible types and convert them to other types.
Definition: MultiType.h:130
This class is the root class of the network module for a server.
Definition: Server.h:52
CommandName(const std::string &group, const std::string &name)
Definition: ConsoleCommand.h:108
std::vector< void * > objectStack_
The object stack.
Definition: ConsoleCommand.h:99
ConsoleCommandManipulator & defaultValues(const MultiType &arg1, const MultiType &arg2, const MultiType &arg3, const MultiType &arg4, const MultiType &arg5)
Changes the default values of the current executor (doesn't modify executors on deeper levels of the ...
Definition: ConsoleCommand.h:241
ConsoleCommand & accessLevel(AccessLevel level)
Changes the access level of the command.
Definition: ConsoleCommand.h:331
ConsoleCommandManipulator(ConsoleCommand *command)
Constructor: Creates a manipulator for a given ConsoleCommand.
Definition: ConsoleCommand.h:128
ConsoleCommand * command_
The command which is being manipulated by this object.
Definition: ConsoleCommand.h:266
void void__string(const std::string &)
Definition: ConsoleCommand.h:55
std::string string__uint_uint_bool(unsigned int, unsigned int, bool)
Definition: ConsoleCommand.h:59
bool isHidden() const
Returns true if the command is currently hidden.
Definition: ConsoleCommand.h:311
ConsoleCommandManipulator & pushFunction(const FunctorPtr &functor, bool bForce=false)
Pushes a new Functor on the command-stack.
Definition: ConsoleCommand.h:184
ConsoleCommandManipulator & setFunction(const ExecutorPtr &executor, bool bForce=false)
Changes the current Executor of the command.
Definition: ConsoleCommand.h:169
ConsoleCommandManipulator & inputConfiguredParam(int index)
Sets the input configured param to the given index.
Definition: ConsoleCommand.h:262
ConsoleCommandManipulator & defaultValue(unsigned int index, const MultiType &arg)
Changes the default value of the argument with given index of the current executor (doesn't modify ex...
Definition: ConsoleCommand.h:244
ConsoleCommandManipulator & show()
Makes the command visible.
Definition: ConsoleCommand.h:225
const unsigned int MAX_FUNCTOR_ARGUMENTS
The maximum number of parameters of a function that is supported by Functor.
Definition: Functor.h:127
ConsoleCommandManipulator & setObject(void *object)
Changes the current object (used for member-functions).
Definition: ConsoleCommand.h:199
ConsoleCommandManipulator & defaultValues(const MultiType &arg1, const MultiType &arg2, const MultiType &arg3, const MultiType &arg4)
Changes the default values of the current executor (doesn't modify executors on deeper levels of the ...
Definition: ConsoleCommand.h:238
ConsoleCommandManipulator & setActive(bool bActive)
Changes the activity of the command.
Definition: ConsoleCommand.h:209
KeybindMode::Value keybindMode_
The keybind mode.
Definition: ConsoleCommand.h:404
std::string string__string(const std::string &)
Definition: ConsoleCommand.h:58
ConsoleCommand & setHidden(bool bHidden)
Changes the visibility of the command.
Definition: ConsoleCommand.h:299
ConsoleCommand & deactivate()
Deactivates the command.
Definition: ConsoleCommand.h:295
ConsoleCommandManipulator & accessLevel(AccessLevel level)
Changes the access level of the command.
Definition: ConsoleCommand.h:248
ConsoleCommand & keybindMode(KeybindMode::Value mode)
Sets the keybind mode. Note: use changeKeybindMode if you intend to change the mode.
Definition: ConsoleCommand.h:350
ConsoleCommandManipulator & hide()
Hides the command (can still be executed, but is not visible in the list of available commands)...
Definition: ConsoleCommand.h:222
ExecutorPtr executor_
The Executor that is used to execute the command.
Definition: ConsoleCommand.h:398
ConsoleCommandManipulator & popFunction()
Removes the current function from the stack and restores the old state. If there's no other function ...
Definition: ConsoleCommand.h:191
std::string baseName_
The name that was first assigned to the command.
Definition: ConsoleCommand.h:394
std::string LanguageEntryLabel
Definition: CorePrereqs.h:141
LanguageEntryLabel descriptionReturnvalue_
A description of the return-value.
Definition: ConsoleCommand.h:408
void void__void(void)
Definition: ConsoleCommand.h:54
ConsoleCommandManipulator & pushFunction(const ExecutorPtr &executor, bool bForce=false)
Pushes a new Executor on the command-stack.
Definition: ConsoleCommand.h:187
void setObject(O *object)
Assigns an object-pointer to the functor which is used to execute a member-function.
Definition: Functor.h:265
ConsoleCommand & hide()
Hides the command (can still be executed, but is not visible in the list of available commands)...
Definition: ConsoleCommand.h:302
internal::String name_
Definition: gtest.cc:2289
std::shared_ptr< Executor > ExecutorPtr
Definition: ExecutorPtr.h:55
void setFunction(F functionPointer)
Changes the function-pointer.
Definition: Functor.h:376
AccessLevel getAccessLevel() const
Returns the access level of the command.
Definition: ConsoleCommand.h:334
FunctorPointer is a child class of FunctorMember and extends it with a function-pointer (or a functio...
Definition: Functor.h:369
ConsoleCommandManipulator & setAsInputCommand()
Defines the command to be an input command.
Definition: ConsoleCommand.h:256
This class executes an argument completion function and returns a list of the possible arguments...
Definition: ArgumentCompleter.h:70
ConsoleCommandManipulator & pushFunction(F function, O *object, bool bForce=false)
Pushes a new function on the command-stack.
Definition: ConsoleCommand.h:181
ConsoleCommandManipulator & pushFunction(F function, bool bForce=false)
Pushes a new function on the command-stack.
Definition: ConsoleCommand.h:177
Helper class that is used to manipulate console commands.
Definition: ConsoleCommand.h:124