00001 00023 #ifndef _LIBCOMPREX_DIRECTORY_H_ 00024 #define _LIBCOMPREX_DIRECTORY_H_ 00025 00026 #ifdef __cplusplus 00027 extern "C" { 00028 #endif 00029 00030 typedef struct _CxDirectory CxDirectory; 00032 #include <libcomprex/file.h> 00033 00037 struct _CxDirectory 00038 { 00039 CxArchive *archive; 00040 CxDirectory *parentDir; 00041 char *name; 00043 CxFile *files; 00044 CxFile *lastFile; 00045 unsigned int fileCount; 00047 CxDirectory *subdirs; 00048 CxDirectory *lastSubDir; 00049 unsigned int subdirCount; 00052 unsigned int refCount; 00054 CxDirectory *prev; 00055 CxDirectory *next; 00056 }; 00057 00058 /**************************************************************************/ 00060 /**************************************************************************/ 00074 CxDirectory *cxNewDirectory(void); 00075 00083 void cxDestroyDirectory(CxDirectory *dir); 00084 00087 /**************************************************************************/ 00089 /**************************************************************************/ 00102 void cxSetDirArchive(CxDirectory *dir, CxArchive *archive); 00103 00112 void cxSetDirParent(CxDirectory *dir, CxDirectory *parent); 00113 00122 void cxSetDirectoryName(CxDirectory *dir, const char *name); 00123 00126 /**************************************************************************/ 00128 /**************************************************************************/ 00140 CxArchive *cxGetDirArchive(CxDirectory *dir); 00141 00151 CxDirectory *cxGetDirParent(CxDirectory *dir); 00152 00162 const char *cxGetDirectoryName(CxDirectory *dir); 00163 00173 unsigned int cxGetFileCount(CxDirectory *dir); 00174 00184 unsigned int cxGetSubDirCount(CxDirectory *dir); 00185 00188 /**************************************************************************/ 00190 /**************************************************************************/ 00203 CxDirectory *cxGetDirectory(CxDirectory *base, const char *path); 00204 00215 CxFile *cxGetFile(CxDirectory *base, const char *path); 00216 00219 /**************************************************************************/ 00221 /**************************************************************************/ 00242 void cxDirAddFile(CxDirectory *dir, CxFile *file); 00243 00262 void cxDirAddSubDir(CxDirectory *dir, CxDirectory *subdir); 00263 00278 void cxDirRemoveFile(CxDirectory *dir, CxFile *file); 00279 00294 void cxDirRemoveSubDir(CxDirectory *dir, CxDirectory *subdir); 00295 00298 /**************************************************************************/ 00300 /**************************************************************************/ 00314 CxFile *cxGetFirstFile(CxDirectory *dir); 00315 00327 CxDirectory *cxGetFirstSubDir(CxDirectory *dir); 00328 00339 CxDirectory *cxGetPreviousDir(CxDirectory *dir); 00340 00351 CxDirectory *cxGetNextDir(CxDirectory *dir); 00352 00355 #ifdef __cplusplus 00356 } 00357 #endif 00358 00359 #endif /* _LIBCOMPREX_DIRECTORY_H_ */ 00360