-
Notifications
You must be signed in to change notification settings - Fork 5
/
dirinfo.h
51 lines (43 loc) · 1.12 KB
/
dirinfo.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
#ifndef DIRINFO_H
#define DIRINFO_H
/**
* Very simplistic array-like structure to hold directory entries.
*/
typedef struct {
int count; /* Number of elements */
char** entries; /* Pointer to the entries */
} dirInfo;
enum dirInfoType { F=1,D };
/**
* dirInfo structur with path information
*
* dirInfo pointer is null for files
*/
typedef struct {
enum dirInfoType type;
char* path;
dirInfo* di;
} namedDirInfo;
/**
* Parses the directory given by filePath into a dirInfo structure.
*/
dirInfo* parseDir(char *filePath);
/**
* Prints the information contained in the given dirInfo structure.
*/
void printDirInfo( dirInfo *di );
/**
* Adds an entry to the given dirInfo structure.
*/
dirInfo* addEntry( dirInfo* di, char* entry );
/**
* Checks if entry is contained in the given dirInfo structure.
*/
int contains(dirInfo *di, char* entry);
/**
* Compute the symmetric set difference of the contents of
* two folders. (That is, it returns what is left over when
* you subtract the intersection from the union.)
*/
dirInfo* symmetricDifference( dirInfo *di1, dirInfo *di2 );
#endif