Gnash  0.8.11dev
BoundValues.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012
3 // Free Software Foundation, Inc.
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 
19 #ifndef GNASH_AS_BOUND_VALUES_H
20 #define GNASH_AS_BOUND_VALUES_H
21 
22 namespace gnash {
23 namespace abc {
24 
25 class BoundValue;
26 
28 {
29 public:
30  bool setGetter(Method *p) { mGetter = p; return true; }
31  bool setSetter(Method *p) { _setter = p; return true; }
32  bool setValue(BoundValue *p) { mValue = p; return true; }
33 
34  BoundValue* getValue() { return mValue; }
35  Method *getGetter() { return mGetter; }
36  Method *getSetter() { return _setter; }
37 
38 private:
39  Method *mGetter;
40  Method *_setter;
41  BoundValue *mValue;
42 };
43 
44 class BoundValue
45 {
46 public:
47  BoundValue() : mConst(false), mValue()
48  { mValue.set_undefined(); }
49  void setValue(as_value &v) { mValue = v; }
50  as_value getCurrentValue() { return mValue; }
51 
52  void setType(Class *t) { mType = t; }
53  Class *getType() { return mType; }
54 
55 private:
56  bool mConst;
57  Class *mType;
58  as_value mValue;
59 };
60 
61 } // namespace abc
62 } // namespace gnash
63 
64 #endif