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: */
Generated for libvisio by
doxygen
1.8.4