Colobot
CBotCallMethode.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/CBotTypResult.h"
23 #include "CBot/CBotUtils.h"
24 
25 namespace CBot
26 {
27 
28 class CBotVar;
29 class CBotCStack;
30 class CBotStack;
31 class CBotToken;
32 
37 class CBotCallMethode : public CBotLinkedList<CBotCallMethode>
38 {
39 public:
40 
47  CBotCallMethode(const std::string& name,
48  bool rExec(CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception, void* user),
49  CBotTypResult rCompile(CBotVar* pThis, CBotVar*& pVar));
50 
55 
65  CBotTypResult CompileCall(const std::string& name, CBotVar* pThis, CBotVar** ppVars,
66  CBotCStack* pStack);
67 
78  int DoCall(const std::string& name, CBotVar* pThis, CBotVar** ppVars, CBotVar*& pResult,
79  CBotStack* pStack, CBotToken* pFunc);
80 
81 private:
82  std::string m_name;
83  bool (*m_rExec) (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception, void* user);
84  CBotTypResult (*m_rComp) (CBotVar* pThis, CBotVar* &pVar);
85  friend class CBotClass;
86 };
87 
88 } // namespace CBot
The CBotCallMethode class Class managing the methods declared by AddFunction on a class...
Definition: CBotCallMethode.h:37
The execution stack.
Definition: CBotStack.h:44
A CBot class definition.
Definition: CBotClass.h:105
~CBotCallMethode()
~CBotCallMethode
Definition: CBotCallMethode.cpp:43
CBotTypResult CompileCall(const std::string &name, CBotVar *pThis, CBotVar **ppVars, CBotCStack *pStack)
CompileCall Is acceptable by a call procedure name and given parameters.
Definition: CBotCallMethode.cpp:48
A CBot variable.
Definition: CBotVar.h:42
The CBotCStack class Management of the stack of compilation.
Definition: CBotCStack.h:35
CBotCallMethode(const std::string &name, bool rExec(CBotVar *pThis, CBotVar *pVar, CBotVar *pResult, int &Exception, void *user), CBotTypResult rCompile(CBotVar *pThis, CBotVar *&pVar))
CBotCallMethode.
Definition: CBotCallMethode.cpp:33
Definition: CBotUtils.h:99
Class to define the complete type of a variable.
Definition: CBotTypResult.h:47
int DoCall(const std::string &name, CBotVar *pThis, CBotVar **ppVars, CBotVar *&pResult, CBotStack *pStack, CBotToken *pFunc)
DoCall.
Definition: CBotCallMethode.cpp:74
CBot engine.
Definition: CBotCallMethode.cpp:28
Class representing one token of a program.
Definition: CBotToken.h:80