Colobot
Public Types | Public Member Functions | Friends | List of all members
CBot::CBotTypResult Class Reference

Class to define the complete type of a variable. More...

#include <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...
 
CBotClassGetClass () 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...
 
CBotTypResultGetTypElem () 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...
 
CBotTypResultoperator= (const CBotTypResult &src)
 Copy. More...
 
std::string ToString ()
 Get this type name as string. More...
 

Friends

class CBotVarClass
 
class CBotVarPointer
 

Detailed Description

Class to define the complete type of a variable.

Examples:

// Return a simple "float" variable
// Return an array of "string" variables
// Return an array of "point" class

Member Enumeration Documentation

Mode for GetType()

Constructor & Destructor Documentation

CBot::CBotTypResult::CBotTypResult ( int  type)

Constructor for simple types (CBotTypInt to CBotTypString)

Parameters
typetype of created result, see CBotType. This can also sometimes be a value from CBotError.
CBot::CBotTypResult::CBotTypResult ( int  type,
const std::string &  name 
)

Constructor for pointer types and intrinsic classes.

This is equivalent to calling:

Parameters
typetype of created result, see CBotType
namename of the class
CBot::CBotTypResult::CBotTypResult ( int  type,
CBotClass pClass 
)

Constructor for instance of a class.

Parameters
typetype of created result, see CBotType
pClassclass type
CBot::CBotTypResult::CBotTypResult ( int  type,
CBotTypResult  elem 
)

Constructor for arrays.

Parameters
typetype of created result, see CBotType
elemtype of array elements
CBot::CBotTypResult::CBotTypResult ( const CBotTypResult typ)

Copy constructor.

CBot::CBotTypResult::CBotTypResult ( )

Default constructor.

CBot::CBotTypResult::~CBotTypResult ( )

Destructor.

Member Function Documentation

int CBot::CBotTypResult::GetType ( GetTypeMode  mode = GetTypeMode::NORMAL) const

Returns CBotType or CBotError stored in this object.

Parameters
modeMode, see ::GetTypeMode enum
void CBot::CBotTypResult::SetType ( int  n)

Changes CBotType or CBotError stored in this object.

Parameters
nnew value
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)

Parameters
nnew value
void CBot::CBotTypResult::SetArray ( int  max[])

Set size limit of an multidimensional array.

Parameters
maxArray 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.

Returns
This type name as string

The documentation for this class was generated from the following files: