LibreOffice Module writerfilter (master)
1
Toggle main menu visibility
Main Page
Related Pages
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
w
x
Functions
a
b
c
d
e
f
g
i
k
l
m
n
p
q
r
s
u
x
Variables
a
c
d
f
h
m
n
o
p
w
Typedefs
Enumerations
Enumerator
b
c
e
f
i
l
m
n
p
r
s
t
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
~
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
~
Variables
a
b
c
e
f
g
h
l
m
n
p
r
s
t
x
Typedefs
b
c
d
e
i
o
p
r
t
v
Enumerations
Enumerator
a
c
d
e
f
g
h
i
l
n
p
r
s
t
u
v
w
Files
File List
File Members
All
a
b
c
d
e
h
i
l
m
n
p
s
u
w
Functions
Variables
Typedefs
Macros
writerfilter
source
ooxml
qnametostr.py
Go to the documentation of this file.
1
#!/usr/bin/env python
2
#
3
# This file is part of the LibreOffice project.
4
#
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/.
8
#
9
10
import
xml.sax
11
import
sys
12
13
14
class
ContentHandler
(xml.sax.handler.ContentHandler):
15
def
__init__
(self):
16
self.
tokens
= []
17
18
def
startDocument
(self):
19
print(
"""
20
#include "ooxml/resourceids.hxx"
21
#include "ooxml/QNameToString.hxx"
22
#include "unordered_map"
23
24
namespace writerfilter
25
{
26
27
#ifdef DBG_UTIL
28
29
/* ooxml */
30
static const std::unordered_map<Id, const char*> g_QNameToStringMap {
31
""")
32
33
def
endDocument
(self):
34
print(
"""
35
};
36
37
std::string
QNameToString
(Id qName)
38
{
39
auto it = g_QNameToStringMap.find(qName);
40
if
(it == g_QNameToStringMap.end())
41
return
std::string();
42
43
return
it->second;
44
}
45
46
#endif
47
}
48
""")
49
50
def
startElement
(self, name, attrs):
51
for
k, v
in
list(attrs.items()):
52
if
k ==
"tokenid"
:
53
if
v.startswith(
"ooxml:"
):
54
token = v.replace(
'ooxml:'
,
''
)
55
if
token
not
in
self.
tokens
:
56
print(
""" { NS_ooxml::LN_%s, "ooxml:%s"
},
""" % (token, token))
57
self.
tokens
.append(token)
58
59
60
parser = xml.sax.make_parser()
61
parser.setContentHandler(
ContentHandler
())
62
parser.parse(sys.argv[1])
63
64
# vim:set shiftwidth=4 softtabstop=4 expandtab:
qnametostr.ContentHandler
Definition:
qnametostr.py:14
qnametostr.ContentHandler.endDocument
def endDocument(self)
Definition:
qnametostr.py:33
qnametostr.ContentHandler.startDocument
def startDocument(self)
Definition:
qnametostr.py:18
qnametostr.ContentHandler.tokens
tokens
Definition:
qnametostr.py:16
qnametostr.ContentHandler.__init__
def __init__(self)
Definition:
qnametostr.py:15
qnametostr.ContentHandler.startElement
def startElement(self, name, attrs)
Definition:
qnametostr.py:50
writerfilter::QNameToString
std::string QNameToString(Id)
xml.sax
Generated on Sun Jul 30 2023 04:31:27 for LibreOffice Module writerfilter (master) by
1.9.3