Gnash  0.8.10
MultiName.h
Go to the documentation of this file.
00001 //
00002 //   Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012
00003 //   Free Software Foundation, Inc.
00004 // 
00005 // This program is free software; you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation; either version 3 of the License, or
00008 // (at your option) any later version.
00009 // 
00010 // This program is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 // 
00015 // You should have received a copy of the GNU General Public License
00016 // along with this program; if not, write to the Free Software
00017 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00018 
00019 #ifndef GNASH_AS_NAME_H
00020 #define GNASH_AS_NAME_H
00021 
00022 #include <vector>
00023 
00024 namespace gnash {
00025     class as_object;
00026     class Property;
00027     namespace abc {
00028         class Namespace;
00029     }
00030 }
00031 
00032 namespace gnash {
00033 namespace abc {
00034 
00036 //
00042 typedef size_t URI;
00043 
00045 //
00049 //
00051 class MultiName
00052 {
00053 public:
00054         
00055         enum Kind
00056         {
00057                 KIND_Qname = 0x07,
00058                 KIND_QnameA = 0x0D,
00059                 KIND_RTQname = 0x0F,
00060                 KIND_RTQnameA = 0x10,
00061                 KIND_RTQnameL = 0x11,
00062                 KIND_RTQnameLA = 0x12,
00063                 KIND_Multiname = 0x09,
00064                 KIND_MultinameA = 0x0E,
00065                 KIND_MultinameL = 0x1B,
00066                 KIND_MultinameLA = 0x1C
00067         };
00068 
00069         MultiName()
00070         :
00071         _flags(0),
00072         _namespaceSet(0),
00073         _abcName(0),
00074         _globalName(0),
00075                 _namespace(0)
00076         {}
00077 
00078     void setFlags(Kind kind) {
00079         _flags = kind;
00080     }
00081 
00082     boost::uint8_t flags() const {
00083         return _flags;
00084     }
00085 
00087         bool isRuntime() { return _flags & FLAG_RTNAME; }
00088 
00090         bool isRtns() { return _flags & FLAG_RTNS; }
00091 
00092         bool isQName() { return _flags & FLAG_QNAME; }
00093         void setQName() { _flags |= FLAG_QNAME; }
00094 
00095         void setNamespace(Namespace *ns) { _namespace = ns; }
00096         Namespace* getNamespace() const { return _namespace; }
00097 
00098     abc::URI getABCName() const { return _abcName; }
00099         void setABCName(abc::URI n) { _abcName = n;}
00100 
00101         string_table::key getGlobalName() const { return _globalName;}
00102         void setGlobalName(string_table::key n) { _globalName = n;}
00103         
00104         void setAttr() { _flags |= FLAG_ATTR; }
00105 
00106         void fill(as_object*) {}
00107 
00108         Property* findProperty();
00109     
00110     void namespaceSet(std::vector<Namespace*>* v) {
00111         _namespaceSet = v;
00112     }
00113 
00114     const std::vector<Namespace*>* namespaceSet() const {
00115         return _namespaceSet;
00116     }
00117 
00118 private:
00119 
00120         enum Flag
00121         {
00122                 FLAG_ATTR = 0x01,
00123                 FLAG_QNAME = 0x02,
00124                 FLAG_RTNS = 0x04,
00125                 FLAG_RTNAME = 0x08,
00126                 FLAG_NSSET = 0x10
00127         };
00128 
00129     boost::uint8_t _flags;
00130 
00131     std::vector<Namespace*>* _namespaceSet;
00132 
00133     abc::URI _abcName;
00134 
00135         string_table::key _globalName;
00136 
00137         Namespace* _namespace;
00138 
00139 };
00140 
00141 } // namespace abc
00142 } // namespace gnash
00143 #endif