xoreos  0.0.5
object.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_ACTIONSCRIPT_OBJECT_H
26 #define AURORA_ACTIONSCRIPT_OBJECT_H
27 
28 #include <map>
29 
30 #include <boost/shared_ptr.hpp>
31 #include <boost/enable_shared_from_this.hpp>
32 
33 #include "src/common/ustring.h"
34 
37 
38 namespace Aurora {
39 
40 namespace ActionScript {
41 
42 class AVM;
43 class Object;
44 
45 typedef boost::shared_ptr<Object> ObjectPtr;
46 
47 class Object : public boost::enable_shared_from_this<Object> {
48 public:
49  Object();
50  Object(Object *object);
51  virtual ~Object();
52 
53  std::vector<Common::UString> getSlots() const;
54 
55  bool hasMember(const Common::UString &id);
56 
57  virtual Variable getMember(const Variable &id);
58  virtual void setMember(const Variable &id, const Variable &value);
59  virtual void setMember(const Common::UString &id, Function *function);
60 
61  Variable call(const Common::UString &function, AVM &avm, const std::vector<Variable> &arguments = std::vector<Variable>());
62 
63 private:
64  std::map<Common::UString, Variable> _members;
65 };
66 
67 } // End of namespace ActionScript
68 
69 } // End of namespace Aurora
70 
71 #endif // AURORA_ACTIONSCRIPT_OBJECT_H
A class holding an UTF-8 string.
Definition: ustring.h:48
A variable used in the execution context.
Context for executing ActionScript.
std::vector< Common::UString > getSlots() const
Definition: object.cpp:47
bool hasMember(const Common::UString &id)
Definition: object.cpp:55
virtual void setMember(const Variable &id, const Variable &value)
Definition: object.cpp:72
Variable call(const Common::UString &function, AVM &avm, const std::vector< Variable > &arguments=std::vector< Variable >())
Definition: object.cpp:83
Unicode string handling.
An action script variable.
Definition: variable.h:44
virtual Variable getMember(const Variable &id)
Definition: object.cpp:59
std::map< Common::UString, Variable > _members
Definition: object.h:64
boost::shared_ptr< Object > ObjectPtr
Definition: object.h:43
The Action script virtual machine (AVM).
Definition: avm.h:46