add some hacky code to allow passing sfc files with -b
[openc2e.git] / pray.h
blob8c5d1f30b061f3033ec6339cf3ece4200036a4ee
1 /*
2 * pray.h
3 * openc2e
5 * Created by Alyssa Milburn on Mon Jan 16 2006.
6 * Copyright (c) 2006 Alyssa Milburn. All rights reserved.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
20 #ifndef PRAY_H
21 #define PRAY_H
23 #include <vector>
24 #include <map>
25 #include <string>
26 #include <fstream>
27 #include <boost/filesystem/path.hpp>
29 namespace fs = boost::filesystem;
31 class prayBlock;
33 class prayFile {
34 protected:
35 fs::path path;
36 std::ifstream file;
38 public:
39 std::vector<prayBlock *> blocks;
41 prayFile(fs::path filepath);
42 ~prayFile();
43 fs::path getPath() { return path; }
44 std::istream &getStream() { return file; }
47 class prayBlock {
48 protected:
49 bool loaded;
50 bool tagsloaded;
51 prayFile *parent;
52 unsigned char *buffer;
54 std::streampos offset;
55 bool compressed;
56 unsigned int size, compressedsize;
58 public:
59 prayBlock(prayFile *p);
60 ~prayBlock();
61 void load();
62 void parseTags();
64 std::string type;
65 std::string name;
66 std::map<std::string, std::string> stringValues;
67 std::map<std::string, int> integerValues;
69 bool isCompressed() { return compressed; }
70 bool isLoaded() { return loaded; }
71 prayFile *getParent() { return parent; }
72 std::string getType() { return type; }
73 std::string getName() { return name; }
74 unsigned char *getBuffer() { assert(loaded); return buffer; }
75 unsigned int getSize() { return size; }
78 #endif
79 /* vim: set noet: */