|
|
|
|
Documentation |
|
Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages Search
command.h File ReferenceManagement of runtime command line processing.
More...
#include "nel/misc/types_nl.h"
#include <string>
#include <map>
#include <vector>
#include <sstream>
#include <istream>
#include "nel/misc/stream.h"
#include "nel/misc/log.h"
Go to the source code of this file.
Detailed Description
Management of runtime command line processing.
-
Id:
-
command.h,v 1.17 2002/11/29 10:07:54 lecroart Exp
Definition in file command.h.
Define Documentation
#define NLMISC_COMMAND |
( |
__name, |
|
|
__help, |
|
|
__args |
|
) |
|
|
|
Value: struct __name##Class: public NLMISC::ICommand \
{ \
__name##Class() : NLMISC::ICommand(#__name,__help,__args) { } \
virtual bool execute(const std::vector<std::string> &args, NLMISC::CLog &log); \
}; \
__name##Class __name##Instance; \
bool __name##Class::execute(const std::vector<std::string> &args, NLMISC::CLog &log) Create a function that can be call in realtime.
Example:
NLMISC_COMMAND(square,"display the square of the parameter","<value>")
{
if(args.size() != 1) return false;
uint32 val = atoi(args[0].c_str());
log.displayNL("The square of %d is %d", val, val*val);
return true;
}
Please use the same casing than for the function (first letter in lower case and after each word first letter in upper case) ie: myFunction, step, orderByName, lookAtThis
-
Author:
-
Vianney Lecroart , Nevrax France
-
Date:
-
2001
Definition at line 71 of file command.h. |
#define NLMISC_DYNVARIABLE |
( |
__type, |
|
|
__name, |
|
|
__help |
|
) |
|
|
|
Add a variable that can be modify in realtime.
The code profide the way to access to the variable in the read and write access (depending of the get boolean value)
Example:
uint8 getVar() { return ...; }
void setVar(uint8 val) { ...=val; }
NLMISC_DYNVARIABLE(uint8, FooBar, "this is a dummy variable")
{
if (get)
*pointer = getVar();
else
setVar(*pointer);
}
Please use the same casing than for the variable (first letter of each word in upper case) ie: MyVariable, NetSpeedLoop, Time
-
Author:
-
Vianney Lecroart , Nevrax France
-
Date:
-
2001
Definition at line 136 of file command.h. |
#define NLMISC_VARIABLE |
( |
__type, |
|
|
__var, |
|
|
__help |
|
) |
NLMISC::CVariable<__type> __var##Instance(#__var, __help " (" #__type ")", &__var)
|
|
|
Add a variable that can be modify in realtime.
The variable must be global. If you must acces the variable with function, use NLMISC_DYNVARIABLE
Example:
Please use the same casing than for the variable (first letter of each word in upper case) ie: MyVariable, NetSpeedLoop, Time
-
Author:
-
Vianney Lecroart , Nevrax France
-
Date:
-
2001
Definition at line 101 of file command.h. |
|
|