libvisio_xml.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /*
3 * This file is part of the libvisio 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 #ifndef __LIBVISIO_XML_H__
11 #define __LIBVISIO_XML_H__
12
13 #include <memory>
14
15 #include <librevenge-stream/librevenge-stream.h>
16
17 #include <libxml/xmlreader.h>
18
19 namespace libvisio
20 {
21
22 struct Colour;
23
24 class XMLErrorWatcher
25 {
26 // disable copying
27 XMLErrorWatcher(const XMLErrorWatcher &);
28 XMLErrorWatcher &operator=(const XMLErrorWatcher &);
29
30 public:
31 XMLErrorWatcher();
32
33 bool isError() const;
34 void setError();
35
36 private:
37 bool m_error;
38 };
39
40 // create an xmlTextReader pointer from a librevenge::RVNGInputStream pointer
41 // needs to be freed using xmlTextReaderFree function.
42
43 xmlTextReaderPtr xmlReaderForStream(librevenge::RVNGInputStream *input,
44 const char *URL,
45 const char *encoding,
46 int options,
47 XMLErrorWatcher *watcher = nullptr);
48
49 Colour xmlStringToColour(const xmlChar *s);
50 Colour xmlStringToColour(const std::shared_ptr<xmlChar> &s);
51
52 long xmlStringToLong(const xmlChar *s);
53 long xmlStringToLong(const std::shared_ptr<xmlChar> &s);
54
55 double xmlStringToDouble(const xmlChar *s);
56 double xmlStringToDouble(const std::shared_ptr<xmlChar> &s);
57
58 bool xmlStringToBool(const xmlChar *s);
59 bool xmlStringToBool(const std::shared_ptr<xmlChar> &s);
60
61 } // namespace libvisio
62
63 #endif // __LIBVISIO_XML_H__
64
65 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libvisio::xmlStringToColour
Colour xmlStringToColour(const xmlChar *s)
Definition: libvisio_xml.cpp:104
libvisio::xmlReaderForStream
xmlTextReaderPtr xmlReaderForStream(librevenge::RVNGInputStream *input, const char *URL, const char *encoding, int options, XMLErrorWatcher *const watcher)
Definition: libvisio_xml.cpp:96
libvisio::XMLErrorWatcher
Definition: libvisio_xml.h:24
libvisio::Colour
Definition: VSDTypes.h:72
libvisio::XMLErrorWatcher::m_error
bool m_error
Definition: libvisio_xml.h:37
libvisio::XMLErrorWatcher::operator=
XMLErrorWatcher & operator=(const XMLErrorWatcher &)
libvisio
Definition: libvisio_utils.h:48
libvisio::xmlStringToDouble
double xmlStringToDouble(const xmlChar *s)
Definition: libvisio_xml.cpp:164
libvisio::XMLErrorWatcher::XMLErrorWatcher
XMLErrorWatcher()
Definition: libvisio_xml.cpp:81
libvisio::xmlStringToBool
bool xmlStringToBool(const xmlChar *s)
Definition: libvisio_xml.cpp:182
libvisio::XMLErrorWatcher::isError
bool isError() const
Definition: libvisio_xml.cpp:86
libvisio::XMLErrorWatcher::setError
void setError()
Definition: libvisio_xml.cpp:91
libvisio::xmlStringToLong
long xmlStringToLong(const xmlChar *s)
Definition: libvisio_xml.cpp:140