VSDXMLHelper.h Source File documentation

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

VSDXMLHelper.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 __VSDXMLHELPER_H__
11 #define __VSDXMLHELPER_H__
12
13 #include <map>
14 #include <string>
15 #include <librevenge-stream/librevenge-stream.h>
16 #include <libxml/xmlreader.h>
17 #include "VSDTypes.h"
18
19 namespace libvisio
20 {
21
22 // create an xmlTextReader pointer from a librevenge::RVNGInputStream pointer
23 // needs to be freed using xmlTextReaderFree function.
24
25 xmlTextReaderPtr xmlReaderForStream(librevenge::RVNGInputStream *input,
26 const char *URL,
27 const char *encoding,
28 int options);
29
30 Colour xmlStringToColour(const xmlChar *s);
31
32 long xmlStringToLong(const xmlChar *s);
33
34 double xmlStringToDouble(const xmlChar *s);
35
36 bool xmlStringToBool(const xmlChar *s);
37
38
39 class VSDCollector;
40
41 // Helper classes to properly handle OPC relationships
42
43 class VSDXRelationship
44 {
45 public:
46 VSDXRelationship(xmlTextReaderPtr reader);
47 VSDXRelationship();
48 ~VSDXRelationship();
49
50 void rebaseTarget(const char *baseDir);
51
52 const std::string getId() const
53 {
54 return m_id;
55 }
56 const std::string getType() const
57 {
58 return m_type;
59 }
60 const std::string getTarget() const
61 {
62 return m_target;
63 }
64
65 private:
66 std::string m_id;
67 std::string m_type;
68 std::string m_target;
69 };
70
71 class VSDXRelationships
72 {
73 public:
74 VSDXRelationships(librevenge::RVNGInputStream *input);
75 ~VSDXRelationships();
76
77 void rebaseTargets(const char *baseDir);
78
79 const VSDXRelationship *getRelationshipByType(const char *type) const;
80 const VSDXRelationship *getRelationshipById(const char *id) const;
81
82 bool empty() const
83 {
84 return m_relsByType.empty() && m_relsById.empty();
85 }
86
87 private:
88 std::map<std::string, VSDXRelationship> m_relsByType;
89 std::map<std::string, VSDXRelationship> m_relsById;
90 };
91
92 } // namespace libvisio
93
94 #endif // __VSDXMLHELPER_H__
95 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libvisio::VSDXRelationships::m_relsByType
std::map< std::string, VSDXRelationship > m_relsByType
Definition: VSDXMLHelper.h:88
libvisio::VSDXRelationships::m_relsById
std::map< std::string, VSDXRelationship > m_relsById
Definition: VSDXMLHelper.h:89
libvisio::VSDXRelationship::m_id
std::string m_id
Definition: VSDXMLHelper.h:66
libvisio::VSDXRelationship::getTarget
const std::string getTarget() const
Definition: VSDXMLHelper.h:60
libvisio::VSDXRelationship::rebaseTarget
void rebaseTarget(const char *baseDir)
Definition: VSDXMLHelper.cpp:206
libvisio::VSDXRelationship::m_type
std::string m_type
Definition: VSDXMLHelper.h:67
libvisio::VSDXRelationships::~VSDXRelationships
~VSDXRelationships()
Definition: VSDXMLHelper.cpp:287
libvisio::VSDXRelationships::empty
bool empty() const
Definition: VSDXMLHelper.h:82
libvisio::VSDXRelationships::getRelationshipById
const VSDXRelationship * getRelationshipById(const char *id) const
Definition: VSDXMLHelper.cpp:310
VSDTypes.h
libvisio::VSDXRelationship::getType
const std::string getType() const
Definition: VSDXMLHelper.h:56
libvisio::VSDXRelationship::m_target
std::string m_target
Definition: VSDXMLHelper.h:68
libvisio::VSDXRelationships::rebaseTargets
void rebaseTargets(const char *baseDir)
Definition: VSDXMLHelper.cpp:291
libvisio::VSDXRelationships
Definition: VSDXMLHelper.h:71
libvisio::VSDXRelationship::getId
const std::string getId() const
Definition: VSDXMLHelper.h:52
libvisio
Definition: libvisio_utils.h:68
libvisio::VSDXRelationship
Definition: VSDXMLHelper.h:43
libvisio::xmlStringToDouble
double xmlStringToDouble(const xmlChar *s)
Definition: VSDXMLHelper.cpp:142
libvisio::VSDXRelationships::VSDXRelationships
VSDXRelationships(librevenge::RVNGInputStream *input)
Definition: VSDXMLHelper.cpp:242
libvisio::VSDXRelationship::~VSDXRelationship
~VSDXRelationship()
Definition: VSDXMLHelper.cpp:202
libvisio::xmlStringToColour
Colour xmlStringToColour(const xmlChar *s)
Definition: VSDXMLHelper.cpp:92
libvisio::xmlStringToBool
bool xmlStringToBool(const xmlChar *s)
Definition: VSDXMLHelper.cpp:155
libvisio::xmlReaderForStream
xmlTextReaderPtr xmlReaderForStream(librevenge::RVNGInputStream *input, const char *URL, const char *encoding, int options)
Definition: VSDXMLHelper.cpp:85
libvisio::VSDXRelationships::getRelationshipByType
const VSDXRelationship * getRelationshipByType(const char *type) const
Definition: VSDXMLHelper.cpp:300
libvisio::xmlStringToLong
long xmlStringToLong(const xmlChar *s)
Definition: VSDXMLHelper.cpp:123
libvisio::VSDXRelationship::VSDXRelationship
VSDXRelationship()
Definition: VSDXMLHelper.cpp:197