Fixed const-correctness of getters
parent
3c98af04b5
commit
2ea94244e9
|
@ -355,7 +355,7 @@ CBotTypResult CBotVar::GetTypResult(GetTypeMode mode)
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
CBotType CBotVar::GetType(GetTypeMode mode)
|
||||
CBotType CBotVar::GetType(GetTypeMode mode) const
|
||||
{
|
||||
if ( mode == GetTypeMode::CLASS_AS_POINTER && m_type.Eq(CBotTypClass) )
|
||||
return CBotTypPointer;
|
||||
|
@ -584,43 +584,43 @@ CBotVarClass* CBotVar::GetPointer()
|
|||
// All these functions must be defined in the subclasses
|
||||
// derived from class CBotVar
|
||||
|
||||
signed char CBotVar::GetValByte()
|
||||
signed char CBotVar::GetValByte() const
|
||||
{
|
||||
assert(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
short CBotVar::GetValShort()
|
||||
short CBotVar::GetValShort() const
|
||||
{
|
||||
assert(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t CBotVar::GetValChar()
|
||||
uint32_t CBotVar::GetValChar() const
|
||||
{
|
||||
assert(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CBotVar::GetValInt()
|
||||
int CBotVar::GetValInt() const
|
||||
{
|
||||
assert(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
long CBotVar::GetValLong()
|
||||
long CBotVar::GetValLong() const
|
||||
{
|
||||
assert(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
float CBotVar::GetValFloat()
|
||||
float CBotVar::GetValFloat() const
|
||||
{
|
||||
assert(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
double CBotVar::GetValDouble()
|
||||
double CBotVar::GetValDouble() const
|
||||
{
|
||||
assert(0);
|
||||
return 0;
|
||||
|
@ -822,7 +822,7 @@ void CBotVar::SetValString(const std::string& val)
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
std::string CBotVar::GetValString()
|
||||
std::string CBotVar::GetValString() const
|
||||
{
|
||||
assert(0);
|
||||
return std::string();
|
||||
|
|
|
@ -199,7 +199,7 @@ public:
|
|||
* \brief GetType Returns the base type of the variable (::CBotType)
|
||||
* \param mode Mode, see GetTypeMode enum
|
||||
*/
|
||||
CBotType GetType(GetTypeMode mode = GetTypeMode::NORMAL);
|
||||
CBotType GetType(GetTypeMode mode = GetTypeMode::NORMAL) const;
|
||||
|
||||
/**
|
||||
* \brief Returns the complete type of the variable (CBotTypResult)
|
||||
|
@ -508,27 +508,27 @@ public:
|
|||
*/
|
||||
virtual void SetValString(const std::string& val);
|
||||
|
||||
virtual signed char GetValByte();
|
||||
virtual signed char GetValByte() const;
|
||||
|
||||
virtual short GetValShort();
|
||||
virtual short GetValShort() const;
|
||||
|
||||
virtual uint32_t GetValChar();
|
||||
virtual uint32_t GetValChar() const;
|
||||
|
||||
/**
|
||||
* \brief Get value as integer
|
||||
* \return Current value
|
||||
*/
|
||||
virtual int GetValInt();
|
||||
virtual int GetValInt() const;
|
||||
|
||||
virtual long GetValLong();
|
||||
virtual long GetValLong() const;
|
||||
|
||||
/**
|
||||
* \brief Get value as float
|
||||
* \return Current value
|
||||
*/
|
||||
virtual float GetValFloat();
|
||||
virtual float GetValFloat() const;
|
||||
|
||||
virtual double GetValDouble();
|
||||
virtual double GetValDouble() const;
|
||||
|
||||
/**
|
||||
* \brief Get value as string
|
||||
|
@ -539,7 +539,7 @@ public:
|
|||
*
|
||||
* \return Current value
|
||||
*/
|
||||
virtual std::string GetValString();
|
||||
virtual std::string GetValString() const;
|
||||
|
||||
/**
|
||||
* \brief Set value for pointer types
|
||||
|
|
|
@ -129,7 +129,7 @@ CBotVar* CBotVarArray::GetItemList()
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
std::string CBotVarArray::GetValString()
|
||||
std::string CBotVarArray::GetValString() const
|
||||
{
|
||||
if ( m_pInstance == nullptr ) return ( std::string( "Null pointer" ) ) ;
|
||||
return m_pInstance->GetValString();
|
||||
|
|
|
@ -49,7 +49,7 @@ public:
|
|||
CBotVar* GetItem(int n, bool grow = false) override;
|
||||
CBotVar* GetItemList() override;
|
||||
|
||||
std::string GetValString() override;
|
||||
std::string GetValString() const override;
|
||||
|
||||
bool Save1State(std::ostream &ostr) override;
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ class CBotVarChar : public CBotVarInteger<uint32_t, CBotTypChar>
|
|||
public:
|
||||
CBotVarChar(const CBotToken &name) : CBotVarInteger(name) {}
|
||||
|
||||
std::string GetValString() override
|
||||
std::string GetValString() const override
|
||||
{
|
||||
if (m_binit == CBotVar::InitType::UNDEF)
|
||||
return LoadString(TX_UNDEF);
|
||||
|
|
|
@ -291,7 +291,7 @@ CBotVar* CBotVarClass::GetItemList()
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
std::string CBotVarClass::GetValString()
|
||||
std::string CBotVarClass::GetValString() const
|
||||
{
|
||||
std::string res;
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
CBotVar* GetItemRef(int nIdent) override;
|
||||
CBotVar* GetItem(int n, bool bExtend) override;
|
||||
CBotVar* GetItemList() override;
|
||||
std::string GetValString() override;
|
||||
std::string GetValString() const override;
|
||||
|
||||
bool Save1State(std::ostream &ostr) override;
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ void CBotVarInt::SetValInt(int val, const std::string& defnum)
|
|||
m_defnum = defnum;
|
||||
}
|
||||
|
||||
std::string CBotVarInt::GetValString()
|
||||
std::string CBotVarInt::GetValString() const
|
||||
{
|
||||
if (!m_defnum.empty()) return m_defnum;
|
||||
return CBotVarValue::GetValString();
|
||||
|
|
|
@ -33,7 +33,7 @@ public:
|
|||
CBotVarInt(const CBotToken &name) : CBotVarInteger(name) {}
|
||||
|
||||
void SetValInt(int val, const std::string& s = "") override;
|
||||
std::string GetValString() override;
|
||||
std::string GetValString() const override;
|
||||
|
||||
void Copy(CBotVar* pSrc, bool bName = true) override;
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ CBotVar* CBotVarPointer::GetItemList()
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
std::string CBotVarPointer::GetValString()
|
||||
std::string CBotVarPointer::GetValString() const
|
||||
{
|
||||
std::string s = "Pointer to ";
|
||||
if ( m_pVarClass == nullptr ) s = "Null pointer" ;
|
||||
|
|
|
@ -47,7 +47,7 @@ public:
|
|||
CBotVar* GetItem(const std::string& name) override;
|
||||
CBotVar* GetItemRef(int nIdent) override;
|
||||
CBotVar* GetItemList() override;
|
||||
std::string GetValString() override;
|
||||
std::string GetValString() const override;
|
||||
|
||||
void SetPointer(CBotVar* p) override;
|
||||
CBotVarClass* GetPointer() override;
|
||||
|
|
|
@ -48,12 +48,12 @@ public:
|
|||
SetValString(ToString(val));
|
||||
}
|
||||
|
||||
int GetValInt() override
|
||||
int GetValInt() const override
|
||||
{
|
||||
return FromString<int>(GetValString());
|
||||
}
|
||||
|
||||
float GetValFloat() override
|
||||
float GetValFloat() const override
|
||||
{
|
||||
return FromString<float>(GetValString());
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ public:
|
|||
m_binit = CBotVar::InitType::DEF;
|
||||
}
|
||||
|
||||
std::string GetValString() override
|
||||
std::string GetValString() const override
|
||||
{
|
||||
if (m_binit == CBotVar::InitType::UNDEF)
|
||||
return LoadString(TX_UNDEF);
|
||||
|
@ -133,37 +133,37 @@ public:
|
|||
this->SetValue(static_cast<T>(val));
|
||||
}
|
||||
|
||||
signed char GetValByte() override
|
||||
signed char GetValByte() const override
|
||||
{
|
||||
return static_cast<signed char>(this->m_val);
|
||||
}
|
||||
|
||||
short GetValShort() override
|
||||
short GetValShort() const override
|
||||
{
|
||||
return static_cast<short>(this->m_val);
|
||||
}
|
||||
|
||||
uint32_t GetValChar() override
|
||||
uint32_t GetValChar() const override
|
||||
{
|
||||
return static_cast<uint32_t>(this->m_val);
|
||||
}
|
||||
|
||||
int GetValInt() override
|
||||
int GetValInt() const override
|
||||
{
|
||||
return static_cast<int>(this->m_val);
|
||||
}
|
||||
|
||||
long GetValLong() override
|
||||
long GetValLong() const override
|
||||
{
|
||||
return static_cast<long>(this->m_val);
|
||||
}
|
||||
|
||||
float GetValFloat() override
|
||||
float GetValFloat() const override
|
||||
{
|
||||
return static_cast<float>(this->m_val);
|
||||
}
|
||||
|
||||
double GetValDouble() override
|
||||
double GetValDouble() const override
|
||||
{
|
||||
return static_cast<double>(this->m_val);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue