/src/libetonyek/src/lib/IWORKSubDirStream.cpp
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* |
3 | | * This file is part of the libetonyek 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 | | #include "IWORKSubDirStream.h" |
11 | | |
12 | | #include <cassert> |
13 | | |
14 | | namespace libetonyek |
15 | | { |
16 | | |
17 | | namespace |
18 | | { |
19 | | |
20 | | std::string getDelimited(const std::string &path) |
21 | 335 | { |
22 | 335 | if (path.empty() || path.back() == '/') |
23 | 0 | return path; |
24 | 335 | else |
25 | 335 | return path + '/'; |
26 | 335 | } |
27 | | |
28 | | } |
29 | | |
30 | | IWORKSubDirStream::IWORKSubDirStream(const RVNGInputStreamPtr_t &parent, const std::string &dir) |
31 | 335 | : m_parent(parent) |
32 | 335 | , m_dir(getDelimited(dir)) |
33 | 335 | { |
34 | 335 | assert(bool(m_parent)); |
35 | 335 | assert(m_parent->isStructured()); |
36 | 335 | } |
37 | | |
38 | | IWORKSubDirStream::~IWORKSubDirStream() |
39 | 335 | { |
40 | 335 | } |
41 | | |
42 | | bool IWORKSubDirStream::isStructured() |
43 | 0 | { |
44 | 0 | return true; |
45 | 0 | } |
46 | | |
47 | | unsigned IWORKSubDirStream::subStreamCount() |
48 | 0 | { |
49 | | // TODO: implement me |
50 | 0 | return 0; |
51 | 0 | } |
52 | | |
53 | | const char *IWORKSubDirStream::subStreamName(unsigned id) |
54 | 0 | { |
55 | | // TODO: implement me |
56 | 0 | (void) id; |
57 | 0 | return nullptr; |
58 | 0 | } |
59 | | |
60 | | bool IWORKSubDirStream::existsSubStream(const char *name) |
61 | 1.00k | { |
62 | 1.00k | const std::string path = m_dir + name; |
63 | 1.00k | return m_parent->existsSubStream(path.c_str()); |
64 | 1.00k | } |
65 | | |
66 | | librevenge::RVNGInputStream *IWORKSubDirStream::getSubStreamByName(const char *name) |
67 | 14 | { |
68 | 14 | const std::string path = m_dir + name; |
69 | 14 | return m_parent->getSubStreamByName(path.c_str()); |
70 | 14 | } |
71 | | |
72 | | librevenge::RVNGInputStream *IWORKSubDirStream::getSubStreamById(unsigned id) |
73 | 0 | { |
74 | | // TODO: implement me |
75 | 0 | (void) id; |
76 | 0 | return nullptr; |
77 | 0 | } |
78 | | |
79 | | const unsigned char *IWORKSubDirStream::read(const unsigned long, unsigned long &) |
80 | 0 | { |
81 | 0 | return nullptr; |
82 | 0 | } |
83 | | |
84 | | int IWORKSubDirStream::seek(long, const librevenge::RVNG_SEEK_TYPE) |
85 | 0 | { |
86 | 0 | return 0; |
87 | 0 | } |
88 | | |
89 | | long IWORKSubDirStream::tell() |
90 | 0 | { |
91 | 0 | return 0; |
92 | 0 | } |
93 | | |
94 | | bool IWORKSubDirStream::isEnd() |
95 | 0 | { |
96 | 0 | return true; |
97 | 0 | } |
98 | | |
99 | | } |
100 | | |
101 | | /* vim:set shiftwidth=2 softtabstop=2 expandtab: */ |