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 
28 {
29 public:
30  VSDXRelationship(xmlTextReaderPtr reader);
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 
56 {
57 public:
58  VSDXRelationships(librevenge::RVNGInputStream *input);
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: */
std::map< std::string, VSDXRelationship > m_relsByType
Definition: VSDXMLHelper.h:72
std::map< std::string, VSDXRelationship > m_relsById
Definition: VSDXMLHelper.h:73
std::string m_id
Definition: VSDXMLHelper.h:50
const std::string getTarget() const
Definition: VSDXMLHelper.h:44
void rebaseTarget(const char *baseDir)
Definition: VSDXMLHelper.cpp:57
std::string m_type
Definition: VSDXMLHelper.h:51
~VSDXRelationships()
Definition: VSDXMLHelper.cpp:139
bool empty() const
Definition: VSDXMLHelper.h:66
const VSDXRelationship * getRelationshipById(const char *id) const
Definition: VSDXMLHelper.cpp:162
const std::string getType() const
Definition: VSDXMLHelper.h:40
std::string m_target
Definition: VSDXMLHelper.h:52
void rebaseTargets(const char *baseDir)
Definition: VSDXMLHelper.cpp:143
Definition: VSDXMLHelper.h:55
const std::string getId() const
Definition: VSDXMLHelper.h:36
Definition: libvisio_utils.h:73
Definition: VSDXMLHelper.h:27
VSDXRelationships(librevenge::RVNGInputStream *input)
Definition: VSDXMLHelper.cpp:93
~VSDXRelationship()
Definition: VSDXMLHelper.cpp:53
const VSDXRelationship * getRelationshipByType(const char *type) const
Definition: VSDXMLHelper.cpp:152
VSDXRelationship()
Definition: VSDXMLHelper.cpp:48

Generated for libvisio by doxygen 1.8.9.1