00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00038 #ifndef BLOCXX_FILESYSTEM_HPP_INCLUDE_GUARD_
00039 #define BLOCXX_FILESYSTEM_HPP_INCLUDE_GUARD_
00040 #include "blocxx/BLOCXX_config.h"
00041 #include "blocxx/Types.hpp"
00042 #include "blocxx/ArrayFwd.hpp"
00043 #include "blocxx/Exception.hpp"
00044 #include "blocxx/CommonFwd.hpp"
00045
00046 #ifdef BLOCXX_HAVE_SYS_PARAM_H
00047 #include <sys/param.h>
00048 #endif
00049 #ifndef MAXPATHLEN
00050 #ifdef PATH_MAX
00051 #define MAXPATHLEN PATH_MAX
00052 #else
00053 #define MAXPATHLEN 1024
00054 #endif
00055 #endif
00056
00057 namespace BLOCXX_NAMESPACE
00058 {
00059
00060 BLOCXX_DECLARE_APIEXCEPTION(FileSystem, BLOCXX_COMMON_API)
00061
00062
00066 namespace FileSystem
00067 {
00072 BLOCXX_COMMON_API File openFile(const String& path);
00080 BLOCXX_COMMON_API File createFile(const String& path);
00087 BLOCXX_COMMON_API File openOrCreateFile(const String& path);
00094 BLOCXX_COMMON_API int changeFileOwner(const String& filename,
00095 const UserId& userId);
00099 BLOCXX_COMMON_API bool exists(const String& path);
00104 BLOCXX_COMMON_API bool isExecutable(const String& path);
00108 BLOCXX_COMMON_API bool canRead(const String& path);
00112 BLOCXX_COMMON_API bool canWrite(const String& path);
00116 BLOCXX_COMMON_API bool isLink(const String& path);
00120 BLOCXX_COMMON_API bool isDirectory(const String& path);
00126 BLOCXX_COMMON_API bool changeDirectory(const String& path);
00133 BLOCXX_COMMON_API bool makeDirectory(const String& path, int mode=0777);
00140 BLOCXX_COMMON_API bool getFileSize(const String& path, off_t& size);
00146 BLOCXX_COMMON_API bool removeDirectory(const String& path);
00152 BLOCXX_COMMON_API bool removeFile(const String& path);
00159 BLOCXX_COMMON_API bool getDirectoryContents(const String& path,
00160 StringArray& dirEntries);
00167 BLOCXX_COMMON_API bool renameFile(const String& oldFileName,
00168 const String& newFileName);
00180 BLOCXX_COMMON_API size_t read(const FileHandle& hdl, void* bfr, size_t numberOfBytes,
00181 off_t offset=-1L);
00192 BLOCXX_COMMON_API size_t write(FileHandle& hdl, const void* bfr,
00193 size_t numberOfBytes, off_t offset=-1L);
00205 BLOCXX_COMMON_API off_t seek(const FileHandle& hdl, off_t offset, int whence);
00211 BLOCXX_COMMON_API off_t tell(const FileHandle& hdl);
00217 BLOCXX_COMMON_API void rewind(const FileHandle& hdl);
00223 BLOCXX_COMMON_API int close(const FileHandle& hdl);
00228 BLOCXX_COMMON_API int flush(FileHandle& hdl);
00236 BLOCXX_COMMON_API String getFileContents(const String& filename);
00237
00245 BLOCXX_COMMON_API StringArray getFileLines(const String& filename);
00246
00253 BLOCXX_COMMON_API String readSymbolicLink(const String& path);
00254
00255 namespace Path
00256 {
00267 BLOCXX_COMMON_API String realPath(const String& path);
00268
00279 BLOCXX_COMMON_API String dirname(const String& filename);
00280
00287 BLOCXX_COMMON_API String getCurrentWorkingDirectory();
00288
00289
00290 }
00291
00292 }
00293
00294 }
00295
00296 #endif