Colobot
|
Class to define the complete type of a variable. More...
#include <src/CBot/CBotTypResult.h>
Public Types | |
enum | GetTypeMode { NORMAL = 0, NULL_AS_POINTER = 3 } |
Mode for GetType() More... | |
Public Member Functions | |
CBotTypResult (int type) | |
Constructor for simple types (CBotTypInt to CBotTypString) More... | |
CBotTypResult (int type, const std::string &name) | |
Constructor for pointer types and intrinsic classes. More... | |
CBotTypResult (int type, CBotClass *pClass) | |
Constructor for instance of a class. More... | |
CBotTypResult (int type, CBotTypResult elem) | |
Constructor for arrays. More... | |
CBotTypResult (const CBotTypResult &typ) | |
Copy constructor. More... | |
CBotTypResult () | |
Default constructor. More... | |
~CBotTypResult () | |
Destructor. More... | |
int | GetType (GetTypeMode mode=GetTypeMode::NORMAL) const |
Returns CBotType or CBotError stored in this object. More... | |
void | SetType (int n) |
Changes CBotType or CBotError stored in this object. More... | |
CBotClass * | GetClass () const |
Returns CBotClass pointer (for CBotTypClass, CBotTypPointer) More... | |
int | GetLimite () const |
Get size limit of an array (for CBotTypArrayBody or CBotTypArrayPointer) More... | |
void | SetLimite (int n) |
Set size limit of an array (for CBotTypArrayBody or CBotTypArrayPointer) More... | |
void | SetArray (int max[]) |
Set size limit of an multidimensional array. More... | |
CBotTypResult & | GetTypElem () const |
Get type of array elements (for CBotTypArrayBody or CBotTypArrayPointer) More... | |
bool | Compare (const CBotTypResult &typ) const |
Compares whether the types are compatible. More... | |
bool | Eq (int type) const |
Compare type only. More... | |
CBotTypResult & | operator= (const CBotTypResult &src) |
Copy. More... | |
std::string | ToString () |
Get this type name as string. More... | |
Friends | |
class | CBotVarClass |
class | CBotVarPointer |
Class to define the complete type of a variable.
Examples:
|
strong |
Mode for GetType()
CBot::CBotTypResult::CBotTypResult | ( | int | type | ) |
Constructor for simple types (CBotTypInt to CBotTypString)
CBot::CBotTypResult::CBotTypResult | ( | int | type, |
const std::string & | name | ||
) |
Constructor for pointer types and intrinsic classes.
This is equivalent to calling:
type | type of created result, see CBotType |
name | name of the class |
CBot::CBotTypResult::CBotTypResult | ( | int | type, |
CBotClass * | pClass | ||
) |
Constructor for instance of a class.
type | type of created result, see CBotType |
pClass | class type |
CBot::CBotTypResult::CBotTypResult | ( | int | type, |
CBotTypResult | elem | ||
) |
Constructor for arrays.
type | type of created result, see CBotType |
elem | type of array elements |
CBot::CBotTypResult::CBotTypResult | ( | const CBotTypResult & | typ | ) |
Copy constructor.
CBot::CBotTypResult::CBotTypResult | ( | ) |
Default constructor.
CBot::CBotTypResult::~CBotTypResult | ( | ) |
Destructor.
int CBot::CBotTypResult::GetType | ( | GetTypeMode | mode = GetTypeMode::NORMAL | ) | const |
void CBot::CBotTypResult::SetType | ( | int | n | ) |
CBotClass * CBot::CBotTypResult::GetClass | ( | ) | const |
Returns CBotClass pointer (for CBotTypClass, CBotTypPointer)
int CBot::CBotTypResult::GetLimite | ( | ) | const |
Get size limit of an array (for CBotTypArrayBody or CBotTypArrayPointer)
void CBot::CBotTypResult::SetLimite | ( | int | n | ) |
Set size limit of an array (for CBotTypArrayBody or CBotTypArrayPointer)
n | new value |
void CBot::CBotTypResult::SetArray | ( | int | max[] | ) |
Set size limit of an multidimensional array.
max | Array of limit values, the array size has to match the number of dimensions of this array |
CBotTypResult & CBot::CBotTypResult::GetTypElem | ( | ) | const |
Get type of array elements (for CBotTypArrayBody or CBotTypArrayPointer)
bool CBot::CBotTypResult::Compare | ( | const CBotTypResult & | typ | ) | const |
Compares whether the types are compatible.
This compares the whole object with another
bool CBot::CBotTypResult::Eq | ( | int | type | ) | const |
Compare type only.
This compares the general "type" part of this object, without checking the additional parameters
CBotTypResult & CBot::CBotTypResult::operator= | ( | const CBotTypResult & | src | ) |
Copy.
std::string CBot::CBotTypResult::ToString | ( | ) |
Get this type name as string.