stromx  0.8.0
ZipFileInput.h
1 /*
2 * Copyright 2012 Matthias Fuchs
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 
17 #ifndef STROMX_RUNTIME_ZIPFILEINPUT_H
18 #define STROMX_RUNTIME_ZIPFILEINPUT_H
19 
20 #include <sstream>
21 #include "stromx/runtime/Config.h"
22 #include "stromx/runtime/FileInput.h"
23 
24 struct zip;
25 
26 namespace stromx
27 {
28  namespace runtime
29  {
31  class STROMX_RUNTIME_API ZipFileInput : public FileInput
32  {
33  public:
40  explicit ZipFileInput(const std::string & archive);
41  virtual ~ZipFileInput();
42 
43  virtual void initialize(const std::string & text, const std::string & filename);
44 
45  virtual std::istream & text();
46  virtual bool hasFile() const;
47  virtual std::istream & openFile(const OpenMode mode);
48  virtual std::istream & file();
49  virtual void close();
50 
51  private:
52  zip* m_archiveHandle;
53  bool m_initialized;
54  std::string m_archive;
55  std::string m_currentFilename;
56  std::istringstream *m_currentFile;
57  std::istringstream m_currentText;
58  };
59  }
60 }
61 
62 #endif // STROMX_RUNTIME_ZIPFILEINPUT_H
Provides functions to initialize an input provider.
Definition: FileInput.h:27
The stromx class library.
Definition: AdjustRgbChannels.cpp:29
File input which reads the input files from a zip file.
Definition: ZipFileInput.h:31
OpenMode
Definition: InputProvider.h:31