Mercurial > otakunoraifu
annotate system/file_impl.h @ 71:1fd20d231376
Fix objScale with 2D zoom; implement objWidth and objHeight.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Fri, 01 Apr 2011 23:49:12 +0200 |
parents | c3d4f9ee2cf1 |
children |
rev | line source |
---|---|
0 | 1 /* |
2 * Copyright (c) 2004 Kazunori "jagarl" Ueno | |
3 * All rights reserved. | |
4 * | |
5 * Redistribution and use in source and binary forms, with or without | |
6 * modification, are permitted provided that the following conditions | |
7 * are met: | |
8 * 1. Redistributions of source code must retain the above copyright | |
9 * notice, this list of conditions and the following disclaimer. | |
10 * 2. Redistributions in binary form must reproduce the above copyright | |
11 * notice, this list of conditions and the following disclaimer in the | |
12 * documentation and/or other materials provided with the distribution. | |
13 * 3. The name of the author may not be used to endorse or promote products | |
14 * derived from this software without specific prior written permission. | |
15 * | |
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
26 */ | |
27 | |
28 | |
29 | |
30 #ifndef __FILE_IMPL_H__ | |
31 #define __FILE_IMPL_H__ | |
32 | |
52 | 33 #include <vector> |
0 | 34 |
35 struct ARCFILE_ATOM { | |
36 char* filename; | |
37 char* filename_lower; | |
38 off_t offset; | |
39 int arcsize; | |
40 int filesize; | |
41 int private_data; | |
42 bool operator <(const ARCFILE_ATOM& to) const { | |
43 return strcmp(filename_lower, to.filename_lower) < 0; | |
44 } | |
45 bool operator <(char* const to) const { | |
46 return strcmp(filename_lower, to) < 0; | |
47 } | |
48 }; | |
49 | |
50 class ARCFILE { | |
52 | 51 protected: |
52 char* arcname; | |
53 char* filenames_orig; | |
54 int list_point; | |
55 std::vector<ARCFILE_ATOM> arc_atom; | |
56 typedef std::vector<ARCFILE_ATOM>::iterator iterator; | |
65
4416cfac86ae
Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents:
52
diff
changeset
|
57 ARCFILE* next; /* FILESEARCH の一つの型が複数の ARCFILE を持つとき、リストをつくる */ |
4416cfac86ae
Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents:
52
diff
changeset
|
58 /* arcname に指定されたファイル/ディレクトリの内容チェック */ |
52 | 59 virtual int CheckFileDeal(void); |
60 virtual void ListupFiles(int fname_len); | |
61 virtual ARCINFO* MakeARCINFO(ARCFILE_ATOM&); | |
62 iterator SearchName(const char* f, const char* ext=0); | |
63 public: | |
64 ARCFILE(const char* fname); | |
65 void SetNext(ARCFILE* _next) { delete next; next = _next;} | |
66 ARCFILE* Next(void) { return next; } | |
67 void Init(void); | |
68 virtual ~ARCFILE(); | |
65
4416cfac86ae
Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents:
52
diff
changeset
|
69 /* ファイル検索 */ |
52 | 70 class ARCINFO* Find(const char* fname, const char* ext); |
65
4416cfac86ae
Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents:
52
diff
changeset
|
71 /* ファイルリストの出力 */ |
52 | 72 int Deal(void) { Init(); return arc_atom.size(); } |
73 void ListFiles(FILE* out); | |
74 void InitList(void); | |
75 char* ListItem(void); | |
0 | 76 }; |
77 | |
78 class SCN2kFILE : public ARCFILE { | |
52 | 79 protected: |
80 virtual int CheckFileDeal(void); | |
81 virtual void ListupFiles(int fname_len); | |
82 virtual ARCINFO* MakeARCINFO(ARCFILE_ATOM& atom); | |
83 public: | |
69
c3d4f9ee2cf1
Convert the last non-Unicode japanese comments.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
65
diff
changeset
|
84 SCN2kFILE(const char* fname) : ARCFILE(fname) {} |
52 | 85 virtual ~SCN2kFILE() {} |
0 | 86 }; |
87 | |
88 class CattleyaFILE : public ARCFILE { | |
52 | 89 private: |
90 bool is_compress; | |
65
4416cfac86ae
Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents:
52
diff
changeset
|
91 /* header の Huffman 木構築用 */ |
52 | 92 char* bitbuf; |
93 char* bitbuf_end; | |
94 int ltree[0x400]; | |
95 int rtree[0x400]; | |
96 int treecnt; | |
97 int bitcnt; | |
98 int GetBit(void); | |
99 int GetCh(void); | |
100 void SetBuf(char* buf, int len); | |
101 int MakeTree(void); | |
102 int Decode(int seed); | |
0 | 103 |
52 | 104 protected: |
105 virtual int CheckFileDeal(void); | |
106 virtual void ListupFiles(int fname_len); | |
107 virtual ARCINFO* MakeARCINFO(ARCFILE_ATOM& atom); | |
108 | |
109 public: | |
110 CattleyaFILE(char* fname) : ARCFILE(fname) {is_compress = false;} | |
111 virtual ~CattleyaFILE() {} | |
0 | 112 }; |
113 | |
114 class NULFILE : public ARCFILE { | |
52 | 115 protected: |
116 virtual int CheckFileDeal(void); | |
117 virtual void ListupFiles(int fname_len); | |
118 virtual ARCINFO* MakeARCINFO(ARCFILE_ATOM& atom); | |
119 public: | |
120 NULFILE() : ARCFILE("") {} | |
121 virtual ~NULFILE() {} | |
0 | 122 }; |
52 | 123 |
0 | 124 class DIRFILE : public ARCFILE { |
52 | 125 protected: |
126 virtual int CheckFileDeal(void); | |
127 virtual void ListupFiles(int fname_len); | |
128 virtual ARCINFO* MakeARCINFO(ARCFILE_ATOM& atom); | |
129 public: | |
130 DIRFILE(char* fname) : ARCFILE(fname) {} | |
131 virtual ~DIRFILE() {} | |
65
4416cfac86ae
Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents:
52
diff
changeset
|
132 FILE* Open(const char* fname); /* FILE* を開く */ |
4416cfac86ae
Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents:
52
diff
changeset
|
133 char* SearchFile(const char* dirname); /* ファイル検索 */ |
0 | 134 }; |
52 | 135 |
0 | 136 class ARCINFO_AVG32 : public ARCINFO { |
52 | 137 protected: |
138 ARCINFO_AVG32(const char* name, ARCFILE_ATOM& atom) : ARCINFO(name, atom) { | |
139 } | |
140 virtual bool ExecExtract(void); | |
141 friend class ARCFILE; | |
0 | 142 }; |
52 | 143 |
0 | 144 class ARCINFO2k : public ARCINFO { |
52 | 145 private: |
146 static char decode_seed[256]; | |
147 static char decode_seed2[16]; | |
148 protected: | |
149 ARCINFO2k(const char* name, ARCFILE_ATOM& atom) : ARCINFO(name,atom) { | |
150 } | |
151 virtual bool ExecExtract(void); | |
152 friend class SCN2kFILE; | |
0 | 153 }; |
154 | |
155 class ARCINFOZ : public ARCINFO { | |
52 | 156 protected: |
157 ARCINFOZ(const char* name, ARCFILE_ATOM& atom) : ARCINFO(name, atom) { | |
158 } | |
159 virtual bool ExecExtract(void); | |
160 friend class DaemonBaneFILE; | |
161 friend class CattleyaFILE; | |
0 | 162 }; |
163 | |
164 #endif /* __FILE_IMPL_H__ */ |