40#ifndef BLOCXX_FILESYSTEM_HPP_INCLUDE_GUARD_
41#define BLOCXX_FILESYSTEM_HPP_INCLUDE_GUARD_
42#include "blocxx/BLOCXX_config.h"
48#ifdef BLOCXX_ENABLE_TEST_HOOKS
54#ifdef BLOCXX_HAVE_SYS_PARAM_H
59#define MAXPATHLEN PATH_MAX
61#define MAXPATHLEN 1024
228 const String& newFileName);
240 BLOCXX_COMMON_API
size_t read(
const FileHandle& hdl,
void* bfr,
size_t numberOfBytes,
253 size_t numberOfBytes, Int64 offset=-1L);
265 BLOCXX_COMMON_API Int64
seek(
const FileHandle& hdl, Int64 offset,
int whence);
367 BLOCXX_COMMON_API std::pair<ESecurity, String>
374 BLOCXX_COMMON_API std::pair<ESecurity, String>
security(
String const & path);
388 BLOCXX_COMMON_API std::pair<ESecurity, String>
395 BLOCXX_COMMON_API std::pair<ESecurity, String>
438#ifdef BLOCXX_ENABLE_TEST_HOOKS
449 extern FileSystemMockObject_t g_fileSystemMockObject;
#define BLOCXX_DECLARE_APIEXCEPTION(NAME, LINKAGE_SPEC)
Declare a new exception class named <NAME>Exception that derives from Exception This macro is typical...
The purpose of the File class is to provide an abstraction layer over the platform dependant function...
This class can be used to store a global pointer.
This String class is an abstract data type that represents as NULL terminated string of characters.
BLOCXX_COMMON_API String basename(const String &filename)
Take a string that contains a pathname, and return a string that is the filename with the path remove...
BLOCXX_COMMON_API String realPath(const String &path)
BLOCXX_COMMON_API std::pair< ESecurity, String > security(String const &path, UserId uid)
BLOCXX_COMMON_API String dirname(const String &filename)
Take a string that contains a pathname, and return a string that is a pathname of the parent director...
BLOCXX_COMMON_API String getCurrentWorkingDirectory()
Get the process's current working directory.
The purpose of the FileSystem class is to provide an abstraction layer over the platform dependant fu...
BLOCXX_COMMON_API int changeFileOwner(const String &filename, const UserId &userId)
Change the given file ownership.
BLOCXX_COMMON_API void rewind(const FileHandle &hdl)
Position the file pointer associated with the given file handle to the beginning of the file.
BLOCXX_COMMON_API File createFile(const String &path)
Create the file for the given name.
BLOCXX_COMMON_API File openForAppendOrCreateFile(const String &path)
Opens the file for the given name to append data or create if it does not exist.
BLOCXX_COMMON_API size_t read(const FileHandle &hdl, void *bfr, size_t numberOfBytes, Int64 offset=-1L)
Read data from file.
BLOCXX_COMMON_API bool canRead(const String &path)
BLOCXX_COMMON_API bool isLink(const String &path)
Tests if a file is a symbolic link.
BLOCXX_COMMON_API bool exists(const String &path)
BLOCXX_COMMON_API bool removeFile(const String &path)
Remove the given file.
BLOCXX_COMMON_API bool getFileSize(const String &path, Int64 &size)
Get the size of the file in bytes.
BLOCXX_COMMON_API bool getDirectoryContents(const String &path, StringArray &dirEntries)
Get the names of the files (and directories) in the given directory.
BLOCXX_COMMON_API File createAutoDeleteTempFile(const String &dir=String())
Create a tempororary file that will be removed when the returned File object is closed.
BLOCXX_COMMON_API String readSymbolicLink(const String &path)
Read the value of a symbolic link.
BLOCXX_COMMON_API Int64 seek(const FileHandle &hdl, Int64 offset, int whence)
Seek to a given offset within the file.
BLOCXX_COMMON_API int close(const FileHandle &hdl)
Close file handle.
BLOCXX_COMMON_API size_t write(FileHandle hdl, const void *bfr, size_t numberOfBytes, Int64 offset=-1L)
Write data to a file.
BLOCXX_COMMON_API bool renameFile(const String &oldFileName, const String &newFileName)
Rename the given file to the new name.
BLOCXX_COMMON_API bool isExecutable(const String &path)
Tests if a file is executable.
BLOCXX_COMMON_API bool canWrite(const String &path)
BLOCXX_COMMON_API File openOrCreateFile(const String &path)
Opens or creates the file for the given name.
BLOCXX_COMMON_API File createTempFile(String &filePath, const String &dir=String())
Create a tempororary file in an optional directory.
BLOCXX_COMMON_API Int64 tell(const FileHandle &hdl)
BLOCXX_COMMON_API UInt64 fileSize(FileHandle fh)
Get the size of a file from the file handle.
BLOCXX_COMMON_API bool isDirectory(const String &path)
BLOCXX_COMMON_API int flush(FileHandle &hdl)
Flush any buffered data to the file if buffering supported.
BLOCXX_COMMON_API StringArray getFileLines(const String &filename)
Read and return the lines of a test file.
BLOCXX_COMMON_API bool changeDirectory(const String &path)
Change to the given directory.
BLOCXX_COMMON_API File openFile(const String &path)
Open a file for read/write and return an File object that can be used for reading and writing.
BLOCXX_COMMON_API String getFileContents(const String &filename)
Read and return the contents of a text file.
BLOCXX_COMMON_API bool removeDirectory(const String &path)
Remove the given directory.
BLOCXX_COMMON_API bool makeDirectory(const String &path, int mode=0777)
Create a directory.
Array< String > StringArray