stromx  0.8.0
ZipFileOutput.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_ZIPFILEOUTPUT_H
18 #define STROMX_RUNTIME_ZIPFILEOUTPUT_H
19 
20 #include <sstream>
21 #include <vector>
22 #include "stromx/runtime/Config.h"
23 #include "stromx/runtime/FileOutput.h"
24 
25 struct zip;
26 
27 namespace stromx
28 {
29  namespace runtime
30  {
32  class STROMX_RUNTIME_API ZipFileOutput : public FileOutput
33  {
34  public:
41  explicit ZipFileOutput(const std::string & archive);
42  virtual ~ZipFileOutput();
43 
44  virtual void initialize(const std::string & filename);
45  virtual const std::string & getFilename() const;
46  virtual const std::string getText() const;
47 
48  virtual std::ostream & text();
49  virtual std::ostream & openFile(const std::string & ext, const OpenMode mode);
50  virtual std::ostream & file();
51  virtual void close();
52 
53  private:
54  void dumpFile();
55 
56  zip* m_archiveHandle;
57  bool m_initialized;
58  std::string m_archive;
59  std::string m_currentBasename;
60  std::string m_currentFilename;
61  std::ostringstream *m_currentFile;
62  std::ostringstream m_currentText;
63  std::vector<std::string> m_bufferedFiles;
64  };
65  }
66 }
67 
68 #endif // STROMX_RUNTIME_ZIPFILEOUTPUT_H
OpenMode
Definition: OutputProvider.h:31
The stromx class library.
Definition: AdjustRgbChannels.cpp:29
File output which stores the output data in a zip file.
Definition: ZipFileOutput.h:32
Provides functions to initialize an output provider.
Definition: FileOutput.h:27