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

Generated for libvisio by doxygen 1.8.13