libxcks  0.1.0.1
xcksreader.hpp
Go to the documentation of this file.
1 /*
2  * libxcks
3  * Copyright (C) 2022 Julien Couot
4  *
5  * This program is free software: you can redistribute it and/or modify it
6  * under the terms of the GNU Lesser General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or (at your
8  * option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13  * License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this program. If not, see <https://www.gnu.org/licenses/>.
17  */
18 
25 #ifndef INC_XCKSREADER_HPP_060B6688_7797_4BA8_937A_FB4721C046BD
26 #define INC_XCKSREADER_HPP_060B6688_7797_4BA8_937A_FB4721C046BD
27 
28 //---------------------------------------------------------------------------
29 #include <istream>
30 // #include <filesystem> // Included in "libxcks/types.hpp"
31 // #include <string> // Included in "libxcks/types.hpp"
32 
33 // #include "libxcks/types.hpp" // Included in #include "libxcks/handlers.hpp"
34 // #include "libxcks/defs.hpp" // Included in #include "libxcks/handlers.hpp"
35 // #include "libxcks/export.hpp" // Included in #include "libxcks/handlers.hpp"
36 #include "libxcks/handlers.hpp"
37 //---------------------------------------------------------------------------
38 
39 
40 namespace libxcks
41 {
45 class LIBXCKS_SO_EXPORT XCKSReader
46 {
47  protected:
49 
50  public:
52  XCKSReader() = delete;
53 
55  XCKSReader(const XCKSReader&) = delete;
56 
58  XCKSReader& operator=(const XCKSReader&) = delete;
59 
65  XCKSReader(XCKSReaderHandler& xcksReaderHandler);
66 
68  virtual ~XCKSReader();
69 
83  virtual bool parse(std::istream& is, const std::filesystem::path& basePath);
84 
96  virtual bool parse(const std::filesystem::path& fileFullPath);
97 
113  virtual bool parse(const std::filesystem::path& filePath,
114  const std::filesystem::path& basePath);
115 
130  static bool parseXCKS(XCKSReaderHandler& xcksReaderHandler,
131  std::istream& is, const std::filesystem::path& basePath);
132 
145  static bool parseXCKS(XCKSReaderHandler& xcksReaderHandler,
146  const std::filesystem::path& fileFullPath);
147 
164  static bool parseXCKS(XCKSReaderHandler& xcksReaderHandler,
165  const std::filesystem::path& filePath,
166  const std::filesystem::path& basePath);
167 };
168 //---------------------------------------------------------------------------
169 
170 
171 
175 class LIBXCKS_SO_EXPORT ZXCKSReader final : public XCKSReader
176 {
177  public:
179  ZXCKSReader() = delete;
180 
182  ZXCKSReader(const ZXCKSReader&) = delete;
183 
185  ZXCKSReader& operator=(const ZXCKSReader&) = delete;
186 
192  ZXCKSReader(XCKSReaderHandler& xcksReaderHandler);
193 
195  virtual ~ZXCKSReader();
196 
210  bool parse(std::istream& is, const std::filesystem::path& basePath) override;
211 
212  // Make others parse methods of XCKSReader base class in this scope.
213  using XCKSReader::parse;
214 
229  static bool parseZXCKS(XCKSReaderHandler& xcksReaderHandler,
230  std::istream& is, const std::filesystem::path& basePath);
231 
244  static bool parseZXCKS(XCKSReaderHandler& xcksReaderHandler,
245  const std::filesystem::path& fileFullPath);
246 
263  static bool parseZXCKS(XCKSReaderHandler& xcksReaderHandler,
264  const std::filesystem::path& filePath,
265  const std::filesystem::path& basePath);
266 };
267 //---------------------------------------------------------------------------
268 
269 } // namespace libxcks
270 //---------------------------------------------------------------------------
271 
272 #endif // INC_XCKSREADER_HPP_060B6688_7797_4BA8_937A_FB4721C046BD
Handler for reading XCKS files.
Definition: handlers.hpp:50
XCKS file reader.
Definition: xcksreader.hpp:46
virtual bool parse(std::istream &is, const std::filesystem::path &basePath)
Parses an XCKS file from an input stream.
Definition: xcksreader.cpp:73
XCKSReader & operator=(const XCKSReader &)=delete
Deleted copy assignment operator.
XCKSReader()=delete
Deleted default constructor.
XCKSReader(const XCKSReader &)=delete
Deleted copy constructor.
XCKSReaderHandler & readerHandler
The XCKS file reader handler.
Definition: xcksreader.hpp:48
ZXCKS file reader.
Definition: xcksreader.hpp:176
ZXCKSReader()=delete
Deleted default constructor.
ZXCKSReader(const ZXCKSReader &)=delete
Deleted copy constructor.
ZXCKSReader & operator=(const ZXCKSReader &)=delete
Deleted copy assignment operator.
Handlers for reading and writing XCKS files.