VSDXMLHelper.h
Go to the documentation of this file.
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* This file is part of the libvisio project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef __VSDXMLHELPER_H__
#define __VSDXMLHELPER_H__
#include <map>
#include <memory>
#include <string>
#include <librevenge-stream/librevenge-stream.h>
#include <libxml/xmlreader.h>
#include "VSDTypes.h"
namespace libvisio
{
class VSDCollector;
// Helper classes to properly handle OPC relationships
class VSDXRelationship
{
public:
VSDXRelationship(xmlTextReaderPtr reader);
VSDXRelationship();
~VSDXRelationship();
void rebaseTarget(const char *baseDir);
const std::string getId() const
{
return m_id;
}
const std::string getType() const
{
return m_type;
}
const std::string getTarget() const
{
return m_target;
}
private:
std::string m_id;
std::string m_type;
std::string m_target;
};
class VSDXRelationships
{
public:
VSDXRelationships(librevenge::RVNGInputStream *input);
~VSDXRelationships();
void rebaseTargets(const char *baseDir);
const VSDXRelationship *getRelationshipByType(const char *type) const;
const VSDXRelationship *getRelationshipById(const char *id) const;
bool empty() const
{
return m_relsByType.empty() && m_relsById.empty();
}
private:
std::map<std::string, VSDXRelationship> m_relsByType;
std::map<std::string, VSDXRelationship> m_relsById;
};
} // namespace libvisio
#endif // __VSDXMLHELPER_H__
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
VSDTypes.h
libvisio::VSDCollector
Definition VSDCollector.h:21
libvisio::VSDXRelationship
Definition VSDXMLHelper.h:29
libvisio::VSDXRelationship::VSDXRelationship
VSDXRelationship(xmlTextReaderPtr reader)
Definition VSDXMLHelper.cpp:23
libvisio::VSDXRelationship::m_id
std::string m_id
Definition VSDXMLHelper.h:51
libvisio::VSDXRelationship::m_type
std::string m_type
Definition VSDXMLHelper.h:52
libvisio::VSDXRelationship::rebaseTarget
void rebaseTarget(const char *baseDir)
Definition VSDXMLHelper.cpp:53
libvisio::VSDXRelationship::~VSDXRelationship
~VSDXRelationship()
Definition VSDXMLHelper.cpp:49
libvisio::VSDXRelationship::m_target
std::string m_target
Definition VSDXMLHelper.h:53
libvisio::VSDXRelationship::getType
const std::string getType() const
Definition VSDXMLHelper.h:41
libvisio::VSDXRelationship::getId
const std::string getId() const
Definition VSDXMLHelper.h:37
libvisio::VSDXRelationship::getTarget
const std::string getTarget() const
Definition VSDXMLHelper.h:45
libvisio::VSDXRelationship::VSDXRelationship
VSDXRelationship()
Definition VSDXMLHelper.cpp:44
libvisio::VSDXRelationships::m_relsById
std::map< std::string, VSDXRelationship > m_relsById
Definition VSDXMLHelper.h:74
libvisio::VSDXRelationships::~VSDXRelationships
~VSDXRelationships()
Definition VSDXMLHelper.cpp:137
libvisio::VSDXRelationships::VSDXRelationships
VSDXRelationships(librevenge::RVNGInputStream *input)
Definition VSDXMLHelper.cpp:93
libvisio::VSDXRelationships::empty
bool empty() const
Definition VSDXMLHelper.h:67
libvisio::VSDXRelationships::getRelationshipByType
const VSDXRelationship * getRelationshipByType(const char *type) const
Definition VSDXMLHelper.cpp:150
libvisio::VSDXRelationships::rebaseTargets
void rebaseTargets(const char *baseDir)
Definition VSDXMLHelper.cpp:141
libvisio::VSDXRelationships::m_relsByType
std::map< std::string, VSDXRelationship > m_relsByType
Definition VSDXMLHelper.h:73
libvisio::VSDXRelationships::getRelationshipById
const VSDXRelationship * getRelationshipById(const char *id) const
Definition VSDXMLHelper.cpp:160
libvisio
Definition libvisio_utils.h:47