13 inline bool is_zip(
const std::string& a_file,
bool& a_is){
14 unsigned char head[4];
15 {
unsigned int num = 4;
16 if(!
signature(a_file,head,num)) {a_is =
false;
return false;}
17 if(num!=4) {a_is =
false;
return true;}}
18 if(head[0]!=
'P') {a_is =
false;
return true;}
19 if(head[1]!=
'K') {a_is =
false;
return true;}
20 if(head[2]!=3) {a_is =
false;
return true;}
21 if(head[3]!=4) {a_is =
false;
return true;}
26 inline bool is_jpeg(
const std::string& a_file,
bool& a_is){
27 unsigned char head[4];
28 {
unsigned int num = 4;
29 if(!
signature(a_file,head,num)) {a_is =
false;
return false;}
30 if(num!=4) {a_is =
false;
return true;}}
31 if(head[0]!=255) {a_is =
false;
return true;}
32 if(head[1]!=216) {a_is =
false;
return true;}
33 if(head[2]!=255) {a_is =
false;
return true;}
39 inline bool is_ico(
const std::string& a_file,
bool& a_is){
40 unsigned char head[4];
41 {
unsigned int num = 4;
42 if(!
signature(a_file,head,num)) {a_is =
false;
return false;}
43 if(num!=4) {a_is =
false;
return true;}}
44 if(head[0]!=0) {a_is =
false;
return true;}
45 if(head[1]!=0) {a_is =
false;
return true;}
46 if(head[2]!=1) {a_is =
false;
return true;}
47 if(head[3]!=0) {a_is =
false;
return true;}
52 inline bool is_png(
const std::string& a_file,
bool& a_is){
53 unsigned char head[4];
54 {
unsigned int num = 4;
55 if(!
signature(a_file,head,num)) {a_is =
false;
return false;}
56 if(num!=4) {a_is =
false;
return true;}}
57 if(head[0]!=137) {a_is =
false;
return true;}
58 if(head[1]!=
'P') {a_is =
false;
return true;}
59 if(head[2]!=
'N') {a_is =
false;
return true;}
60 if(head[3]!=
'G') {a_is =
false;
return true;}
65 inline bool is_root(
const std::string& a_file,
bool& a_is){
66 unsigned char head[4];
67 {
unsigned int num = 4;
68 if(!
signature(a_file,head,num)) {a_is =
false;
return false;}
69 if(num!=4) {a_is =
false;
return true;}}
70 if(head[0]!=
'r') {a_is =
false;
return true;}
71 if(head[1]!=
'o') {a_is =
false;
return true;}
72 if(head[2]!=
'o') {a_is =
false;
return true;}
73 if(head[3]!=
't') {a_is =
false;
return true;}
78 inline bool is_iv(
const std::string& a_file,
bool& a_is){
79 unsigned char head[9];
80 {
unsigned int num = 9;
81 if(!
signature(a_file,head,num)) {a_is =
false;
return false;}
82 if(num!=9) {a_is =
false;
return true;}}
83 if(head[0]!=
'#') {a_is =
false;
return true;}
84 if(head[1]!=
'I') {a_is =
false;
return true;}
85 if(head[2]!=
'n') {a_is =
false;
return true;}
86 if(head[3]!=
'v') {a_is =
false;
return true;}
87 if(head[4]!=
'e') {a_is =
false;
return true;}
88 if(head[5]!=
'n') {a_is =
false;
return true;}
89 if(head[6]!=
't') {a_is =
false;
return true;}
90 if(head[7]!=
'o') {a_is =
false;
return true;}
91 if(head[8]!=
'r') {a_is =
false;
return true;}
96 inline bool is_wrl(
const std::string& a_file,
bool& a_is){
97 unsigned char head[5];
98 {
unsigned int num = 5;
99 if(!
signature(a_file,head,num)) {a_is =
false;
return false;}
100 if(num!=5) {a_is =
false;
return true;}}
101 if(head[0]!=
'#') {a_is =
false;
return true;}
102 if(head[1]!=
'V') {a_is =
false;
return true;}
103 if(head[2]!=
'R') {a_is =
false;
return true;}
104 if(head[3]!=
'M') {a_is =
false;
return true;}
105 if(head[4]!=
'L') {a_is =
false;
return true;}
110 inline bool is_fog(
const std::string& a_file,
bool& a_is){
111 unsigned char head[256];
112 {
unsigned int num = 256;
113 if(!
signature(a_file,head,num)) {a_is =
false;
return false;}
114 if(num!=256) {a_is =
false;
return true;}}
116 a_is = ::strstr((
const char*)head,
"#nb super-volumes")?
true:
false;
120 inline bool is_dot(
const std::string& a_file,
bool& a_is){
121 unsigned char head[8];
122 {
unsigned int num = 7;
123 if(!
signature(a_file,head,num)) {a_is =
false;
return false;}
124 if(num!=7) {a_is =
false;
return true;}}
126 a_is = ::strcmp((
const char*)head,
"digraph")?
false:
true;
130 inline bool is_dcm(
const std::string& a_file,
bool& a_is){
131 unsigned char head[132];
132 {
unsigned int num = 132;
133 if(!
signature(a_file,head,num)) {a_is =
false;
return false;}
134 if(num!=132) {a_is =
false;
return true;}}
135 if(head[128]!=
'D') {a_is =
false;
return true;}
136 if(head[129]!=
'I') {a_is =
false;
return true;}
137 if(head[130]!=
'C') {a_is =
false;
return true;}
138 if(head[131]!=
'M') {a_is =
false;
return true;}
143 inline bool is_gdml(
const std::string& a_file,
bool& a_is){
145 unsigned char head[1024];
146 {
unsigned int num = 1024;
147 if(!
signature(a_file,head,num)) {a_is =
false;
return false;}
148 if(num!=1024) {a_is =
false;
return true;}}
150 a_is = ::strstr((
const char*)head,
"<gdml")?
true:
false;
154 inline bool is_exsg(
unsigned int a_sz,
const char* a_buffer){
155 if(a_sz<5)
return false;
156 if(a_buffer[0]!=
'<')
return false;
157 if(a_buffer[1]!=
'e')
return false;
158 if(a_buffer[2]!=
'x')
return false;
159 if(a_buffer[3]!=
's')
return false;
160 if(a_buffer[4]!=
'g')
return false;
164 inline bool is_exsg(
const std::string& a_file,
bool& a_is){
165 unsigned char head[5];
166 {
unsigned int num = 5;
167 if(!
signature(a_file,head,num)) {a_is =
false;
return false;}
168 if(num!=5) {a_is =
false;
return true;}}
169 a_is =
is_exsg(5,(
const char*)head);
173 inline bool is_bsg(
unsigned int a_sz,
const char* a_buffer){
174 if(a_sz<7)
return false;
175 if(a_buffer[0]!=
'i')
return false;
176 if(a_buffer[1]!=
'n')
return false;
177 if(a_buffer[2]!=
'e')
return false;
178 if(a_buffer[3]!=
'x')
return false;
179 if(a_buffer[4]!=
'b')
return false;
180 if(a_buffer[5]!=
's')
return false;
181 if(a_buffer[6]!=
'g')
return false;
185 inline bool is_bsg(
const std::string& a_file,
bool& a_is){
186 unsigned char head[7];
187 {
unsigned int num = 7;
188 if(!
signature(a_file,head,num)) {a_is =
false;
return false;}
189 if(num!=7) {a_is =
false;
return true;}}
190 a_is =
is_bsg(7,(
const char*)head);
195 unsigned char head[10];
196 {
unsigned int num = 10;
197 if(!
signature(a_file,head,num)) {a_is =
false;
return false;}
198 if(num!=10) {a_is =
false;
return true;}}
199 if(head[0]!=
'<') {a_is =
false;
return true;}
200 if(head[1]!=
's') {a_is =
false;
return true;}
201 if(head[2]!=
'c') {a_is =
false;
return true;}
202 if(head[3]!=
'e') {a_is =
false;
return true;}
203 if(head[4]!=
'n') {a_is =
false;
return true;}
204 if(head[5]!=
'a') {a_is =
false;
return true;}
205 if(head[6]!=
'r') {a_is =
false;
return true;}
206 if(head[7]!=
'i') {a_is =
false;
return true;}
207 if(head[8]!=
'o') {a_is =
false;
return true;}
208 if(head[9]!=
's') {a_is =
false;
return true;}
213 inline bool is_slides(
const std::string& a_file,
bool& a_is){
214 unsigned char head[7];
215 {
unsigned int num = 7;
216 if(!
signature(a_file,head,num)) {a_is =
false;
return false;}
217 if(num!=7) {a_is =
false;
return true;}}
218 if(head[0]!=
'<') {a_is =
false;
return true;}
219 if(head[1]!=
's') {a_is =
false;
return true;}
220 if(head[2]!=
'l') {a_is =
false;
return true;}
221 if(head[3]!=
'i') {a_is =
false;
return true;}
222 if(head[4]!=
'd') {a_is =
false;
return true;}
223 if(head[5]!=
'e') {a_is =
false;
return true;}
224 if(head[6]!=
's') {a_is =
false;
return true;}
229 inline bool is_fits(
const std::string& a_file,
bool& a_is){
230 unsigned char head[6];
231 {
unsigned int num = 6;
232 if(!
signature(a_file,head,num)) {a_is =
false;
return false;}
233 if(num!=6) {a_is =
false;
return true;}}
234 if(head[0]!=
'S') {a_is =
false;
return true;}
235 if(head[1]!=
'I') {a_is =
false;
return true;}
236 if(head[2]!=
'M') {a_is =
false;
return true;}
237 if(head[3]!=
'P') {a_is =
false;
return true;}
238 if(head[4]!=
'L') {a_is =
false;
return true;}
239 if(head[5]!=
'E') {a_is =
false;
return true;}
244 inline bool is_hdf(
const std::string& a_file,
bool& a_is){
245 unsigned char head[4];
246 {
unsigned int num = 4;
247 if(!
signature(a_file,head,num)) {a_is =
false;
return false;}
248 if(num!=4) {a_is =
false;
return true;}}
249 if(head[0]!=137) {a_is =
false;
return true;}
250 if(head[1]!=
'H') {a_is =
false;
return true;}
251 if(head[2]!=
'D') {a_is =
false;
return true;}
252 if(head[3]!=
'F') {a_is =
false;
return true;}
257 inline bool is_ps(
const std::string& a_file,
bool& a_is){
258 unsigned char head[4];
259 {
unsigned int num = 4;
260 if(!
signature(a_file,head,num)) {a_is =
false;
return false;}
261 if(num!=4) {a_is =
false;
return true;}}
262 if(head[0]!=
'%') {a_is =
false;
return true;}
263 if(head[1]!=
'!') {a_is =
false;
return true;}
264 if(head[2]!=
'P') {a_is =
false;
return true;}
265 if(head[3]!=
'S') {a_is =
false;
return true;}
270 inline bool is_simbad(
const std::string& a_file,
bool& a_is){
271 unsigned char head[10];
272 {
unsigned int num = 10;
273 if(!
signature(a_file,head,num)) {a_is =
false;
return false;}
274 if(num!=10) {a_is =
false;
return true;}}
275 if(head[0]!=
':') {a_is =
false;
return true;}
276 if(head[1]!=
':') {a_is =
false;
return true;}
277 if(head[2]!=
's') {a_is =
false;
return true;}
278 if(head[3]!=
'c') {a_is =
false;
return true;}
279 if(head[4]!=
'r') {a_is =
false;
return true;}
280 if(head[5]!=
'i') {a_is =
false;
return true;}
281 if(head[6]!=
'p') {a_is =
false;
return true;}
282 if(head[7]!=
't') {a_is =
false;
return true;}
283 if(head[8]!=
':') {a_is =
false;
return true;}
284 if(head[9]!=
':') {a_is =
false;
return true;}
296 inline bool is_aida(
const std::string& a_file,
bool& a_is){
298 if(!
size(a_file,sz)) {a_is =
false;
return false;}
301 unsigned char head[1024];
302 {
unsigned int num = 1024;
303 if(!
signature(a_file,head,num)) {a_is =
false;
return false;}
304 if(num!=1024) {a_is =
false;
return true;}}
306 a_is = ::strstr((
const char*)head,
"<aida")?
true:
false;
310 inline bool is_jive(
const std::string& a_file,
bool& a_is){
312 if(!
size(a_file,sz)) {a_is =
false;
return false;}
315 unsigned char head[1024];
316 {
unsigned int num = 1024;
317 if(!
signature(a_file,head,num)) {a_is =
false;
return false;}
318 if(num!=1024) {a_is =
false;
return true;}}
320 if(::strstr((
const char*)head,
"<?ATLAS")) {a_is =
true;
return true;}
321 a_is = ::strstr((
const char*)head,
"<!DOCTYPE Event")?
true:
false;
325 inline bool is_heprep(
const std::string& a_file,
bool& a_is){
327 if(!
size(a_file,sz)) {a_is =
false;
return false;}
330 unsigned char head[1024];
331 {
unsigned int num = 1024;
332 if(!
signature(a_file,head,num)) {a_is =
false;
return false;}
333 if(num!=1024) {a_is =
false;
return true;}}
335 a_is = ::strstr((
const char*)head,
"<heprep")?
true:
false;
346 inline bool is_shp(
const std::string& a_file,
bool& a_is){
348 if(!
size(a_file,sz)) {a_is =
false;
return false;}
350 unsigned char head[100];
351 {
unsigned int num = 100;
352 if(!
signature(a_file,head,num)) {a_is =
false;
return false;}
353 if(num!=100) {a_is =
false;
return true;}}
354 unsigned int _sz = (
static_cast<unsigned int>(head[24])<<24)|(head[25]<<16)|(head[26]<<8)|head[27];
355 if(_sz<(UINT_MAX/2)) _sz *= 2;
356 else _sz = (UINT_MAX/2)*2;
357 a_is = sz==long(_sz)?
true:
false;