46 #ifndef CCXX_CONFIG_H_
50 #ifndef CCXX_MISSING_H_
54 #ifndef CCXX_THREAD_H_
58 #ifndef CCXX_EXCEPTION_H_
65 # include <sys/types.h>
70 # include <sys/stat.h>
71 # include <sys/mman.h>
73 # if __BORLANDC__ >= 0x0560
75 # include <sys/stat.h>
86 #include <mach-o/dyld.h>
89 #ifdef CCXX_NAMESPACES
98 #define caddr_t char *
101 #if !defined(__BORLANDC__) || __BORLANDC__ >= 0x0560
140 accessReadOnly = O_RDONLY,
141 accessWriteOnly= O_WRONLY,
142 accessReadWrite = O_RDWR
144 accessReadOnly = GENERIC_READ,
145 accessWriteOnly = GENERIC_WRITE,
146 accessReadWrite = GENERIC_READ | GENERIC_WRITE
171 openReadOnly = O_RDONLY,
172 openWriteOnly = O_WRONLY,
173 openReadWrite = O_RDWR,
174 openAppend = O_WRONLY | O_APPEND,
176 openSync = O_RDWR | O_SYNC,
180 openTruncate = O_RDWR | O_TRUNC
204 #else // defined WIN32
228 mappedRead = accessReadOnly,
229 mappedWrite = accessWriteOnly,
230 mappedReadWrite = accessReadWrite
242 static const char *getExtension(
const char *path);
243 static const char *getFilename(
const char *path);
244 static char *getFilename(
const char *path,
char *buffer,
size_t size =
NAME_MAX);
245 static char *getDirname(
const char *path,
char *buffer,
size_t size =
PATH_MAX);
246 static char *getRealpath(
const char *path,
char *buffer,
size_t size =
PATH_MAX);
262 #ifdef HAVE_READDIR_R
264 char save_space[
sizeof(
struct dirent) + PATH_MAX + 1];
266 struct dirent *entry;
269 WIN32_FIND_DATA data, fdata;
274 Dir(
const char *name = NULL);
276 static bool create(
const char *path,
Attr attr = attrGroup);
277 static bool remove(
const char *path);
278 static bool setPrefix(
const char *path);
279 static bool getPrefix(
char *path,
size_t size = PATH_MAX);
281 void open(
const char *name);
286 const char *getName(
void);
288 const char *operator++()
291 const char *operator++(
int)
294 const char *operator*();
317 char path[PATH_MAX + 1];
319 unsigned max, current, prefixpos;
331 virtual bool filter(
const char *file,
struct stat *ino);
341 DirTree(
const char *prefix,
unsigned maxdepth);
357 void open(
const char *prefix);
382 unsigned perform(
const char *prefix);
438 Error error(Error errid,
char *errstr = NULL);
447 {
return error(errExtended, err);};
455 inline void setError(
bool enable)
456 {flags.thrown = !enable;};
466 Error setCompletion(Complete mode);
475 inline void setTemporary(
bool enable)
476 {flags.temp = enable;};
489 virtual Attr initialize(
void);
517 off_t getCapacity(
void);
524 virtual Error restart(
void);
539 inline char *getErrorString(
void)
542 bool operator!(
void);
570 Error open(
const char *path);
627 off_t getPosition(
void);
629 bool operator++(
void);
630 bool operator--(
void);
651 Error open(
const char *path);
681 {
return open(pathname);};
715 Error clear(
ccxx_size_t length = 0, off_t pos = -1);
730 off_t getPosition(
void);
732 bool operator++(
void);
733 bool operator--(
void);
808 void sync(
caddr_t address,
size_t len);
818 void update(
size_t offset = 0,
size_t len = 0);
827 void update(
caddr_t address,
size_t len);
835 void release(
caddr_t address,
size_t len);
846 {
return ((
char *)(fcb.address)) + offset;};
856 caddr_t fetch(off_t pos,
size_t len);
876 size_t pageAligned(
size_t size);
898 #if defined(HAVE_MACH_DYLD)
900 #elif defined(HAVE_SHL_LOAD)
907 void loader(
const char *filename,
bool resolve);
918 {loader(filename,
true);};
920 DSO(
const char *filename,
bool resolve)
921 {loader(filename, resolve);};
923 DSO(
const char *filename)
925 DSO(
const char *filename,
bool resolve)
933 inline const char *getError(
void)
947 void* operator[](
const char *sym);
949 void *operator[](
const char *)
954 static void dynunload(
void);
956 static void dynunload(
void)
965 static DSO *getObject(
const char *name);
977 static void setDebug(
void);
981 bool __EXPORT isDir(
const char *path);
983 bool __EXPORT isFile(
const char *path);
986 bool __EXPORT isDevice(
const char *path);
989 inline bool isDevice(
const char *path)
993 bool __EXPORT canAccess(
const char *path);
995 bool __EXPORT canModify(
const char *path);
997 time_t
__EXPORT lastModified(
const char *path);
999 time_t
__EXPORT lastAccessed(
const char *path);
1001 #ifdef COMMON_STD_EXCEPTION
1003 class DirException :
public IOException
1006 DirException(
const String &str) : IOException(str) {};
1009 class __EXPORT DSOException :
public IOException
1012 DSOException(
const String &str) : IOException(str) {};
1015 class __EXPORT FileException :
public IOException
1018 FileException(
const String &str) : IOException(str) {};
1023 #ifdef CCXX_NAMESPACES