Verovio
Source code documentation
filereader.h
1 // Name: filereader.h
3 // Author: Laurent Pugin
4 // Created: 31/01/2024
5 // Copyright (c) Authors and others. All rights reserved.
7 
8 #ifndef __VRV_FILEREADER_H__
9 #define __VRV_FILEREADER_H__
10 
11 #include <list>
12 #include <string>
13 #include <vector>
14 
15 //----------------------------------------------------------------------------
16 
18 namespace miniz_cpp {
19 class zip_file;
20 }
21 
22 //----------------------------------------------------------------------------
23 
24 namespace vrv {
25 
27 bool InflateZlib(
28  const unsigned char *source, size_t sourceLength, unsigned char *destination, size_t destinationLength);
29 
30 //----------------------------------------------------------------------------
31 // ZipFileReader
32 //----------------------------------------------------------------------------
33 
38 public:
43  ZipFileReader();
44  ~ZipFileReader();
46 
50  void Reset();
51 
55  bool Load(const std::string &filename);
56 
60  bool LoadBytes(const std::vector<unsigned char> &bytes);
61 
65  bool HasFile(const std::string &filename);
66 
71  std::string ReadTextFile(const std::string &filename);
72 
76  std::list<std::string> GetFileList() const;
77 
78 private:
79  //
80 public:
81  //
82 private:
84  miniz_cpp::zip_file *m_file;
85 
86 }; // class ZipFileReader
87 
88 } // namespace vrv
89 
90 #endif // __VRV_FILEREADER_H__
This class is a reader for zip archives.
Definition: filereader.h:37
bool Load(const std::string &filename)
Load a file into memory.
std::string ReadTextFile(const std::string &filename)
Read the text file.
bool HasFile(const std::string &filename)
Check if the archive contains the file.
void Reset()
Reset a previously loaded file.
std::list< std::string > GetFileList() const
Return a list of all files (including directories)
bool LoadBytes(const std::vector< unsigned char > &bytes)
Load a vector into memory.
Forward declaration of the zip_file.hpp class.
Definition: filereader.h:18