diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Core/Compression/ZipWriter.h	Mon Sep 24 10:33:41 2012 +0200
@@ -0,0 +1,50 @@
+#pragma once
+
+#include <stdint.h>
+#include <string.h>
+#include <boost/shared_ptr.hpp>
+
+namespace Orthanc
+{
+  class ZipWriter
+  {
+  private:
+    struct PImpl;
+    boost::shared_ptr<PImpl> pimpl_;
+
+    bool hasFileInZip_;
+    uint8_t compressionLevel_;
+    std::string path_;
+
+  public:
+    ZipWriter();
+
+    ~ZipWriter();
+
+    void SetCompressionLevel(uint8_t level);
+
+    uint8_t GetCompressionLevel() const
+    {
+      return compressionLevel_;
+    }
+    
+    void Open();
+
+    void Close();
+
+    bool IsOpen() const;
+
+    void SetOutputPath(const char* path);
+
+    const std::string& GetOutputPath() const
+    {
+      return path_;
+    }
+
+    void CreateFileInZip(const char* path);
+
+    void Write(const char* data, size_t length);
+
+    void Write(const std::string& data);
+  };
+}