1 {% from "macros.tmpl" import license %}
6 #include "{{namespace}}Names.h"
8 #include "wtf/StaticConstructors.h"
11 namespace {{namespace}}Names {
13 using namespace blink;
15 DEFINE_GLOBAL(AtomicString, {{namespace_prefix}}NamespaceURI)
19 {% for tag in tags|sort %}
20 DEFINE_GLOBAL({{namespace}}QualifiedName, {{tag|symbol}}Tag)
24 PassOwnPtr<const {{namespace}}QualifiedName*[]> get{{namespace}}Tags()
26 OwnPtr<const {{namespace}}QualifiedName*[]> tags = adoptArrayPtr(new const {{namespace}}QualifiedName*[{{namespace}}TagsCount]);
27 {% for tag in tags|sort %}
28 tags[{{loop.index0}}] = reinterpret_cast<const {{namespace}}QualifiedName*>(&{{tag|symbol}}Tag);
30 return tags.release();
35 {% for attr in attrs|sort %}
36 DEFINE_GLOBAL(QualifiedName, {{attr|symbol}}Attr)
39 PassOwnPtr<const QualifiedName*[]> get{{namespace}}Attrs()
41 OwnPtr<const QualifiedName*[]> attrs = adoptArrayPtr(new const QualifiedName*[{{namespace}}AttrsCount]);
42 {% for attr in attrs|sort %}
43 attrs[{{loop.index0}}] = reinterpret_cast<const blink::QualifiedName*>(&{{attr|symbol}}Attr);
45 return attrs.release();
50 // Use placement new to initialize the globals.
51 AtomicString {{namespace_prefix}}NS("{{namespace_uri}}", AtomicString::ConstructFromLiteral);
54 new ((void*)&{{namespace_prefix}}NamespaceURI) AtomicString({{namespace_prefix}}NS);
55 {% for name, tag_list in (tags + attrs)|groupby('name')|sort %}
56 StringImpl* {{tag_list[0]|symbol}}Impl = StringImpl::createStatic("{{name}}", {{name|length}}, {{name|hash}});
60 {% for tag in tags|sort %}
61 QualifiedName::createStatic((void*)&{{tag|symbol}}Tag, {{tag|symbol}}Impl, {{namespace_prefix}}NS);
65 {% for attr in attrs|sort %}
66 {% if use_namespace_for_attrs %}
67 QualifiedName::createStatic((void*)&{{attr|symbol}}Attr, {{attr|symbol}}Impl, {{namespace_prefix}}NS);
69 QualifiedName::createStatic((void*)&{{attr|symbol}}Attr, {{attr|symbol}}Impl);