-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzipfs.h
88 lines (70 loc) · 2.01 KB
/
zipfs.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#ifndef __ZIP_FILE_SYSTEM_H__
#define __ZIP_FILE_SYSTEM_H__
#include <stdio.h>
#include "af_file.h"
class ZDirEntry;
class ZRootEntry;
class ZEntry
{
protected :
char *m_name;
bool m_isDir;
ZDirEntry *m_parent;
int getFullNameI(char *name_buffer, int max);
public:
ZEntry *m_next;
ZEntry(ZDirEntry *m_parent, const char *name, int len, bool is_dir);
~ZEntry();
bool isSameName(const char *name, int len=-1);
bool isDir() { return m_isDir; }
int getFullName(char *name_buffer=NULL, int max=2048);
const char *name();
virtual ZEntry *findByName(const char *name, int len=-1) = 0;
ZDirEntry *getParent();
ZRootEntry *getRoot();
const char *zipFileName();
virtual void printAll(int level) = 0;
/**
* Increase reference count.
* @return Resulting reference count.
*/
int grab();
/**
* @return Resulting reference count.
*/
int release();
};
class ZFileEntry;
class ZDirEntry : public ZEntry
{
private :
ZEntry *m_fileList, *m_last;
int m_entryCount;
public:
ZDirEntry(ZDirEntry *parent, const char *name, int len);
~ZDirEntry();
ZEntry *findByName(const char *name, int len=-1);
ZFileEntry *addFileName(const char *name, int len=-1);
ZEntry *getFirst();
virtual void printAll(int level);
static ZRootEntry *getEntry(const char *f_name);
static void GC();
};
class ZFileEntry : public ZEntry
{
public:
int m_pos, m_size, m_csize;
public:
ZFileEntry(ZDirEntry *parent, const char *name, int len);
ZEntry *findByName(const char *name, int len=-1) { return NULL; }
virtual void printAll(int level);
};
class ZRootEntry : public ZDirEntry
{
public:
ZRootEntry();
~ZRootEntry();
public:
AF_FILE m_fd;
};
#endif