1 {% from "macros.tmpl" import license %}
6 #ifdef SKIP_STATIC_CONSTRUCTORS_ON_GCC
7 #define {{namespace|to_macro_style}}_NAMES_HIDE_GLOBALS 1
9 #define QNAME_DEFAULT_CONSTRUCTOR 1
12 #include "{{namespace}}Names.h"
14 #include "wtf/StaticConstructors.h"
17 namespace {{namespace}}Names {
19 using namespace WebCore;
21 DEFINE_GLOBAL(AtomicString, {{namespace_prefix}}NamespaceURI)
25 {% for tag in tags|sort %}
26 DEFINE_GLOBAL(QualifiedName, {{tag|symbol}}Tag)
30 PassOwnPtr<const QualifiedName*[]> get{{namespace}}Tags()
32 OwnPtr<const QualifiedName*[]> tags = adoptArrayPtr(new const QualifiedName*[{{namespace}}TagsCount]);
33 {% for tag in tags|sort %}
34 tags[{{loop.index0}}] = reinterpret_cast<const QualifiedName*>(&{{tag|symbol}}Tag);
36 return tags.release();
41 {% for attr in attrs|sort %}
42 DEFINE_GLOBAL(QualifiedName, {{attr|symbol}}Attr)
45 PassOwnPtr<const QualifiedName*[]> get{{namespace}}Attrs()
47 OwnPtr<const QualifiedName*[]> attrs = adoptArrayPtr(new const QualifiedName*[{{namespace}}AttrsCount]);
48 {% for attr in attrs|sort %}
49 attrs[{{loop.index0}}] = reinterpret_cast<const WebCore::QualifiedName*>(&{{attr|symbol}}Attr);
51 return attrs.release();
56 // Use placement new to initialize the globals.
57 AtomicString {{namespace_prefix}}NS("{{namespace_uri}}", AtomicString::ConstructFromLiteral);
60 new ((void*)&{{namespace_prefix}}NamespaceURI) AtomicString({{namespace_prefix}}NS);
61 {% for name, tag_list in (tags + attrs)|groupby('name')|sort %}
62 StringImpl* {{tag_list[0]|symbol}}Impl = StringImpl::createStatic("{{name}}", {{name|length}}, {{name|hash}});
66 {% for tag in tags|sort %}
67 createQualifiedName((void*)&{{tag|symbol}}Tag, {{tag|symbol}}Impl, {{namespace_prefix}}NS);
71 {% for attr in attrs|sort %}
72 {% if use_namespace_for_attrs %}
73 createQualifiedName((void*)&{{attr|symbol}}Attr, {{attr|symbol}}Impl, {{namespace_prefix}}NS);
75 createQualifiedName((void*)&{{attr|symbol}}Attr, {{attr|symbol}}Impl);