]> git.tdb.fi Git - libs/datafile.git/blob - tool/packer.h
Add ability to put raw files in a pack
[libs/datafile.git] / tool / packer.h
1 #ifndef PACKER_H_
2 #define PACKER_H_
3
4 #include <string>
5 #include <msp/datafile/statement.h>
6 #include <msp/io/buffered.h>
7 #include <msp/io/file.h>
8
9 class DataTool;
10
11 class Packer
12 {
13 private:
14         struct Object
15         {
16                 std::string name;
17                 std::string keyword;
18         };
19
20         typedef std::list<Object> ObjectList;
21
22         DataTool &tool;
23         Msp::IO::File *tmp_file;
24         Msp::IO::Buffered *tmp_buf;
25         std::list<Msp::DataFile::Statement> directory;
26         unsigned dir_alloc;
27
28 public:
29         Packer(DataTool &);
30 private:
31         static Msp::IO::File *tempfile();
32 public:
33         ~Packer();
34
35         void pack_file(const std::string &);
36 private:
37         bool detect_raw(Msp::IO::Seekable &);
38         void transfer_datafile(Msp::IO::Base &, const std::string &, Msp::IO::Base &, ObjectList &);
39         void transfer_raw(Msp::IO::Base &, Msp::IO::Base &);
40 public:
41         void create_pack(const std::string &);
42 };
43
44 #endif