nss: upgrade to release 3.73
[LibreOffice.git] / writerfilter / source / ooxml / factoryinc.py
blobec07f7fda1ce2cf67677948e13e696d71cb4c358
1 #!/usr/bin/env python
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 from xml.dom import minidom
11 import sys
14 def createInclude(model):
15 print("""
16 #ifndef INCLUDED_OOXML_FACTORY_GENERATED_HXX
17 #define INCLUDED_OOXML_FACTORY_GENERATED_HXX
19 namespace writerfilter {
20 namespace ooxml {
22 /// @cond GENERATED
23 """)
25 # Create namespaces.
26 counter = 1
27 for namespace in sorted([ns.getAttribute("name") for ns in model.getElementsByTagName("namespace")]):
28 print("const Id NN_%s = %s << 16;" % (namespace.replace('-', '_'), counter))
29 counter += 1
31 # Create defines.
32 counter = 1
33 defines = []
34 for define in sorted([ns.getAttribute("name") for ns in model.getElementsByTagName("define")]):
35 if define not in defines:
36 print("const Id DEFINE_%s = %s;" % (define, counter))
37 defines.append(define)
38 counter += 1
39 print("""/// @endcond
42 #endif // INCLUDED_OOXML_FACTORY_GENERATED_HXX""")
45 modelPath = sys.argv[1]
46 model = minidom.parse(modelPath)
47 createInclude(model)
49 # vim:set shiftwidth=4 softtabstop=4 expandtab: