Documentation for CBotVar and all subclasses

dev-time-step
krzys-h 2015-12-22 15:59:57 +01:00
parent 2519825104
commit 33ac246297
15 changed files with 639 additions and 1275 deletions

View File

@ -554,7 +554,7 @@ INLINE_INFO = YES
# name. If set to NO, the members will appear in declaration order. # name. If set to NO, the members will appear in declaration order.
# The default value is: YES. # The default value is: YES.
SORT_MEMBER_DOCS = YES SORT_MEMBER_DOCS = NO
# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
# descriptions of file, namespace and class members alphabetically by member # descriptions of file, namespace and class members alphabetically by member

View File

@ -122,12 +122,12 @@ public:
bool Compile(const std::string& program, std::vector<std::string>& functions, void* pUser = nullptr); bool Compile(const std::string& program, std::vector<std::string>& functions, void* pUser = nullptr);
/** /**
* \brief Associates an identifier with this instance of CBotProgram * \brief Associates an unique identifier with this instance of CBotProgram
*/ */
void SetIdent(long n); void SetIdent(long n);
/** /**
* \brief Returns the identifier * \brief Returns the unique identifier
* \see SetIdent * \see SetIdent
*/ */
long GetIdent(); long GetIdent();

View File

@ -126,7 +126,6 @@ public:
/** /**
* \brief Get type of array elements (for ::CBotTypArrayBody or ::CBotTypArrayPointer) * \brief Get type of array elements (for ::CBotTypArrayBody or ::CBotTypArrayPointer)
* \param n new value
*/ */
CBotTypResult& GetTypElem() const; CBotTypResult& GetTypElem() const;

View File

