|
| | CBotClass (const std::string &name, CBotClass *parent, bool bIntrinsic=false) |
| | CBotClass Constructor. Once a class is created, it is known around CBot intrinsic mode gives a class that is not managed by pointers.
|
| | ~CBotClass () |
| | CBotClass Destructor.
|
| bool | AddFunction (const std::string &name, bool rExec(CBotVar *pThis, CBotVar *pVar, CBotVar *pResult, int &Exception, void *user), CBotTypResult rCompile(CBotVar *pThis, CBotVar *&pVar)) |
| | Add a function that can be called from CBot.
|
| bool | SetUpdateFunc (void rUpdate(CBotVar *thisVar, void *user)) |
| | SetUpdateFunc Defines routine to be called to update the elements of the class.
|
| bool | AddItem (std::string name, CBotTypResult type, CBotVar::ProtectionLevel mPrivate=CBotVar::ProtectionLevel::Public) |
| | AddItem Adds an element to the class.
|
| bool | AddItem (CBotVar *pVar) |
| | AddItem Adds an item by passing the pointer to an instance of a variable the object is taken as is, so do not destroyed.
|
| const std::string & | GetName () |
| | GetName Gives the name of the class.
|
| CBotClass * | GetParent () |
| | GetParent Gives the parent class (or nullptr).
|
| bool | IsChildOf (CBotClass *pClass) |
| | IsChildOf True if a class is derived (Extends) of another.
|
| CBotVar * | GetVar () |
| | GetVar Return the list of variables.
|
| CBotVar * | GetItem (const std::string &name) |
| | GetItem One of the variables according to its name.
|
| CBotVar * | GetItemRef (int nIdent) |
| | GetItemRef.
|
| bool | CheckVar (const std::string &name) |
| | Check whether a variable is already defined in a class.
|
| CBotTypResult | CompileMethode (CBotToken *name, CBotVar *pThis, CBotVar **ppParams, CBotCStack *pStack, long &nIdent) |
| | CompileMethode Compiles a method associated with an instance of class the method can be declared by the user or AddFunction.
|
| bool | ExecuteMethode (long &nIdent, CBotVar *pThis, CBotVar **ppParams, CBotTypResult pResultType, CBotStack *&pStack, CBotToken *pToken) |
| | ExecuteMethode Executes a method.
|
| void | RestoreMethode (long &nIdent, CBotToken *name, CBotVar *pThis, CBotVar **ppParams, CBotStack *&pStack) |
| | RestoreMethode Restored the execution stack.
|
| const std::list< CBotFunction * > & | GetFunctions () const |
| | Get the list of user-defined methods in this class.
|
| bool | CompileDefItem (CBotToken *&p, CBotCStack *pStack, bool bSecond) |
| | CompileDefItem.
|
| bool | IsIntrinsic () |
| | IsIntrinsic.
|
| void | Purge () |
| | Purge.
|
| bool | Lock (CBotProgram *prog) |
| | Request a lock on this class (for "synchronized" keyword).
|
| void | Unlock () |
| | Release the lock acquired in Lock() If you call Lock() multiple times for the same program, you have to call Unlock() multiple times too.
|
| bool | CheckCall (CBotProgram *program, CBotDefParam *pParam, CBotToken *&pToken) |
| | CheckCall Test if a procedure name is already defined somewhere.
|
|
void | Update (CBotVar *var, void *user) |
A CBot class definition.
Usage examples
Define class "point":
CBotClass(const std::string &name, CBotClass *parent, bool bIntrinsic=false)
CBotClass Constructor. Once a class is created, it is known around CBot intrinsic mode gives a class ...
Definition CBotClass.cpp:49
bool AddItem(std::string name, CBotTypResult type, CBotVar::ProtectionLevel mPrivate=CBotVar::ProtectionLevel::Public)
AddItem Adds an element to the class.
Definition CBotClass.cpp:158
Class to define the complete type of a variable.
Definition CBotTypResult.h:48
@ CBotTypFloat
float
Definition CBotEnums.h:43
Define readonly class "object" with members of type "point" and some methods:
bool AddFunction(const std::string &name, bool rExec(CBotVar *pThis, CBotVar *pVar, CBotVar *pResult, int &Exception, void *user), CBotTypResult rCompile(CBotVar *pThis, CBotVar *&pVar))
Add a function that can be called from CBot.
Definition CBotClass.cpp:288
@ CBotTypClass
Class instance.
Definition CBotEnums.h:53
@ CBotTypInt
int
Definition CBotEnums.h:41
Define class "robot" derrived from "object":
Create instance of the "robot" class:
A CBot variable.
Definition CBotVar.h:44
Access members of the "point" class:
T * GetNext()
Returns the next variable in the linked list.
Definition CBotUtils.h:110
virtual float GetValFloat() const
Get value as float.
Definition CBotVar.cpp:617
virtual CBotVar * GetItem(const std::string &name)
Returns class member by name.
Definition CBotVar.cpp:430
virtual CBotVar * GetItemList()
Return all elements of this variable as a linked list. Works for both classes and arrays.
Definition CBotVar.cpp:444