Classes | |
| struct | NullFactory |
Namespaces | |
| namespace | Path |
Typedefs | |
| typedef GlobalPtr < FileSystemMockObject, NullFactory > | FileSystemMockObject_t |
Functions | |
| File | openFile (const String &path) |
| Open a file for read/write and return an File object that can be used for reading and writing. | |
| File | createFile (const String &path) |
| Create the file for the given name. | |
| File | openOrCreateFile (const String &path) |
| Opens or creates the file for the given name. | |
| File | openForAppendOrCreateFile (const String &path) |
| Opens the file for the given name to append data or create if it does not exist. | |
| File | createAutoDeleteTempFile (const String &dir=String()) |
| Create a tempororary file that will be removed when the returned File object is closed. | |
| File | createTempFile (String &filePath, const String &dir=String()) |
| Create a tempororary file in an optional directory. | |
| int | changeFileOwner (const String &filename, const UserId &userId) |
| Change the given file ownership. | |
| bool | exists (const String &path) |
| bool | isExecutable (const String &path) |
| Tests if a file is executable. | |
| bool | canRead (const String &path) |
| bool | canWrite (const String &path) |
| bool | isLink (const String &path) |
| Tests if a file is a symbolic link. | |
| bool | isDirectory (const String &path) |
| bool | changeDirectory (const String &path) |
| Change to the given directory. | |
| bool | makeDirectory (const String &path, int mode=0777) |
| Create a directory. | |
| bool | getFileSize (const String &path, Int64 &size) |
| Get the size of the file in bytes. | |
| UInt64 | fileSize (FileHandle fh) |
| Get the size of a file from the file handle. | |
| bool | removeDirectory (const String &path) |
| Remove the given directory. | |
| bool | removeFile (const String &path) |
| Remove the given file. | |
| bool | getDirectoryContents (const String &path, StringArray &dirEntries) |
| Get the names of the files (and directories) in the given directory. | |
| bool | renameFile (const String &oldFileName, const String &newFileName) |
| Rename the given file to the new name. | |
| size_t | read (const FileHandle &hdl, void *bfr, size_t numberOfBytes, Int64 offset=-1L) |
| Read data from file. | |
| size_t | write (FileHandle hdl, const void *bfr, size_t numberOfBytes, Int64 offset=-1L) |
| Write data to a file. | |
| Int64 | seek (const FileHandle &hdl, Int64 offset, int whence) |
| Seek to a given offset within the file. | |
| Int64 | tell (const FileHandle &hdl) |
| void | rewind (const FileHandle &hdl) |
| Position the file pointer associated with the given file handle to the beginning of the file. | |
| int | close (const FileHandle &hdl) |
| Close file handle. | |
| int | flush (FileHandle &hdl) |
| Flush any buffered data to the file if buffering supported. | |
| String | getFileContents (const String &filename) |
| Read and return the contents of a text file. | |
| StringArray | getFileLines (const String &filename) |
| Read and return the lines of a test file. | |
| String | readSymbolicLink (const String &path) |
| Read the value of a symbolic link. | |
Variables | |
| FileSystemMockObject_t | g_fileSystemMockObject = { 0, {0, PTHREAD_MUTEX_INITIALIZER} } |
| GlobalString | COMPONENT_NAME = { "blocxx" , 0, {0, PTHREAD_MUTEX_INITIALIZER} } |
| GlobalMutex | tmpfileMutex = { 0 , 0, {0, PTHREAD_MUTEX_INITIALIZER} } |
| typedef GlobalPtr<FileSystemMockObject, NullFactory> BLOCXX_NAMESPACE::FileSystem::FileSystemMockObject_t |
Definition at line 236 of file PosixFileSystem.cpp.
| bool BLOCXX_NAMESPACE::FileSystem::canRead | ( | const String & | path | ) |
Definition at line 601 of file PosixFileSystem.cpp.
References _ACCESS, BLOCXX_NAMESPACE::String::c_str(), and g_fileSystemMockObject.
Referenced by BLOCXX_NAMESPACE::dlSharedLibrary::isFakeLibrary().
| bool BLOCXX_NAMESPACE::FileSystem::canWrite | ( | const String & | path | ) |
Definition at line 611 of file PosixFileSystem.cpp.
References _ACCESS, BLOCXX_NAMESPACE::String::c_str(), and g_fileSystemMockObject.
| bool BLOCXX_NAMESPACE::FileSystem::changeDirectory | ( | const String & | path | ) |
Change to the given directory.
| path | The directory to change to |
Definition at line 662 of file PosixFileSystem.cpp.
References _CHDIR, BLOCXX_NAMESPACE::String::c_str(), and g_fileSystemMockObject.
| int BLOCXX_NAMESPACE::FileSystem::changeFileOwner | ( | const String & | filename, | |
| const UserId & | userId | |||
| ) |
Change the given file ownership.
| filename | The name of the file to change ownership on. | |
| userId | The user id to change ownership to |
Definition at line 244 of file PosixFileSystem.cpp.
References BLOCXX_NAMESPACE::String::c_str().
| int BLOCXX_NAMESPACE::FileSystem::close | ( | const FileHandle & | hdl | ) |
Close file handle.
| hdl | The file handle to close. |
Definition at line 983 of file PosixFileSystem.cpp.
References g_fileSystemMockObject.
Referenced by BLOCXX_NAMESPACE::File::close(), BLOCXX_NAMESPACE::SocketBaseImpl::disconnect(), BLOCXX_NAMESPACE::AutoDescriptorPolicy::free(), BLOCXX_NAMESPACE::dlSharedLibrary::isFakeLibrary(), BLOCXX_NAMESPACE::NwIface::NwIface(), and BLOCXX_NAMESPACE::upclose().
| File BLOCXX_NAMESPACE::FileSystem::createAutoDeleteTempFile | ( | const String & | dir = String() |
) |
Create a tempororary file that will be removed when the returned File object is closed.
| dir | The directory to create the temporary file in. |
Definition at line 390 of file PosixFileSystem.cpp.
References BLOCXX_LOG_ERROR, BLOCXX_NAMESPACE::String::c_str(), COMPONENT_NAME, BLOCXX_NAMESPACE::String::empty(), BLOCXX_NAMESPACE::String::endsWith(), g_fileSystemMockObject, BLOCXX_NAMESPACE::AutoPtrVec< X >::get(), BLOCXX_NAMESPACE::String::length(), BLOCXX_NAMESPACE::SafeCString::strcpy_check(), and tmpfileMutex.
Referenced by BLOCXX_NAMESPACE::TempFileBuffer::buffer_to_device().
| File BLOCXX_NAMESPACE::FileSystem::createFile | ( | const String & | path | ) |
Create the file for the given name.
| path | The name of the file to create. |
Definition at line 275 of file PosixFileSystem.cpp.
References BLOCXX_NAMESPACE::String::c_str(), and g_fileSystemMockObject.
| File BLOCXX_NAMESPACE::FileSystem::createTempFile | ( | String & | filePath, | |
| const String & | dir = String() | |||
| ) |
Create a tempororary file in an optional directory.
| filePath | Output parameter that will contain the name of the temporary file on return. It is the responsibility of the caller to delete this file when it is no longer needed. | |
| dir | The directory to create the temporary file in. |
Definition at line 345 of file PosixFileSystem.cpp.
References BLOCXX_NAMESPACE::String::c_str(), BLOCXX_NAMESPACE::String::empty(), BLOCXX_NAMESPACE::String::endsWith(), BLOCXX_NAMESPACE::String::erase(), g_fileSystemMockObject, BLOCXX_NAMESPACE::AutoPtrVec< X >::get(), BLOCXX_NAMESPACE::String::length(), BLOCXX_NAMESPACE::SafeCString::strcpy_check(), and tmpfileMutex.
Referenced by BLOCXX_NAMESPACE::TempFileBuffer::buffer_to_device().
| bool BLOCXX_NAMESPACE::FileSystem::exists | ( | const String & | path | ) |
Definition at line 577 of file PosixFileSystem.cpp.
References _ACCESS, BLOCXX_NAMESPACE::String::c_str(), and g_fileSystemMockObject.
Referenced by BLOCXX_NAMESPACE::SSLTrustStore::addCertificate(), BLOCXX_NAMESPACE::ServerSocketImpl::doListenUDS(), BLOCXX_NAMESPACE::FileAppender::doProcessLogMessage(), locateInPath(), BLOCXX_NAMESPACE::SSLCtxBase::SSLCtxBase(), and BLOCXX_NAMESPACE::SSLTrustStore::SSLTrustStore().
| UInt64 BLOCXX_NAMESPACE::FileSystem::fileSize | ( | FileHandle | fh | ) |
Get the size of a file from the file handle.
| fh | Handle of the desired file. |
Definition at line 937 of file PosixFileSystem.cpp.
References BLOCXX_THROW_ERRNO_MSG, and g_fileSystemMockObject.
Referenced by BLOCXX_NAMESPACE::File::size().
| int BLOCXX_NAMESPACE::FileSystem::flush | ( | FileHandle & | hdl | ) |
Flush any buffered data to the file if buffering supported.
| hdl | The file handle to flush the buffer on. |
Definition at line 997 of file PosixFileSystem.cpp.
References g_fileSystemMockObject.
Referenced by BLOCXX_NAMESPACE::File::flush(), and BLOCXX_NAMESPACE::StackTrace::getStackTrace().
| bool BLOCXX_NAMESPACE::FileSystem::getDirectoryContents | ( | const String & | path, | |
| StringArray & | dirEntries | |||
| ) |
Get the names of the files (and directories) in the given directory.
| path | The name of the directory to get the contents of. | |
| dirEntries | The directory contents will be placed in this array. |
Definition at line 726 of file PosixFileSystem.cpp.
References BLOCXX_NAMESPACE::Array< T >::append(), BLOCXX_FILENAME_SEPARATOR, BLOCXX_NAMESPACE::String::c_str(), BLOCXX_NAMESPACE::Array< T >::clear(), BLOCXX_NAMESPACE::String::endsWith(), and g_fileSystemMockObject.
| String BLOCXX_NAMESPACE::FileSystem::getFileContents | ( | const String & | filename | ) |
Read and return the contents of a text file.
If the file contains a null character ('\0') then only previous data will be returned.
| filename | The name of the file to read |
| FileSystemException | if the file doesn't exist or reading fails for any reason. |
Definition at line 1010 of file PosixFileSystem.cpp.
References BLOCXX_THROW, BLOCXX_NAMESPACE::String::c_str(), g_fileSystemMockObject, and BLOCXX_NAMESPACE::OStringStream::toString().
Referenced by getFileLines().
| StringArray BLOCXX_NAMESPACE::FileSystem::getFileLines | ( | const String & | filename | ) |
Read and return the lines of a test file.
If the file contains a null character ('\0') then only previous data will be returned.
| filename | The name of the file to read |
| FileSystemException | if the file doesn't exist or reading fails for any reason. |
Definition at line 1027 of file PosixFileSystem.cpp.
References g_fileSystemMockObject, getFileContents(), and BLOCXX_NAMESPACE::String::tokenize().
| bool BLOCXX_NAMESPACE::FileSystem::getFileSize | ( | const String & | path, | |
| Int64 & | size | |||
| ) |
Get the size of the file in bytes.
| path | The name of the file to get the size for. | |
| size | Put the size of the file in this variable. |
Definition at line 682 of file PosixFileSystem.cpp.
References BLOCXX_NAMESPACE::String::c_str(), and g_fileSystemMockObject.
| bool BLOCXX_NAMESPACE::FileSystem::isDirectory | ( | const String & | path | ) |
Definition at line 638 of file PosixFileSystem.cpp.
References BLOCXX_NAMESPACE::String::c_str(), and g_fileSystemMockObject.
| bool BLOCXX_NAMESPACE::FileSystem::isExecutable | ( | const String & | path | ) |
Tests if a file is executable.
This method is not available on platforms that do not have support for executable file attributes
Definition at line 589 of file PosixFileSystem.cpp.
References _ACCESS, BLOCXX_NAMESPACE::String::c_str(), and g_fileSystemMockObject.
| bool BLOCXX_NAMESPACE::FileSystem::isLink | ( | const String & | path | ) |
Tests if a file is a symbolic link.
This method is not available on platforms that do not have support for symbolic links
Definition at line 622 of file PosixFileSystem.cpp.
References BLOCXX_NAMESPACE::String::c_str(), and g_fileSystemMockObject.
| bool BLOCXX_NAMESPACE::FileSystem::makeDirectory | ( | const String & | path, | |
| int | mode = 0777 | |||
| ) |
Create a directory.
| path | The name of the directory to create. | |
| mode | specifies the permissions to use. |
Definition at line 672 of file PosixFileSystem.cpp.
References _MKDIR, BLOCXX_NAMESPACE::String::c_str(), and g_fileSystemMockObject.
| File BLOCXX_NAMESPACE::FileSystem::openFile | ( | const String & | path | ) |
Open a file for read/write and return an File object that can be used for reading and writing.
Definition at line 256 of file PosixFileSystem.cpp.
References BLOCXX_NAMESPACE::String::c_str(), and g_fileSystemMockObject.
Referenced by BLOCXX_NAMESPACE::TempFileEnumerationImplBase::readSize().
| File BLOCXX_NAMESPACE::FileSystem::openForAppendOrCreateFile | ( | const String & | path | ) |
Opens the file for the given name to append data or create if it does not exist.
| path | The name of the file to create. |
Definition at line 318 of file PosixFileSystem.cpp.
References BLOCXX_NAMESPACE::String::c_str(), and g_fileSystemMockObject.
Referenced by BLOCXX_NAMESPACE::MultiProcessFileAppender::doProcessLogMessage(), and BLOCXX_NAMESPACE::MultiProcessFileAppender::MultiProcessFileAppender().
| File BLOCXX_NAMESPACE::FileSystem::openOrCreateFile | ( | const String & | path | ) |
Opens or creates the file for the given name.
| path | The name of the file to create. |
Definition at line 299 of file PosixFileSystem.cpp.
References BLOCXX_NAMESPACE::String::c_str(), and g_fileSystemMockObject.
Referenced by BLOCXX_NAMESPACE::ServerSocketImpl::doListenUDS(), and BLOCXX_NAMESPACE::MultiProcessFileAppender::MultiProcessFileAppender().
| size_t BLOCXX_NAMESPACE::FileSystem::read | ( | const FileHandle & | hdl, | |
| void * | bfr, | |||
| size_t | numberOfBytes, | |||
| Int64 | offset = -1L | |||
| ) |
Read data from file.
| hdl | The file handle to perform the read operation on. | |
| bfr | The location where the read operation will place what is read. | |
| numberOfBytes | The number of bytes to read. | |
| offset | The offset to seek to in the file before the read operation is done. -1 will use the current offset. |
Definition at line 786 of file PosixFileSystem.cpp.
References BLOCXX_THROW, and g_fileSystemMockObject.
Referenced by generateRandomDataFromFile(), BLOCXX_NAMESPACE::dlSharedLibrary::isFakeLibrary(), BLOCXX_NAMESPACE::File::read(), BLOCXX_NAMESPACE::BinarySerialization::read(), BLOCXX_NAMESPACE::SocketImpl::readAux(), and BLOCXX_NAMESPACE::upread().
| String BLOCXX_NAMESPACE::FileSystem::readSymbolicLink | ( | const String & | path | ) |
Read the value of a symbolic link.
| path | Path to the symbolic link |
| FileSystemException,: | ENOTDIR, ENOENT, EACCES, ELOOP, EINVAL, EIO, EFAULT, ENOMEM |
Definition at line 1037 of file PosixFileSystem.cpp.
References BLOCXX_THROW_ERRNO_MSG, BLOCXX_NAMESPACE::String::c_str(), g_fileSystemMockObject, MAXPATHLEN, and BLOCXX_NAMESPACE::FileSystem::Path::realPath().
| bool BLOCXX_NAMESPACE::FileSystem::removeDirectory | ( | const String & | path | ) |
Remove the given directory.
| path | The name of the directory to remove |
Definition at line 706 of file PosixFileSystem.cpp.
References _RMDIR, BLOCXX_NAMESPACE::String::c_str(), and g_fileSystemMockObject.
| bool BLOCXX_NAMESPACE::FileSystem::removeFile | ( | const String & | path | ) |
Remove the given file.
| path | The name of the file to remove. |
Definition at line 716 of file PosixFileSystem.cpp.
References _UNLINK, BLOCXX_NAMESPACE::String::c_str(), and g_fileSystemMockObject.
Referenced by BLOCXX_NAMESPACE::ServerSocketImpl::close(), BLOCXX_NAMESPACE::ServerSocketImpl::doListenUDS(), BLOCXX_NAMESPACE::MultiProcessFileAppender::doProcessLogMessage(), BLOCXX_NAMESPACE::FileAppender::doProcessLogMessage(), BLOCXX_NAMESPACE::Secure::rand_save_state(), and BLOCXX_NAMESPACE::TempFileBuffer::~TempFileBuffer().
| bool BLOCXX_NAMESPACE::FileSystem::renameFile | ( | const String & | oldFileName, | |
| const String & | newFileName | |||
| ) |
Rename the given file to the new name.
| oldFileName | The name of the file to rename | |
| newFileName | The new name for the oldFileName |
Definition at line 775 of file PosixFileSystem.cpp.
References BLOCXX_NAMESPACE::String::c_str(), and g_fileSystemMockObject.
Referenced by BLOCXX_NAMESPACE::MultiProcessFileAppender::doProcessLogMessage(), and BLOCXX_NAMESPACE::FileAppender::doProcessLogMessage().
| void BLOCXX_NAMESPACE::FileSystem::rewind | ( | const FileHandle & | hdl | ) |
Position the file pointer associated with the given file handle to the beginning of the file.
| hdl | The file handle to use in the rewind operation. |
Definition at line 969 of file PosixFileSystem.cpp.
References g_fileSystemMockObject.
Referenced by BLOCXX_NAMESPACE::File::rewind().
| Int64 BLOCXX_NAMESPACE::FileSystem::seek | ( | const FileHandle & | hdl, | |
| Int64 | offset, | |||
| int | whence | |||
| ) |
Seek to a given offset within the file.
| hdl | The file handle to use in the seek operation. | |
| offset | The offset to seek to relative to the whence parm. | |
| whence | Can be one of the follwing values: SEEK_SET - Seek relative to the beginning of the file. SEEK_CUR - Seek relative to the current position. SEEK_END - Seek relative to the end of the file (bwd). |
Definition at line 878 of file PosixFileSystem.cpp.
References BLOCXX_THROW, and g_fileSystemMockObject.
Referenced by BLOCXX_NAMESPACE::File::seek().
| Int64 BLOCXX_NAMESPACE::FileSystem::tell | ( | const FileHandle & | hdl | ) |
| hdl | The file handle to use in the tell operation. |
Definition at line 915 of file PosixFileSystem.cpp.
References g_fileSystemMockObject.
Referenced by BLOCXX_NAMESPACE::File::tell().
| size_t BLOCXX_NAMESPACE::FileSystem::write | ( | FileHandle | hdl, | |
| const void * | bfr, | |||
| size_t | numberOfBytes, | |||
| Int64 | offset = -1L | |||
| ) |
Write data to a file.
| hdl | The file handle to perform the write operation on. | |
| bfr | The locaction to get the contents to write. | |
| numberOfBytes | The number of bytes to write. | |
| offset | The offset to seek to in the file before the write operation is done. -1 will use the current offset. |
Definition at line 832 of file PosixFileSystem.cpp.
References BLOCXX_THROW, and g_fileSystemMockObject.
Referenced by BLOCXX_NAMESPACE::init_child(), BLOCXX_NAMESPACE::upwrite(), BLOCXX_NAMESPACE::File::write(), BLOCXX_NAMESPACE::BinarySerialization::write(), BLOCXX_NAMESPACE::SocketImpl::writeAux(), BLOCXX_NAMESPACE::BinarySerialization::writeBool(), BLOCXX_NAMESPACE::BinarySerialization::writeString(), and BLOCXX_NAMESPACE::BinarySerialization::writeStringArray().
| GlobalString BLOCXX_NAMESPACE::FileSystem::COMPONENT_NAME = { "blocxx" , 0, {0, PTHREAD_MUTEX_INITIALIZER} } |
| FileSystemMockObject_t BLOCXX_NAMESPACE::FileSystem::g_fileSystemMockObject = { 0, {0, PTHREAD_MUTEX_INITIALIZER} } |
Definition at line 237 of file PosixFileSystem.cpp.
Referenced by BLOCXX_NAMESPACE::FileSystem::Path::basename(), canRead(), canWrite(), changeDirectory(), close(), createAutoDeleteTempFile(), createFile(), createTempFile(), BLOCXX_NAMESPACE::FileSystem::Path::dirname(), exists(), fileSize(), flush(), BLOCXX_NAMESPACE::FileSystem::Path::getCurrentWorkingDirectory(), getDirectoryContents(), getFileContents(), getFileLines(), getFileSize(), isDirectory(), isExecutable(), isLink(), makeDirectory(), openFile(), openForAppendOrCreateFile(), openOrCreateFile(), read(), readSymbolicLink(), BLOCXX_NAMESPACE::FileSystem::Path::realPath(), removeDirectory(), removeFile(), renameFile(), rewind(), seek(), tell(), and write().
GlobalMutex BLOCXX_NAMESPACE::FileSystem::tmpfileMutex = { 0 , 0, {0, PTHREAD_MUTEX_INITIALIZER} } [static] |
Definition at line 339 of file PosixFileSystem.cpp.
Referenced by createAutoDeleteTempFile(), and createTempFile().
1.5.6