]> git.tdb.fi Git - libs/datafile.git/blob - tool/packer.h
960fea6f391a2b49fd7420af193b069d4bdd66f3
[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::BufferedFile *tmp_file;
24         std::list<Msp::DataFile::Statement> directory;
25         unsigned dir_alloc;
26
27 public:
28         Packer(DataTool &);
29 private:
30         static Msp::IO::BufferedFile *tempfile();
31 public:
32         ~Packer();
33
34         void pack_file(const std::string &);
35 private:
36         bool detect_raw(Msp::IO::Seekable &);
37         void transfer_datafile(Msp::IO::Base &, const std::string &, Msp::IO::Base &, ObjectList &);
38         void transfer_raw(Msp::IO::Base &, Msp::IO::Base &);
39 public:
40         void create_pack(const std::string &);
41 };
42
43 #endif