annotate Core/Compression/ZipWriter.h @ 81:0ec5e2e327b1

zip writer
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 24 Sep 2012 10:33:41 +0200
parents
children 5317ff5cecc0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
81
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 #pragma once
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 #include <stdint.h>
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 #include <string.h>
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 #include <boost/shared_ptr.hpp>
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 namespace Orthanc
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 {
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 class ZipWriter
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 {
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 private:
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 struct PImpl;
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 boost::shared_ptr<PImpl> pimpl_;
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 bool hasFileInZip_;
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 uint8_t compressionLevel_;
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 std::string path_;
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 public:
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 ZipWriter();
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 ~ZipWriter();
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 void SetCompressionLevel(uint8_t level);
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 uint8_t GetCompressionLevel() const
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 {
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 return compressionLevel_;
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 }
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 void Open();
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 void Close();
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 bool IsOpen() const;
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 void SetOutputPath(const char* path);
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 const std::string& GetOutputPath() const
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 {
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 return path_;
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 }
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 void CreateFileInZip(const char* path);
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 void Write(const char* data, size_t length);
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 void Write(const std::string& data);
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 };
0ec5e2e327b1 zip writer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 }