47 #ifndef CCXX_CONFIG_H_
51 #ifndef CCXX_MISSING_H_
55 #ifndef CCXX_THREAD_H_
59 #ifndef CCXX_EXCEPTION_H_
66 # include <sys/types.h>
71 # include <sys/stat.h>
72 # include <sys/mman.h>
74 # if __BORLANDC__ >= 0x0560
76 # include <sys/stat.h>
87 #include <mach-o/dyld.h>
90 #ifdef CCXX_NAMESPACES
99 #define caddr_t char *
102 #if !defined(__BORLANDC__) || __BORLANDC__ >= 0x0560
141 accessReadOnly = O_RDONLY,
142 accessWriteOnly= O_WRONLY,
143 accessReadWrite = O_RDWR
145 accessReadOnly = GENERIC_READ,
146 accessWriteOnly = GENERIC_WRITE,
147 accessReadWrite = GENERIC_READ | GENERIC_WRITE
172 openReadOnly = O_RDONLY,
173 openWriteOnly = O_WRONLY,
174 openReadWrite = O_RDWR,
175 openAppend = O_WRONLY | O_APPEND,
177 openSync = O_RDWR | O_SYNC,
181 openTruncate = O_RDWR | O_TRUNC
205 #else // defined WIN32
229 mappedRead = accessReadOnly,
230 mappedWrite = accessWriteOnly,
231 mappedReadWrite = accessReadWrite
243 static const char *getExtension(
const char *path);
244 static const char *getFilename(
const char *path);
245 static char *getFilename(
const char *path,
char *buffer,
size_t size =
NAME_MAX);
246 static char *getDirname(
const char *path,
char *buffer,
size_t size =
PATH_MAX);
247 static char *getRealpath(
const char *path,
char *buffer,
size_t size =
PATH_MAX);
263 #ifdef HAVE_READDIR_R
265 char save_space[
sizeof(
struct dirent) +
PATH_MAX + 1];
267 struct dirent *entry;
270 WIN32_FIND_DATA data, fdata;
275 Dir(
const char *name = NULL);
277 static bool create(
const char *path,
Attr attr = attrGroup);
278 static bool remove(
const char *path);
279 static bool setPrefix(
const char *path);
280 static bool getPrefix(
char *path,
size_t size =
PATH_MAX);
282 void open(
const char *name);
287 const char *getName(
void);
295 const char *operator*();
320 unsigned max, current, prefixpos;
332 virtual bool filter(
const char *file,
struct stat *ino);
342 DirTree(
const char *prefix,
unsigned maxdepth);
358 void open(
const char *prefix);
383 unsigned perform(
const char *prefix);
439 Error
error(Error errid,
char *errstr = NULL);
448 {
return error(errExtended, err);};
457 {flags.thrown = !enable;};
467 Error setCompletion(Complete mode);
477 {flags.temp = enable;};
490 virtual Attr initialize(
void);
518 off_t getCapacity(
void);
525 virtual Error restart(
void);
543 bool operator!(
void);
571 Error open(
const char *path);
628 off_t getPosition(
void);
630 bool operator++(
void);
631 bool operator--(
void);
652 Error open(
const char *path);
682 {
return open(pathname);};
716 Error clear(
ccxx_size_t length = 0, off_t pos = -1);
731 off_t getPosition(
void);
733 bool operator++(
void);
734 bool operator--(
void);
809 void sync(
caddr_t address,
size_t len);
819 void update(
size_t offset = 0,
size_t len = 0);
828 void update(
caddr_t address,
size_t len);
836 void release(
caddr_t address,
size_t len);
847 {
return ((
char *)(fcb.address)) + offset;};
857 caddr_t fetch(off_t pos,
size_t len);
877 size_t pageAligned(
size_t size);
899 #if defined(HAVE_MACH_DYLD)
901 #elif defined(HAVE_SHL_LOAD)
908 void loader(
const char *filename,
bool resolve);
919 {loader(filename,
true);};
921 DSO(
const char *filename,
bool resolve)
922 {loader(filename, resolve);};
924 DSO(
const char *filename)
926 DSO(
const char *filename,
bool resolve)
948 void* operator[](
const char *sym);
950 void *operator[](
const char *)
955 static void dynunload(
void);
957 static void dynunload(
void)
966 static DSO *getObject(
const char *name);
978 static void setDebug(
void);
982 bool __EXPORT isDir(
const char *path);
984 bool __EXPORT isFile(
const char *path);
987 bool __EXPORT isDevice(
const char *path);
990 inline bool isDevice(
const char *path)
994 bool __EXPORT canAccess(
const char *path);
996 bool __EXPORT canModify(
const char *path);
998 time_t
__EXPORT lastModified(
const char *path);
1000 time_t
__EXPORT lastAccessed(
const char *path);
1002 #ifdef COMMON_STD_EXCEPTION
1004 class DirException :
public IOException
1007 DirException(
const String &str) : IOException(str) {};
1010 class __EXPORT DSOException :
public IOException
1013 DSOException(
const String &str) : IOException(str) {};
1016 class __EXPORT FileException :
public IOException
1019 FileException(
const String &str) : IOException(str) {};
1024 #ifdef CCXX_NAMESPACES