Gnash  0.8.11dev
MultiName.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_NAME_H
20 #define GNASH_AS_NAME_H
21 
22 #include <vector>
23 
24 namespace gnash {
25  class as_object;
26  class Property;
27  namespace abc {
28  class Namespace;
29  }
30 }
31 
32 namespace gnash {
33 namespace abc {
34 
36 //
42 typedef size_t URI;
43 
45 //
49 //
51 class MultiName
52 {
53 public:
54 
55  enum Kind
56  {
57  KIND_Qname = 0x07,
58  KIND_QnameA = 0x0D,
59  KIND_RTQname = 0x0F,
60  KIND_RTQnameA = 0x10,
61  KIND_RTQnameL = 0x11,
62  KIND_RTQnameLA = 0x12,
63  KIND_Multiname = 0x09,
64  KIND_MultinameA = 0x0E,
65  KIND_MultinameL = 0x1B,
66  KIND_MultinameLA = 0x1C
67  };
68 
70  :
71  _flags(0),
72  _namespaceSet(0),
73  _abcName(0),
74  _globalName(0),
75  _namespace(0)
76  {}
77 
78  void setFlags(Kind kind) {
79  _flags = kind;
80  }
81 
82  std::uint8_t flags() const {
83  return _flags;
84  }
85 
87  bool isRuntime() { return _flags & FLAG_RTNAME; }
88 
90  bool isRtns() { return _flags & FLAG_RTNS; }
91 
92  bool isQName() { return _flags & FLAG_QNAME; }
93  void setQName() { _flags |= FLAG_QNAME; }
94 
95  void setNamespace(Namespace *ns) { _namespace = ns; }
96  Namespace* getNamespace() const { return _namespace; }
97 
98  abc::URI getABCName() const { return _abcName; }
99  void setABCName(abc::URI n) { _abcName = n;}
100 
101  string_table::key getGlobalName() const { return _globalName;}
102  void setGlobalName(string_table::key n) { _globalName = n;}
103 
104  void setAttr() { _flags |= FLAG_ATTR; }
105 
106  void fill(as_object*) {}
107 
108  Property* findProperty();
109 
110  void namespaceSet(std::vector<Namespace*>* v) {
111  _namespaceSet = v;
112  }
113 
114  const std::vector<Namespace*>* namespaceSet() const {
115  return _namespaceSet;
116  }
117 
118 private:
119 
120  enum Flag
121  {
122  FLAG_ATTR = 0x01,
123  FLAG_QNAME = 0x02,
124  FLAG_RTNS = 0x04,
125  FLAG_RTNAME = 0x08,
126  FLAG_NSSET = 0x10
127  };
128 
129  std::uint8_t _flags;
130 
131  std::vector<Namespace*>* _namespaceSet;
132 
133  abc::URI _abcName;
134 
135  string_table::key _globalName;
136 
137  Namespace* _namespace;
138 
139 };
140 
141 } // namespace abc
142 } // namespace gnash
143 #endif
size_t URI
This type should always be used for the index of AbcBlocks&#39; names.
Definition: MultiName.h:42
bool isQName()
Definition: MultiName.h:92
void setQName()
Definition: MultiName.h:93
void setNamespace(Namespace *ns)
Definition: MultiName.h:95
void fill(as_object *)
Definition: MultiName.h:106
An abstract property.
Definition: Property.h:276
void setABCName(abc::URI n)
Definition: MultiName.h:99
v
Definition: test.py:11
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:40
Represent an ActionScript Namespace.
Definition: Namespace.h:48
The base class for all ActionScript objects.
Definition: as_object.h:161
Definition: GnashKey.h:160
void namespaceSet(std::vector< Namespace *> *v)
Definition: MultiName.h:110
void setFlags(Kind kind)
Definition: MultiName.h:78
void setAttr()
Definition: MultiName.h:104
void setGlobalName(string_table::key n)
Definition: MultiName.h:102
bool isRtns()
If true, the name needs a run-time namespace to complete it.
Definition: MultiName.h:90
abc::URI getABCName() const
Definition: MultiName.h:98
MultiName()
Definition: MultiName.h:69
An MultiName represents a single ABC multiname.
Definition: MultiName.h:51
const std::vector< Namespace * > * namespaceSet() const
Definition: MultiName.h:114
Namespace * getNamespace() const
Definition: MultiName.h:96
Kind
Definition: MultiName.h:55
std::uint8_t flags() const
Definition: MultiName.h:82
bool isRuntime()
If true, the name needs a run-time string value to complete it.
Definition: MultiName.h:87
std::size_t key
Definition: string_table.h:83
string_table::key getGlobalName() const
Definition: MultiName.h:101