Colobot
CBotVarString.h
1 /*
2  * This file is part of the Colobot: Gold Edition source code
3  * Copyright (C) 2001-2016, Daniel Roux, EPSITEC SA & TerranovaTeam
4  * http://epsitec.ch; http://colobot.info; http://github.com/colobot
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14  * See the GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see http://gnu.org/licenses
18  */
19 
20 #pragma once
21 
22 #include "CBot/CBotVar/CBotVar.h"
23 
24 namespace CBot
25 {
26 
30 class CBotVarString : public CBotVar
31 {
32 public:
36  CBotVarString(const CBotToken& name);
37 
38  void SetValString(const std::string& val) override;
39  std::string GetValString() override;
40 
41  void Copy(CBotVar* pSrc, bool bName = true) override;
42 
43  void Add(CBotVar* left, CBotVar* right) override;
44 
45  bool Lo(CBotVar* left, CBotVar* right) override;
46  bool Hi(CBotVar* left, CBotVar* right) override;
47  bool Ls(CBotVar* left, CBotVar* right) override;
48  bool Hs(CBotVar* left, CBotVar* right) override;
49  bool Eq(CBotVar* left, CBotVar* right) override;
50  bool Ne(CBotVar* left, CBotVar* right) override;
51 
52  bool Save1State(FILE* pf) override;
53 
54 private:
56  std::string m_val;
57 };
58 
59 } // namespace CBot
void Copy(CBotVar *pSrc, bool bName=true) override
Copy from another variable.
Definition: CBotVarString.cpp:47
void Add(CBotVar *left, CBotVar *right) override
Addition.
Definition: CBotVarString.cpp:87
bool Save1State(FILE *pf) override
Save variable data.
Definition: CBotVarString.cpp:130
void SetValString(const std::string &val) override
Set value as string.
Definition: CBotVarString.cpp:65
bool Eq(CBotVar *left, CBotVar *right) override
left == right
Definition: CBotVarString.cpp:94
A CBot variable.
Definition: CBotVar.h:42
std::string GetValString() override
Get value as string.
Definition: CBotVarString.cpp:72
bool Hi(CBotVar *left, CBotVar *right) override
left > right
Definition: CBotVarString.cpp:112
bool Hs(CBotVar *left, CBotVar *right) override
left >= right
Definition: CBotVarString.cpp:124
bool Lo(CBotVar *left, CBotVar *right) override
left < right
Definition: CBotVarString.cpp:106
CBotVar subclass for managing string values (CBotTypString)
Definition: CBotVarString.h:30
bool Ls(CBotVar *left, CBotVar *right) override
left <= right
Definition: CBotVarString.cpp:118
CBot engine.
Definition: CBotCallMethode.cpp:28
bool Ne(CBotVar *left, CBotVar *right) override
left != right
Definition: CBotVarString.cpp:100
CBotVarString(const CBotToken &name)
Constructor. Do not call directly, use CBotVar::Create()
Definition: CBotVarString.cpp:30
Class representing one token of a program.
Definition: CBotToken.h:80