@ -32,6 +32,7 @@
#include "CBot/CBotVar/CBotVarInt.h" #include "CBot/CBotVar/CBotVarInt.h"
#include "CBot/CBotClass.h" #include "CBot/CBotClass.h"
#include "CBot/CBotToken.h"
#include "CBot/CBotEnums.h" #include "CBot/CBotEnums.h"
@ -136,7 +137,7 @@ void CBotVar::Maj(void* pUser, bool bContinu)
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
CBotVar* CBotVar::Create(const CBotToken* name, int type ) CBotVar* CBotVar::Create(const CBotToken* name, CBotType type )
{ {
CBotTypResult t(type); CBotTypResult t(type);
return Create(name, t); return Create(name, t);
@ -269,7 +270,7 @@ CBotVar* CBotVar::Create(const std::string& n, CBotTypResult type)
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
CBotVar* CBotVar::Create(const std::string& name, int type, CBotClass* pClass) CBotVar* CBotVar::Create(const std::string& name, CBotType type, CBotClass* pClass)
{ {
CBotToken token( name, "" ); CBotToken token( name, "" );
CBotVar* pVar = Create( &token, type ); CBotVar* pVar = Create( &token, type );
@ -319,13 +320,13 @@ CBotTypResult CBotVar::GetTypResult(int mode)
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
int CBotVar::GetType(int mode) CBotType CBotVar::GetType(int mode)
{ {
if ( mode == 1 && m_type.Eq(CBotTypClass) ) if ( mode == 1 && m_type.Eq(CBotTypClass) )
return CBotTypPointer; return CBotTypPointer;
if ( mode == 2 && m_type.Eq(CBotTypClass) ) if ( mode == 2 && m_type.Eq(CBotTypClass) )
return CBotTypIntrinsic; return CBotTypIntrinsic;
return m_type.GetType(); return static_cast<CBotType>(m_type.GetType());
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -343,12 +344,12 @@ CBotVar::InitType CBotVar::GetInit() const
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void CBotVar::SetInit(CBotVar::InitType bInit) void CBotVar::SetInit(CBotVar::InitType initType)
{ {
m_binit = bInit; m_binit = initType;
if ( bInit == CBotVar::InitType::IS_POINTER ) m_binit = CBotVar::InitType::DEF; // cas spécial if (initType == CBotVar::InitType::IS_POINTER ) m_binit = CBotVar::InitType::DEF; // cas spécial
if ( m_type.Eq(CBotTypPointer) && bInit == CBotVar::InitType::IS_POINTER ) if ( m_type.Eq(CBotTypPointer) && initType == CBotVar::InitType::IS_POINTER )
{ {
CBotVarClass* instance = GetPointer(); CBotVarClass* instance = GetPointer();
if ( instance == nullptr ) if ( instance == nullptr )
@ -365,7 +366,7 @@ void CBotVar::SetInit(CBotVar::InitType bInit)
CBotVar* p = (static_cast<CBotVarClass*>(this))->m_pVar; CBotVar* p = (static_cast<CBotVarClass*>(this))->m_pVar;
while( p != nullptr ) while( p != nullptr )
{ {
p->SetInit( bInit ); p->SetInit(initType);
p->m_pMyThis = static_cast<CBotVarClass*>(this); p->m_pMyThis = static_cast<CBotVarClass*>(this);
p = p->GetNext(); p = p->GetNext();
} }
@ -412,7 +413,7 @@ CBotVar* CBotVar::GetItemList()
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
CBotVar* CBotVar::GetItem(int row, bool bGrow) CBotVar* CBotVar::GetItem(int index, bool grow)
{ {
assert(0); assert(0);
return nullptr; return nullptr;
@ -521,9 +522,9 @@ bool CBotVar::IsStatic()
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
bool CBotVar::IsPrivate(ProtectionLevel mode) bool CBotVar::IsPrivate(ProtectionLevel level)
{ {
return static_cast<int>(m_mPrivate) >= static_cast<int>(mode); return static_cast<int>(m_mPrivate) >= static_cast<int>(level);
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -720,7 +721,7 @@ void CBotVar::Copy(CBotVar* pSrc, bool bName)
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void CBotVar::SetValString(const std::string& p) void CBotVar::SetValString(const std::string& val)
{ {
assert(0); assert(0);
} }

File diff suppressed because it is too large Load Diff

View File

@ -19,85 +19,38 @@
#pragma once #pragma once
// Modules inlcude
#include "CBot/CBotDefines.h"
#include "CBot/CBotVar/CBotVar.h" #include "CBot/CBotVar/CBotVar.h"
// Local include /**
* \brief CBotVar subclass for managing arrays (::CBotTypArrayPointer)
// Global include *
* Uses CBotVarClass for storing data internally
/*!
* \brief The CBotVarArray class Classe pour les tableaux.
*/ */
class CBotVarArray : public CBotVar class CBotVarArray : public CBotVar
{ {
public: public:
/**
/*! * \brief Constructor. Do not call directly, use CBotVar::Create()
* \brief CBotVarArray
* \param name
* \param type
*/ */
CBotVarArray( const CBotToken* name, CBotTypResult& type ); CBotVarArray(const CBotToken* name, CBotTypResult& type);
/**
/*! * \brief Destructor. Do not call directly, use CBotVar::Destroy()
* \brief ~CBotVarArray
*/ */
~CBotVarArray(); ~CBotVarArray();
/*!
* \brief SetPointer
* \param p
*/
void SetPointer(CBotVar* p) override; void SetPointer(CBotVar* p) override;
/*!
* \brief GetPointer
* \return
*/
CBotVarClass* GetPointer() override; CBotVarClass* GetPointer() override;
/*! void Copy(CBotVar* pSrc, bool bName = true) override;
* \brief Copy Copy a variable into another.
* \param pSrc
* \param bName
*/
void Copy(CBotVar* pSrc, bool bName=true) override;
/*! CBotVar* GetItem(int n, bool grow = false) override;
* \brief GetItem Makes an element according to its numeric index enlarged
* the table if necessary if bExtend.
* \param n
* \param bGrow
* \return
*/
CBotVar* GetItem(int n, bool bGrow=false) override;
/*!
* \brief GetItemList Gives the first item in the list.
* \return
*/
CBotVar* GetItemList() override; CBotVar* GetItemList() override;
/*!
* \brief GetValString Gets the contents of the array into a string.
* \return
*/
std::string GetValString() override; std::string GetValString() override;
/*!
* \brief Save1State
* \param pf
* \return
*/
bool Save1State(FILE* pf) override; bool Save1State(FILE* pf) override;
private: private:
//! Instance manager of table. //! Array data
CBotVarClass* m_pInstance; CBotVarClass* m_pInstance;
//! My daddy is a buddy.
friend class CBotVar;
}; };

View File

@ -17,16 +17,13 @@
* along with this program. If not, see http://gnu.org/licenses * along with this program. If not, see http://gnu.org/licenses
*/ */
// Modules inlcude
#include "CBot/CBotVar/CBotVarBoolean.h" #include "CBot/CBotVar/CBotVarBoolean.h"
#include "CBot/CBotEnums.h" #include "CBot/CBotEnums.h"
#include "CBot/CBotUtils.h" #include "CBot/CBotUtils.h"
#include "CBot/CBotKeywordStrings.h" #include "CBot/CBotKeywordStrings.h"
// Local include #include "CBot/CBotToken.h"
// Global include
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View File

@ -19,114 +19,35 @@
#pragma once #pragma once
// Modules inlcude
#include "CBot/CBotToken.h"
#include "CBot/CBotVar/CBotVar.h" #include "CBot/CBotVar/CBotVar.h"
// Local include /**
* \brief CBotVar subclass for managing boolean values (::CBotTypBoolean)
// Global include
/*!
* \brief The CBotVarBoolean class Class for the management of boolean.
*/ */
class CBotVarBoolean : public CBotVar class CBotVarBoolean : public CBotVar
{ {
public: public:
/**
/*! * \brief Constructor. Do not call directly, use CBotVar::Create()
* \brief CBotVarBoolean
* \param name
*/ */
CBotVarBoolean( const CBotToken* name ); CBotVarBoolean(const CBotToken* name);
/*!
* \brief SetValInt
* \param val
* \param s
*/
void SetValInt(int val, const std::string& s = nullptr) override; void SetValInt(int val, const std::string& s = nullptr) override;
/*!
* \brief SetValFloat
* \param val
*/
void SetValFloat(float val) override; void SetValFloat(float val) override;
/*!
* \brief GetValInt
* \return
*/
int GetValInt() override; int GetValInt() override;
/*!
* \brief GetValFloat
* \return
*/
float GetValFloat() override; float GetValFloat() override;
/*!
* \brief GetValString
* \return
*/
std::string GetValString() override; std::string GetValString() override;
/*! void Copy(CBotVar* pSrc, bool bName = true) override;
* \brief Copy Copy a variable into another.
* \param pSrc
* \param bName
*/
void Copy(CBotVar* pSrc, bool bName=true) override;
/*!
* \brief And
* \param left
* \param right
*/
void And(CBotVar* left, CBotVar* right) override; void And(CBotVar* left, CBotVar* right) override;
/*!
* \brief Or
* \param left
* \param right
*/
void Or(CBotVar* left, CBotVar* right) override; void Or(CBotVar* left, CBotVar* right) override;
/*!
* \brief XOr
* \param left
* \param right
*/
void XOr(CBotVar* left, CBotVar* right) override; void XOr(CBotVar* left, CBotVar* right) override;
/*!
* \brief Not
*/
void Not() override; void Not() override;
/*!
* \brief Eq
* \param left
* \param right
* \return
*/
bool Eq(CBotVar* left, CBotVar* right) override; bool Eq(CBotVar* left, CBotVar* right) override;
/*!
* \brief Ne
* \param left
* \param right
* \return
*/
bool Ne(CBotVar* left, CBotVar* right) override; bool Ne(CBotVar* left, CBotVar* right) override;
/*!
* \brief Save1State
* \param pf
* \return
*/
bool Save1State(FILE* pf) override; bool Save1State(FILE* pf) override;
private: private:

View File

@ -159,13 +159,6 @@ void CBotVarClass::Copy(CBotVar* pSrc, bool bName)
} }
} }
////////////////////////////////////////////////////////////////////////////////
void CBotVarClass::SetItemList(CBotVar* pVar)
{
delete m_pVar;
m_pVar = pVar; // replaces the existing pointer
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void CBotVarClass::SetIdent(long n) void CBotVarClass::SetIdent(long n)
{ {

View File

@ -19,175 +19,94 @@
#pragma once #pragma once
// Modules inlcude
#include "CBot/CBotVar/CBotVar.h" #include "CBot/CBotVar/CBotVar.h"
// Local include /**
* \brief CBotVar subclass for managing classes (::CBotTypClass, ::CBotTypIntrinsic)
// Global include *
* \nosubgrouping
/*!
* \brief The CBotVarClass class Class management class instances.
*/ */
class CBotVarClass : public CBotVar class CBotVarClass : public CBotVar
{ {
public: public:
/**
/*! * \brief Constructor. Do not call directly, use CBotVar::Create()
* \brief CBotVarClass
* \param name
* \param type
*/ */
CBotVarClass( const CBotToken* name, const CBotTypResult& type ); CBotVarClass(const CBotToken* name, const CBotTypResult& type);
/**
/*! * \brief Destructor. Do not call directly, use CBotVar::Destroy()
* \brief ~CBotVarClass
*/ */
~CBotVarClass(); ~CBotVarClass();
/*! void Copy(CBotVar* pSrc, bool bName = true) override;
* \brief Copy Copy a variable into another.
* \param pSrc
* \param bName
*/
void Copy(CBotVar* pSrc, bool bName=true) override;
/*!
* \brief SetClass
* \param pClass
*/
void SetClass(CBotClass* pClass) override; void SetClass(CBotClass* pClass) override;
/*!
* \brief GetClass
* \return
*/
CBotClass* GetClass() override; CBotClass* GetClass() override;
/*!
* \brief GetItem Return an element of a class according to its name (*).
* \param name
* \return
*/
CBotVar* GetItem(const std::string& name) override; CBotVar* GetItem(const std::string& name) override;
/*!
* \brief GetItemRef
* \param nIdent
* \return
*/
CBotVar* GetItemRef(int nIdent) override; CBotVar* GetItemRef(int nIdent) override;
/*!
* \brief GetItem For the management of an array.
* \param n
* \param bExtend can enlarge the table, but not beyond the threshold size
* of SetArray().
* \return
*/
CBotVar* GetItem(int n, bool bExtend) override; CBotVar* GetItem(int n, bool bExtend) override;
/*!
* \brief GetItemList
* \return
*/
CBotVar* GetItemList() override; CBotVar* GetItemList() override;
/*!
* \brief GetValString
* \return
*/
std::string GetValString() override; std::string GetValString() override;
/*!
* \brief Save1State
* \param pf
* \return
*/
bool Save1State(FILE* pf) override; bool Save1State(FILE* pf) override;
/*!
* \brief Maj
* \param pUser
* \param bContinue
*/
void Maj(void* pUser, bool bContinue) override; void Maj(void* pUser, bool bContinue) override;
/*! //! \name Reference counter
* \brief IncrementUse A reference to incrementation. //@{
/**
* \brief Increment reference counter
*/ */
void IncrementUse(); void IncrementUse();
/*! /**
* \brief DecrementUse A reference to decrementation. * \brief Decrement reference counter
*/ */
void DecrementUse(); void DecrementUse();
/*! //@}
* \brief GetPointer
* \return
*/
CBotVarClass* GetPointer() override; CBotVarClass* GetPointer() override;
/*! //! \name Unique instance identifier
* \brief SetItemList //@{
* \param pVar
*/
void SetItemList(CBotVar* pVar);
/*!
* \brief SetIdent
* \param n
*/
void SetIdent(long n) override; void SetIdent(long n) override;
/*! /*!
* \brief Find Makes an instance according to its unique number. * \brief Finds a class instance by unique identifier
* \param id * \param id Identifier to find
* \return * \return Found class instance
*/ */
static CBotVarClass* Find(long id); static CBotVarClass* Find(long id);
/*! //@}
* \brief Eq
* \param left
* \param right
* \return
*/
bool Eq(CBotVar* left, CBotVar* right) override;
/*! bool Eq(CBotVar* left, CBotVar* right) override;
* \brief Ne
* \param left
* \param right
* \return
*/
bool Ne(CBotVar* left, CBotVar* right) override; bool Ne(CBotVar* left, CBotVar* right) override;
/*!
* \brief ConstructorSet
*/
void ConstructorSet() override; void ConstructorSet() override;
private: private:
//! List of existing instances at some point. //! Doubly linked list of all class instances - first
static CBotVarClass* m_ExClass; static CBotVarClass* m_ExClass;
//! For this general list. //! Doubly linked list of all class instances - next
CBotVarClass* m_ExNext; CBotVarClass* m_ExNext;
//! For this general list. //! Doubly linked list of all class instances - previous
CBotVarClass* m_ExPrev; CBotVarClass* m_ExPrev;
//! The class definition. //! Class definition
CBotClass* m_pClass; CBotClass* m_pClass;
//! The instance of a parent class. //! Parent class instance
CBotVarClass* m_pParent; CBotVarClass* m_pParent;
//! Contents. //! Class members
CBotVar* m_pVar; CBotVar* m_pVar;
//! Counter usage. //! Reference counter
int m_CptUse; int m_CptUse;
//! Identifier (unique) of an instance. //! Identifier (unique) of an instance
long m_ItemIdent; long m_ItemIdent;
//! Set if a constructor has been called. //! Set after constructor is called, allows destructor to be called
bool m_bConstructor; bool m_bConstructor;
friend class CBotVar; friend class CBotVar;

View File

@ -19,178 +19,45 @@
#pragma once #pragma once
// Modules inlcude
#include <CBot/CBotEnums.h>
#include "CBot/CBotVar/CBotVar.h" #include "CBot/CBotVar/CBotVar.h"
// Local include /**
* \brief CBotVar subclass for managing float values (::CBotTypFloat)
// Global include
/*!
* \brief The CBotVarFloat class Class for managing real numbers (float).
*/ */
class CBotVarFloat : public CBotVar class CBotVarFloat : public CBotVar
{ {
public: public:
/**
/*! * \brief Constructor. Do not call directly, use CBotVar::Create()
* \brief CBotVarFloat
* \param name
*/ */
CBotVarFloat( const CBotToken* name ); CBotVarFloat(const CBotToken* name);
/*!
* \brief SetValInt
* \param val
* \param s
*/
void SetValInt(int val, const std::string& s = nullptr) override; void SetValInt(int val, const std::string& s = nullptr) override;
/*!
* \brief SetValFloat
* \param val
*/
void SetValFloat(float val) override; void SetValFloat(float val) override;
/*!
* \brief GetValInt
* \return
*/
int GetValInt() override; int GetValInt() override;
/*!
* \brief GetValFloat
* \return
*/
float GetValFloat() override; float GetValFloat() override;
/*!
* \brief GetValString
* \return
*/
std::string GetValString() override; std::string GetValString() override;
/*! void Copy(CBotVar* pSrc, bool bName = true) override;
* \brief Copy Copy a variable into another.
* \param pSrc
* \param bName
*/
void Copy(CBotVar* pSrc, bool bName=true) override;
/*!
* \brief Add Addition.
* \param left
* \param right
*/
void Add(CBotVar* left, CBotVar* right) override; void Add(CBotVar* left, CBotVar* right) override;
/*!
* \brief Sub Substraction.
* \param left
* \param right
*/
void Sub(CBotVar* left, CBotVar* right) override; void Sub(CBotVar* left, CBotVar* right) override;
/*!
* \brief Mul Multiplication.
* \param left
* \param right
*/
void Mul(CBotVar* left, CBotVar* right) override; void Mul(CBotVar* left, CBotVar* right) override;
/*!
* \brief Div Division.
* \param left
* \param right
* \return
*/
CBotError Div(CBotVar* left, CBotVar* right) override; CBotError Div(CBotVar* left, CBotVar* right) override;
/*!
* \brief Modulo Remainder of division.
* \param left
* \param right
* \return
*/
CBotError Modulo(CBotVar* left, CBotVar* right) override; CBotError Modulo(CBotVar* left, CBotVar* right) override;
/*!
* \brief Power
* \param left
* \param right
*/
void Power(CBotVar* left, CBotVar* right) override; void Power(CBotVar* left, CBotVar* right) override;
/*!
* \brief Lo
* \param left
* \param right
* \return
*/
bool Lo(CBotVar* left, CBotVar* right) override; bool Lo(CBotVar* left, CBotVar* right) override;
/*!
* \brief Hi
* \param left
* \param right
* \return
*/
bool Hi(CBotVar* left, CBotVar* right) override; bool Hi(CBotVar* left, CBotVar* right) override;
/*!
* \brief Ls
* \param left
* \param right
* \return
*/
bool Ls(CBotVar* left, CBotVar* right) override; bool Ls(CBotVar* left, CBotVar* right) override;
/*!
* \brief Hs
* \param left
* \param right
* \return
*/
bool Hs(CBotVar* left, CBotVar* right) override; bool Hs(CBotVar* left, CBotVar* right) override;
/*!
* \brief Eq
* \param left
* \param right
* \return
*/
bool Eq(CBotVar* left, CBotVar* right) override; bool Eq(CBotVar* left, CBotVar* right) override;
/*!
* \brief Ne
* \param left
* \param right
* \return
*/
bool Ne(CBotVar* left, CBotVar* right) override; bool Ne(CBotVar* left, CBotVar* right) override;
/*!
* \brief Neg
*/
void Neg() override; void Neg() override;
/*!
* \brief Inc
*/
void Inc() override; void Inc() override;
/*!
* \brief Dec
*/
void Dec() override; void Dec() override;
/*!
* \brief Save1State
* \param pf
* \return
*/
bool Save1State(FILE* pf) override; bool Save1State(FILE* pf) override;
private: private:

View File

@ -19,232 +19,55 @@
#pragma once #pragma once
// Modules inlcude
#include <CBot/CBotEnums.h>
#include "CBot/CBotVar/CBotVar.h" #include "CBot/CBotVar/CBotVar.h"
// Local include /**
* \brief CBotVar subclass for managing integer values (::CBotTypInt)
// Global include
/*!
* \brief The CBotVarInt class Class for the management of integer numbers (int).
*/ */
class CBotVarInt : public CBotVar class CBotVarInt : public CBotVar
{ {
public: public:
/**
/*! * \brief Constructor. Do not call directly, use CBotVar::Create()
* \brief CBotVarInt
* \param name
*/ */
CBotVarInt( const CBotToken* name ); CBotVarInt(const CBotToken* name);
/*! void SetValInt(int val, const std::string& s = "") override;
* \brief SetValInt
* \param val
* \param s
*/
void SetValInt(int val, const std::string& s = nullptr) override;
/*!
* \brief SetValFloat
* \param val
*/
void SetValFloat(float val) override; void SetValFloat(float val) override;
/*!
* \brief GetValInt
* \return
*/
int GetValInt() override; int GetValInt() override;
/*!
* \brief GetValFloat
* \return
*/
float GetValFloat() override; float GetValFloat() override;
/*!
* \brief GetValString
* \return
*/
std::string GetValString() override; std::string GetValString() override;
/*! void Copy(CBotVar* pSrc, bool bName = true) override;
* \brief Copy Copy a variable in to another.
* \param pSrc
* \param bName
*/
void Copy(CBotVar* pSrc, bool bName=true) override;
/*!
* \brief Add
* \param left
* \param right
*/
void Add(CBotVar* left, CBotVar* right) override; void Add(CBotVar* left, CBotVar* right) override;
/*!
* \brief Sub
* \param left
* \param right
*/
void Sub(CBotVar* left, CBotVar* right) override; void Sub(CBotVar* left, CBotVar* right) override;
/*!
* \brief Mul
* \param left
* \param right
*/
void Mul(CBotVar* left, CBotVar* right) override; void Mul(CBotVar* left, CBotVar* right) override;
/*!
* \brief Div
* \param left
* \param right
* \return
*/
CBotError Div(CBotVar* left, CBotVar* right) override; CBotError Div(CBotVar* left, CBotVar* right) override;
/*!
* \brief Modulo
* \param left
* \param right
* \return
*/
CBotError Modulo(CBotVar* left, CBotVar* right) override; CBotError Modulo(CBotVar* left, CBotVar* right) override;
/*!
* \brief Power
* \param left
* \param right
*/
void Power(CBotVar* left, CBotVar* right) override; void Power(CBotVar* left, CBotVar* right) override;
/*!
* \brief Lo
* \param left
* \param right
* \return
*/
bool Lo(CBotVar* left, CBotVar* right) override; bool Lo(CBotVar* left, CBotVar* right) override;
/*!
* \brief Hi
* \param left
* \param right
* \return
*/
bool Hi(CBotVar* left, CBotVar* right) override; bool Hi(CBotVar* left, CBotVar* right) override;
/*!
* \brief Ls
* \param left
* \param right
* \return
*/
bool Ls(CBotVar* left, CBotVar* right) override; bool Ls(CBotVar* left, CBotVar* right) override;
/*!
* \brief Hs
* \param left
* \param right
* \return
*/
bool Hs(CBotVar* left, CBotVar* right) override; bool Hs(CBotVar* left, CBotVar* right) override;
/*!
* \brief Eq
* \param left
* \param right
* \return
*/
bool Eq(CBotVar* left, CBotVar* right) override; bool Eq(CBotVar* left, CBotVar* right) override;
/*!
* \brief Ne
* \param left
* \param right
* \return
*/
bool Ne(CBotVar* left, CBotVar* right) override; bool Ne(CBotVar* left, CBotVar* right) override;
/*!
* \brief XOr
* \param left
* \param right
*/
void XOr(CBotVar* left, CBotVar* right) override; void XOr(CBotVar* left, CBotVar* right) override;
/*!
* \brief Or
* \param left
* \param right
*/
void Or(CBotVar* left, CBotVar* right) override; void Or(CBotVar* left, CBotVar* right) override;
/*!
* \brief And
* \param left
* \param right
*/
void And(CBotVar* left, CBotVar* right) override; void And(CBotVar* left, CBotVar* right) override;
/*!
* \brief SL
* \param left
* \param right
*/
void SL(CBotVar* left, CBotVar* right) override;
/*!
* \brief SR
* \param left
* \param right
*/
void SR(CBotVar* left, CBotVar* right) override;
/*!
* \brief ASR
* \param left
* \param right
*/
void ASR(CBotVar* left, CBotVar* right) override;
/*!
* \brief Neg
*/
void Neg() override;
/*!
* \brief Not
*/
void Not() override; void Not() override;
/*! void SL(CBotVar* left, CBotVar* right) override;
* \brief Inc void SR(CBotVar* left, CBotVar* right) override;
*/ void ASR(CBotVar* left, CBotVar* right) override;
void Inc() override;
/*! void Neg() override;
* \brief Dec void Inc() override;
*/
void Dec() override; void Dec() override;
/*!
* \brief Save0State
* \param pf
* \return
*/
bool Save0State(FILE* pf) override; bool Save0State(FILE* pf) override;
/*!
* \brief Save1State
* \param pf
* \return
*/
bool Save1State(FILE* pf) override; bool Save1State(FILE* pf) override;
private: private:

View File

@ -19,142 +19,56 @@
#pragma once #pragma once
// Modules inlcude
#include "CBot/CBotVar/CBotVar.h" #include "CBot/CBotVar/CBotVar.h"
// Local include /**
* \brief CBotVar subclass for managing pointers to classes (::CBotTypPointer)
// Global include
/*!
* \brief The CBotVarPointer class Class for the management of pointers to a
* class instances.
*/ */
class CBotVarPointer : public CBotVar class CBotVarPointer : public CBotVar
{ {
public: public:
/**
/*! * \brief Constructor. Do not call directly, use CBotVar::Create()
* \brief CBotVarPointer
* \param name
* \param type
*/ */
CBotVarPointer( const CBotToken* name, CBotTypResult& type ); CBotVarPointer(const CBotToken* name, CBotTypResult& type);
/**
/*! * \brief Destructor. Do not call directly, use CBotVar::Destroy()
* \brief ~CBotVarPointer
*/ */
~CBotVarPointer(); ~CBotVarPointer();
/*! void Copy(CBotVar* pSrc, bool bName = true) override;
* \brief Copy Copy a variable into another.
* \param pSrc
* \param bName
*/
void Copy(CBotVar* pSrc, bool bName=true) override;
/*!
* \brief SetClass
* \param pClass
*/
void SetClass(CBotClass* pClass) override; void SetClass(CBotClass* pClass) override;
/*!
* \brief GetClass
* \return
*/
CBotClass* GetClass() override; CBotClass* GetClass() override;
/*!
* \brief GetItem Return an element of a class according to its name (*).
* \param name
* \return
*/
CBotVar* GetItem(const std::string& name) override; CBotVar* GetItem(const std::string& name) override;
/*!
* \brief GetItemRef
* \param nIdent
* \return
*/
CBotVar* GetItemRef(int nIdent) override; CBotVar* GetItemRef(int nIdent) override;
/*!
* \brief GetItemList
* \return
*/
CBotVar* GetItemList() override; CBotVar* GetItemList() override;
/*!
* \brief GetValString
* \return
*/
std::string GetValString() override; std::string GetValString() override;
/*!
* \brief SetPointer Initializes the pointer to the instance of a class.
* \param p
*/
void SetPointer(CBotVar* p) override; void SetPointer(CBotVar* p) override;
/*!
* \brief GetPointer
* \return
*/
CBotVarClass* GetPointer() override; CBotVarClass* GetPointer() override;
/*!
* \brief SetIdent Associates an identification number (unique).
* \param n
*/
void SetIdent(long n) override; void SetIdent(long n) override;
/**
/*! * \brief Returns the unique instance identifier
* \brief GetIdent Gives the identification number associated with. * \see SetIdent()
* \return
*/ */
long GetIdent(); long GetIdent();
/*!
* \brief ConstructorSet
*/
void ConstructorSet() override; void ConstructorSet() override;
/*!
* \brief Save1State
* \param pf
* \return
*/
bool Save1State(FILE* pf) override; bool Save1State(FILE* pf) override;
/*!
* \brief Maj
* \param pUser
* \param bContinue
*/
void Maj(void* pUser, bool bContinue) override; void Maj(void* pUser, bool bContinue) override;
/*!
* \brief Eq
* \param left
* \param right
* \return
*/
bool Eq(CBotVar* left, CBotVar* right) override; bool Eq(CBotVar* left, CBotVar* right) override;
/*!
* \brief Ne
* \param left
* \param right
* \return
*/
bool Ne(CBotVar* left, CBotVar* right) override; bool Ne(CBotVar* left, CBotVar* right) override;
private: private:
//! Contents. //! Class pointed to
CBotVarClass* m_pVarClass; CBotVarClass* m_pVarClass;
//! Class provided for this pointer. //! Class type
CBotClass* m_pClass; CBotClass* m_pClass;
friend class CBotVar; friend class CBotVar;
}; };

View File

@ -65,9 +65,9 @@ void CBotVarString::Copy(CBotVar* pSrc, bool bName)
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void CBotVarString::SetValString(const std::string& p) void CBotVarString::SetValString(const std::string& val)
{ {
m_val = p; m_val = val;
m_binit = CBotVar::InitType::DEF; m_binit = CBotVar::InitType::DEF;
} }

View File

@ -19,106 +19,33 @@
#pragma once #pragma once
// Modules inlcude
#include "CBot/CBotVar/CBotVar.h" #include "CBot/CBotVar/CBotVar.h"
// Local include /**
* \brief CBotVar subclass for managing string values (::CBotTypString)
// Global include
/*!
* \brief The CBotVarString class Class for management of strings (String).
*/ */
class CBotVarString : public CBotVar class CBotVarString : public CBotVar
{ {
public: public:
/**
/*! * \brief Constructor. Do not call directly, use CBotVar::Create()
* \brief CBotVarString
* \param name
*/ */
CBotVarString( const CBotToken* name ); CBotVarString(const CBotToken* name);
/*! void SetValString(const std::string& val) override;
* \brief SetValString
* \param p
*/
void SetValString(const std::string& p) override;
/*!
* \brief GetValString
* \return
*/
std::string GetValString() override; std::string GetValString() override;
/*! void Copy(CBotVar* pSrc, bool bName = true) override;
* \brief Copy Copy a variable into another.
* \param pSrc
* \param bName
*/
void Copy(CBotVar* pSrc, bool bName=true) override;
/*!
* \brief Add
* \param left
* \param right
*/
void Add(CBotVar* left, CBotVar* right) override; void Add(CBotVar* left, CBotVar* right) override;
/*!
* \brief Lo
* \param left
* \param right
* \return
*/
bool Lo(CBotVar* left, CBotVar* right) override; bool Lo(CBotVar* left, CBotVar* right) override;
/*!
* \brief Hi
* \param left
* \param right
* \return
*/
bool Hi(CBotVar* left, CBotVar* right) override; bool Hi(CBotVar* left, CBotVar* right) override;
/*!
* \brief Ls
* \param left
* \param right
* \return
*/
bool Ls(CBotVar* left, CBotVar* right) override; bool Ls(CBotVar* left, CBotVar* right) override;
/*!
* \brief Hs
* \param left
* \param right
* \return
*/
bool Hs(CBotVar* left, CBotVar* right) override; bool Hs(CBotVar* left, CBotVar* right) override;
/*!
* \brief Eq
* \param left
* \param right
* \return
*/
bool Eq(CBotVar* left, CBotVar* right) override; bool Eq(CBotVar* left, CBotVar* right) override;
/*!
* \brief Ne
* \param left
* \param right
* \return
*/
bool Ne(CBotVar* left, CBotVar* right) override; bool Ne(CBotVar* left, CBotVar* right) override;
/*!
* \brief Save1State
* \param pf
* \return
*/
bool Save1State(FILE* pf) override; bool Save1State(FILE* pf) override;
private: private: