]> git.tdb.fi Git - libs/datafile.git/blob - tool/packer.h
Cosmetic changes
[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_data(Msp::IO::Seekable &);
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_data(Msp::IO::Base &, const std::string &, Msp::IO::Base &);
40         void transfer_unknown(Msp::IO::Base &, Msp::IO::Base &);
41 public:
42         void create_pack(const std::string &);
43 };
44
45 #endif