47 #ifndef CCXX_CONFIG_H_
48 #include <cc++/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];
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*();
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);
918 DSO(
const char *filename)
919 {loader(filename,
true);};
921 DSO(
const char *filename,
bool resolve)
922 {loader(filename, resolve);};
926 DSO(
const char *filename,
bool resolve)
948 void* operator[](
const char *sym);
955 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
static void dynunload(void)
const char * getError(void)
Retrieve error indicator associated with DSO failure.
This class defines a database I/O file service that can be shared by multiple threads.
char * getErrorString(void)
Return current error string.
__EXPORT AppLog & error(AppLog &sl)
Manipulator for error level.
Create and map a disk file into memory.
substitute functions which may be missing in target platform libc.
Error restart(void)
Restart an existing database; close and re-open.
The Mutex class is used to protect a section of code so that at any given time only a single thread c...
This class allows the creation of a thread context unique "pointer" that can be set and retrieved and...
This is a generic and portable string class.
GNU Common C++ exception model base classes.
char * fetch(size_t offset=0)
Fetch a pointer to an offset within the memory mapped portion of the disk file.
#define INVALID_HANDLE_VALUE
Synchronization and threading services.
The purpose of this class is to define a base class for low level random file access that is portable...
const char * operator++()
A generic class to walk a hierarchical directory structure.
const char * operator++(int)
Error error(char *err)
Post an extended string error message.
Error getErrorNumber(void)
Return current error id.
void * operator[](const char *)
Detach a DSO object from running memory.
This class defines a database I/O file service that can be shared by multiple processes.
void setTemporary(bool enable)
Used to set the temporary attribute for the file.
DSO(const char *filename, bool resolve)
DSO(const char *filename)
Construct and load a DSO object file.
The DSO dynamic loader class is used to load object files.
A low level portable directory class.
void setError(bool enable)
Used to enable or disable throwing of exceptions on errors.