xoreos  0.0.5
functioncontext.h
Go to the documentation of this file.
1 /* xoreos - A reimplementation of BioWare's Aurora engine
2  *
3  * xoreos is the legal property of its developers, whose names
4  * can be found in the AUTHORS file distributed with this source
5  * distribution.
6  *
7  * xoreos is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 3
10  * of the License, or (at your option) any later version.
11  *
12  * xoreos is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with xoreos. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
25 #ifndef AURORA_NWSCRIPT_FUNCTIONCONTEXT_H
26 #define AURORA_NWSCRIPT_FUNCTIONCONTEXT_H
27 
28 #include "src/common/ustring.h"
29 
34 
35 namespace Aurora {
36 
37 namespace NWScript {
38 
39 class NCSFile;
40 class VariableContainer;
41 
43 public:
44  FunctionContext(const Common::UString &name = "");
45  FunctionContext(const FunctionContext &ctx);
47 
49 
50  const Common::UString &getName() const;
51 
52  void setSignature(const Signature &signature);
53  void setDefaults(const Parameters &defaults);
54 
55  size_t getParamMin() const;
56  size_t getParamMax() const;
57 
58  void setParamsSpecified(size_t params);
59  size_t getParamsSpecified() const;
60 
61  const Signature &getSignature() const;
62 
63  Object *getCaller() const;
64  void setCaller(Object *obj);
65  void setCaller(const ObjectReference &obj);
66 
67  Object *getTriggerer() const;
68  void setTriggerer(Object *obj);
69  void setTriggerer(const ObjectReference &obj);
70 
72  const Variable &getReturn() const;
73 
75  const Parameters &getParams() const;
76 
77  void setCurrentScript(NCSFile *script = 0);
78  NCSFile *getCurrentScript() const;
80 
81  const Common::UString &getScriptName() const;
82 
83 private:
85 
87 
90 
93 
95 
96  size_t _defaultCount;
98 };
99 
100 } // End of namespace NWScript
101 
102 } // End of namespace Aurora
103 
104 #endif // AURORA_NWSCRIPT_FUNCTIONCONTEXT_H
const Signature & getSignature() const
NWScript variable.
std::vector< class Variable > Parameters
Definition: types.h:54
size_t _paramsSpecified
The number of parameters specified (not defaulted).
A class holding an UTF-8 string.
Definition: ustring.h:48
ObjectReference _triggerer
The triggering person.
An NCS, BioWare&#39;s NWN Compile Script.
Definition: ncsfile.h:86
FunctionContext & operator=(const FunctionContext &ctx)
const Common::UString & getScriptName() const
std::vector< Type > Signature
Definition: types.h:52
const Common::UString & getName() const
void setCurrentScript(NCSFile *script=0)
VariableContainer * getCurrentEnvironment() const
Unicode string handling.
Reference to an NWScript object.
size_t _defaultCount
The number of default values.
Parameters _parameters
The function&#39;s parameters.
NCSFile * _currentScript
The script executing this function.
ObjectReference _caller
The calling object.
Variable _return
The function&#39;s return value.
void setSignature(const Signature &signature)
Signature _signature
The function&#39;s signature.
void setDefaults(const Parameters &defaults)
NWScript types.
NWScript utility functions.
FunctionContext(const Common::UString &name="")