00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __MX__H__CLAMP__H_
00020 #define __MX__H__CLAMP__H_
00021
00022
00023 #include "mx_exception.h"
00024 #include<zlib.h>
00025 #include<fstream>
00026 #include<vector>
00027
00028
00029
00030 namespace mx
00031 {
00032
00033 using std::fstream;
00034 using std::vector;
00035 using std::cout;
00036
00037
00038 struct mxClamp_info {
00039 char filename[256];
00040 unsigned int size_bytes, size_compressed;
00041 };
00042
00043 class mxClampOutFile {
00044
00045 public:
00046 explicit mxClampOutFile(string filename);
00047 ~mxClampOutFile();
00048
00049 bool openFile();
00050 bool openFile(string filename);
00051 bool writeToFile();
00052 bool addFile(string filename);
00053
00054 private:
00055 string fname;
00056 fstream file;
00057 vector<mxClamp_info> files;
00058 vector<string> file_names;
00059
00060 };
00061
00062 class mxClampResourceFile {
00063
00064 public:
00065 explicit mxClampResourceFile(string filename);
00066 ~mxClampResourceFile();
00067
00068
00069
00070
00071 void *operator[](string filename);
00072 void *accessRawBytes(string filename, unsigned int &size);
00073
00074 vector<mxClamp_info> file_names;
00075
00076 private:
00077
00078 void buildInfo();
00079 void reopen();
00080 vector<unsigned int> clamp_off;
00081
00082 fstream the_file;
00083 string fname;
00084
00085
00086 };
00087
00088
00089
00090 }
00091
00092
00093
00094 #endif
00095