EPUBPath.h Source File documentation

EPUBPath.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 libepubgen 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 INCLUDED_EPUBPATH_H
11#define INCLUDED_EPUBPATH_H
12
13#include <string>
14#include <vector>
15
16namespace libepubgen
17{
18
21 class EPUBPath
22{
23 friend bool operator==(const EPUBPath &left, const EPUBPath &right);
24
25public:
26 class Relative
27 {
28 friend class EPUBPath;
29
30 public:
31 const std::string str() const;
32
33 private:
34 explicit Relative(const std::vector<std::string> &components);
35
36 private:
37 std::vector<std::string> m_components;
38 };
39
40 explicit EPUBPath(const std::string &path);
41
42 void swap(EPUBPath &other);
43
44 void append(const EPUBPath &subpath);
45 void appendComponent(const std::string &pathComponent);
46
47 const std::string str() const;
48
49 const Relative relativeTo(const EPUBPath &base) const;
50
51 void appendTitle(const std::string &title);
52 std::string getTitle() const;
53
55 void addChapter(const std::string &chapter);
56 const std::vector<std::string> &getChapters() const;
57private:
58 std::vector<std::string> m_components;
59 std::string m_title;
60 std::vector<std::string> m_chapters;
61};
62
63bool operator==(const EPUBPath &left, const EPUBPath &right);
64bool operator!=(const EPUBPath &left, const EPUBPath &right);
65
66const EPUBPath operator/(const EPUBPath &base, const EPUBPath &subpath);
67const EPUBPath operator/(const EPUBPath &base, const std::string &pathComponent);
68
69void swap(EPUBPath &left, EPUBPath &right);
70
71}
72
73#endif // INCLUDED_EPUBPATH
74
75/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libepubgen::EPUBPath::Relative
Definition EPUBPath.h:27
libepubgen::EPUBPath::Relative::m_components
std::vector< std::string > m_components
Definition EPUBPath.h:37
libepubgen::EPUBPath::Relative::Relative
Relative(const std::vector< std::string > &components)
Definition EPUBPath.cpp:50
libepubgen::EPUBPath::Relative::str
const std::string str() const
Definition EPUBPath.cpp:45
libepubgen::EPUBPath
Representation of a path in the package.
Definition EPUBPath.h:22
libepubgen::EPUBPath::append
void append(const EPUBPath &subpath)
Definition EPUBPath.cpp:72
libepubgen::EPUBPath::m_chapters
std::vector< std::string > m_chapters
Definition EPUBPath.h:60
libepubgen::EPUBPath::str
const std::string str() const
Definition EPUBPath.cpp:87
libepubgen::EPUBPath::EPUBPath
EPUBPath(const std::string &path)
Definition EPUBPath.cpp:55
libepubgen::EPUBPath::swap
void swap(EPUBPath &other)
Definition EPUBPath.cpp:67
libepubgen::EPUBPath::operator==
friend bool operator==(const EPUBPath &left, const EPUBPath &right)
Definition EPUBPath.cpp:136
libepubgen::EPUBPath::appendComponent
void appendComponent(const std::string &pathComponent)
Definition EPUBPath.cpp:77
libepubgen::EPUBPath::m_title
std::string m_title
Definition EPUBPath.h:59
libepubgen::EPUBPath::addChapter
void addChapter(const std::string &chapter)
Adds chapter name (fixed layout).
Definition EPUBPath.cpp:121
libepubgen::EPUBPath::getChapters
const std::vector< std::string > & getChapters() const
Definition EPUBPath.cpp:126
libepubgen::EPUBPath::m_components
std::vector< std::string > m_components
Definition EPUBPath.h:58
libepubgen::EPUBPath::relativeTo
const Relative relativeTo(const EPUBPath &base) const
Definition EPUBPath.cpp:92
libepubgen::EPUBPath::appendTitle
void appendTitle(const std::string &title)
Definition EPUBPath.cpp:116
libepubgen::EPUBPath::getTitle
std::string getTitle() const
Definition EPUBPath.cpp:131
libepubgen
Definition EPUBBinaryContent.cpp:15
libepubgen::operator!=
bool operator!=(const EPUBPath &left, const EPUBPath &right)
Definition EPUBPath.cpp:141
libepubgen::swap
void swap(EPUBPath &left, EPUBPath &right)
Definition EPUBPath.cpp:160
libepubgen::operator==
bool operator==(const EPUBPath &left, const EPUBPath &right)
Definition EPUBPath.cpp:136
libepubgen::operator/
const EPUBPath operator/(const EPUBPath &base, const EPUBPath &subpath)
Definition EPUBPath.cpp:146