]> git.tdb.fi Git - libs/datafile.git/blobdiff - tool/packer.h
Add an intelligent packed collection class
[libs/datafile.git] / tool / packer.h
diff --git a/tool/packer.h b/tool/packer.h
new file mode 100644 (file)
index 0000000..351b45d
--- /dev/null
@@ -0,0 +1,37 @@
+#ifndef PACKER_H_
+#define PACKER_H_
+
+#include <string>
+#include <msp/datafile/statement.h>
+#include <msp/io/buffered.h>
+#include <msp/io/file.h>
+
+class DataTool;
+
+class Packer
+{
+private:
+       struct Object
+       {
+               std::string name;
+               std::string keyword;
+       };
+
+       DataTool &tool;
+       Msp::IO::File *tmp_file;
+       Msp::IO::Buffered *tmp_buf;
+       std::list<Msp::DataFile::Statement> directory;
+       unsigned dir_alloc;
+
+public:
+       Packer(DataTool &);
+private:
+       static Msp::IO::File *tempfile();
+public:
+       ~Packer();
+
+       void pack_file(const std::string &);
+       void create_pack(const std::string &);
+};
+
+#endif