-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.h
109 lines (61 loc) · 1.58 KB
/
main.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#include <list>
using namespace std;
#include "utils.h"
#include "names.h"
extern Names *names;
//extern FileMemory* dir_memory;
class dir_entry;
class file_entry;
class file_hash{
public:
uint32_t count;
list<file_entry *> files;
};
class file_entry{
public:
dir_entry * parrent;
char* name;
size_t length;
int fd = 0;
int open_file( void );
void close_file( void );
void print_path( void );
void update_hash( void );
};
uint64_t cur_dir_id =0;
class dir_entry{
private:
uint64_t id;
char* name;
dir_entry * parrent;
public:
list<dir_entry *> sub_dirs;
list<file_entry *> files;
dir_entry( dir_entry *parrent_p, const char* name_p ){
this->id=cur_dir_id++;
this->parrent = parrent_p;
uint64_t id_t;
/*uint64_t parrent_id = 0;
if ( parrent_p != 0 )
parrent_id = parrent_p->id;
*/
char* name_t = names->get_name( name_p, &id_t );
this->name = name_t;
//printf("new dir : %s ( %" PRIu64 " / %" PRIu64 " / %" PRIu64 " )\n", name_t, this->id, parrent_id , id_t);
//print_path();printf("\n");
/*dir_memory->add_uint16_t( this->id );
dir_memory->add_uint16_t( id_t );
dir_memory->add_uint64_t( parrent_id );
* */
if ( parrent_p != 0 ){
//exit ( 1 );
//sleep(1);
parrent_p->sub_dirs.push_back( this );
}
}
void print_path( void );
void print_dirs( int level );
void update_hashes( void );
// Utility um den original Pfad zusammen zu bauen
uint32_t add_path( char* buffer,uint32_t length );
};