1## -*- coding: utf-8 -*-
2<?xml version="1.0" encoding="UTF-8"?>
3<!-- Copyright (C) 2012 The Android Open Source Project
4
5     Licensed under the Apache License, Version 2.0 (the "License");
6     you may not use this file except in compliance with the License.
7     You may obtain a copy of the License at
8
9          http://www.apache.org/licenses/LICENSE-2.0
10
11     Unless required by applicable law or agreed to in writing, software
12     distributed under the License is distributed on an "AS IS" BASIS,
13     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14     See the License for the specific language governing permissions and
15     limitations under the License.
16-->
17<metadata
18    xmlns="http://schemas.android.com/service/camera/metadata/"
19    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
20    xsi:schemaLocation="http://schemas.android.com/service/camera/metadata/ metadata_properties.xsd">
21
22<tags>
23% for tag in metadata.tags:
24  % if tag.description and tag.description.strip():
25  <tag id="${tag.id}">${tag.description | x}</tag>
26  % else:
27  <tag id="${tag.id}"><!-- TODO: fill the tag description --></tag>
28  % endif
29% endfor
30</tags>
31
32<types>
33% for typedef in metadata.types:
34  <typedef name="${typedef.name}">
35    % for (language, klass) in typedef.languages.iteritems():
36      <language name="${language}">${klass}</language>
37    % endfor
38  </typedef>
39% endfor
40</types>
41
42% for root in metadata.outer_namespaces:
43<namespace name="${root.name}">
44  % for section in root.sections:
45  <section name="${section.name}">
46
47    % if section.description is not None:
48      <description>${section.description}</description>
49    % endif
50
51    % for kind in section.kinds: # dynamic,static,controls
52      <${kind.name}>
53
54        <%def name="insert_body(node)">
55            % for nested in node.namespaces:
56                ${insert_namespace(nested)}
57            % endfor
58
59            % for entry in node.entries:
60                ${insert_entry(entry)}
61            % endfor
62        </%def>
63
64        <%def name="insert_namespace(namespace)">
65        <namespace name="${namespace.name}">
66            ${insert_body(namespace)}
67        </namespace>
68        </%def>
69
70        <%def name="insert_entry(prop)">
71        % if prop.is_clone():
72            <clone entry="${prop.name}" kind="${prop.target_kind}">
73
74              % if prop.notes is not None:
75                <notes>${prop.notes}</notes>
76              % endif
77
78              % for tag in prop.tags:
79                <tag id="${tag.id}" />
80              % endfor
81
82            </clone>
83        % else:
84            <entry name="${prop.name_short}" type="${prop.type}"
85          % if prop.visibility:
86                visibility="${prop.visibility}"
87          % endif
88          % if prop.optional:
89                optional="${str(prop.optional).lower()}"
90          % endif
91          % if prop.enum:
92                enum="true"
93          % endif
94          % if prop.type_notes is not None:
95                type_notes="${prop.type_notes}"
96          % endif
97          % if prop.container is not None:
98                container="${prop.container}"
99          % endif
100
101          % if prop.typedef is not None:
102                typedef="${prop.typedef.name}"
103          % endif
104            >
105
106              % if prop.container == 'array':
107                <array>
108                  % for size in prop.container_sizes:
109                    <size>${size}</size>
110                  % endfor
111                </array>
112              % elif prop.container == 'tuple':
113                <tuple>
114                  % for size in prop.container_sizes:
115                    <value /> <!-- intentionally generated empty. manually fix -->
116                  % endfor
117                </tuple>
118              % endif
119              % if prop.enum:
120                <enum>
121                  % for value in prop.enum.values:
122                      <value
123                    % if value.optional:
124                             optional="true"
125                    % endif:
126                    % if value.id is not None:
127                             id="${value.id}"
128                    % endif
129                      >${value.name}
130                    % if value.notes is not None:
131                             <notes>${value.notes}</notes>
132                    % endif
133                      </value>
134                  % endfor
135                </enum>
136              % endif
137
138              % if prop.description is not None:
139                <description>${prop.description | x}</description>
140              % endif
141
142              % if prop.units is not None:
143                <units>${prop.units | x}</units>
144              % endif
145
146              % if prop.range is not None:
147                <range>${prop.range | x}</range>
148              % endif
149
150              % if prop.notes is not None:
151                <notes>${prop.notes | x}</notes>
152              % endif
153
154              % for tag in prop.tags:
155                <tag id="${tag.id}" />
156              % endfor
157
158            </entry>
159        % endif
160        </%def>
161
162        ${insert_body(kind)}
163
164      </${kind.name}>
165    % endfor # for each kind
166
167  </section>
168  % endfor
169</namespace>
170% endfor
171
172</metadata>
173