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 <boost/shared_ptr.hpp>
16 #include <librevenge-stream/librevenge-stream.h>
17 #include <libxml/xmlreader.h>
18 #include "VSDTypes.h"
19
20 namespace libvisio
21 {
22
23 class VSDCollector;
24
25 // Helper classes to properly handle OPC relationships
26
27 class VSDXRelationship
28 {
29 public:
30 VSDXRelationship(xmlTextReaderPtr reader);
31 VSDXRelationship();
32 ~VSDXRelationship();
33
34 void rebaseTarget(const char *baseDir);
35
36 const std::string getId() const
37 {
38 return m_id;
39 }
40 const std::string getType() const
41 {
42 return m_type;
43 }
44 const std::string getTarget() const
45 {
46 return m_target;
47 }
48
49 private:
50 std::string m_id;
51 std::string m_type;
52 std::string m_target;
53 };
54
55 class VSDXRelationships
56 {
57 public:
58 VSDXRelationships(librevenge::RVNGInputStream *input);
59 ~VSDXRelationships();
60
61 void rebaseTargets(const char *baseDir);
62
63 const VSDXRelationship *getRelationshipByType(const char *type) const;
64 const VSDXRelationship *getRelationshipById(const char *id) const;
65
66 bool empty() const
67 {
68 return m_relsByType.empty() && m_relsById.empty();
69 }
70
71 private:
72 std::map<std::string, VSDXRelationship> m_relsByType;
73 std::map<std::string, VSDXRelationship> m_relsById;
74 };
75
76 } // namespace libvisio
77
78 #endif // __VSDXMLHELPER_H__
79 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libvisio::VSDXRelationships::m_relsByType
std::map< std::string, VSDXRelationship > m_relsByType
Definition: VSDXMLHelper.h:72
libvisio::VSDXRelationships::m_relsById
std::map< std::string, VSDXRelationship > m_relsById
Definition: VSDXMLHelper.h:73
libvisio::VSDXRelationship::m_id
std::string m_id
Definition: VSDXMLHelper.h:50
libvisio::VSDXRelationship::rebaseTarget
void rebaseTarget(const char *baseDir)
Definition: VSDXMLHelper.cpp:57
libvisio::VSDXRelationship::getType
const std::string getType() const
Definition: VSDXMLHelper.h:40
libvisio::VSDXRelationship::m_type
std::string m_type
Definition: VSDXMLHelper.h:51
VSDTypes.h
libvisio::VSDXRelationship::m_target
std::string m_target
Definition: VSDXMLHelper.h:52
libvisio::VSDXRelationships
Definition: VSDXMLHelper.h:55
libvisio::VSDXRelationship::getTarget
const std::string getTarget() const
Definition: VSDXMLHelper.h:44
libvisio
Definition: libvisio_utils.h:73
libvisio::VSDXRelationship
Definition: VSDXMLHelper.h:27
libvisio::VSDXRelationship::getId
const std::string getId() const
Definition: VSDXMLHelper.h:36
libvisio::VSDXRelationship::~VSDXRelationship
~VSDXRelationship()
Definition: VSDXMLHelper.cpp:53
libvisio::VSDXRelationships::empty
bool empty() const
Definition: VSDXMLHelper.h:66
libvisio::VSDXRelationship::VSDXRelationship
VSDXRelationship()
Definition: VSDXMLHelper.cpp:48