C++ Utilities
4.17.0
Useful C++ classes and routines such as argument parser, IO and conversion utilities
|
Contains utility classes helping to read and write streams. More...
Classes | |
class | BinaryReader |
Reads primitive data types from a std::istream. More... | |
class | BinaryWriter |
Writes primitive data types to a std::ostream. More... | |
class | BitReader |
The BitReader class provides bitwise reading of buffered data. More... | |
class | CopyHelper |
The CopyHelper class helps to copy bytes from one stream to another. More... | |
class | IniFile |
The IniFile class parses and makes INI files. More... | |
Typedefs | |
using | NativeFileStream = std::fstream |
Enumerations | |
enum | DirectoryEntryType : unsigned char { DirectoryEntryType::None = 0, DirectoryEntryType::File = 1, DirectoryEntryType::Directory = 2, DirectoryEntryType::Symlink = 4, DirectoryEntryType::All = 0xFF } |
The DirectoryEntryType enum specifies the type of a directory entry (file, directory or symlink). More... | |
Functions | |
constexpr DirectoryEntryType | operator| (DirectoryEntryType lhs, DirectoryEntryType rhs) |
DirectoryEntryType & | operator|= (DirectoryEntryType &lhs, DirectoryEntryType rhs) |
constexpr DirectoryEntryType | operator & (DirectoryEntryType lhs, DirectoryEntryType rhs) |
CPP_UTILITIES_EXPORT std::string | fileName (const string &path) |
Returns the file name and extension of the specified path string. More... | |
CPP_UTILITIES_EXPORT std::string | directory (const string &path) |
Returns the directory of the specified path string (including trailing slash). More... | |
CPP_UTILITIES_EXPORT void | removeInvalidChars (std::string &fileName) |
Removes invalid characters from the specified fileName. More... | |
CPP_UTILITIES_EXPORT bool | settingsDirectory (std::string &result, std::string applicationDirectoryName, bool createApplicationDirectory) |
Locates a directory meant to store application settings. More... | |
CPP_UTILITIES_EXPORT std::list< std::string > | directoryEntries (const char *path, DirectoryEntryType types) |
Returns the names of the directory entries in the specified path with the specified types. More... | |
CPP_UTILITIES_EXPORT const char * | catchIoFailure () |
Provides a workaround for GCC Bug 66145. More... | |
CPP_UTILITIES_EXPORT void | throwIoFailure (const char *what) |
Throws an std::ios_base::failure with the specified message. More... | |
CPP_UTILITIES_EXPORT std::string | readFile (const string &path, std::string::size_type maxSize) |
Reads all contents of the specified file in a single call. More... | |
Contains utility classes helping to read and write streams.
using IoUtilities::NativeFileStream = typedef std::fstream |
Definition at line 76 of file nativefilestream.h.
|
strong |
const char * IoUtilities::catchIoFailure | ( | ) |
Provides a workaround for GCC Bug 66145.
Throws | the current exception if it is not std::ios_base::failure. |
Definition at line 36 of file catchiofailure.cpp.
string IoUtilities::directory | ( | const std::string & | path | ) |
std::list< std::string > IoUtilities::directoryEntries | ( | const char * | path, |
DirectoryEntryType | types | ||
) |
Returns the names of the directory entries in the specified path with the specified types.
string IoUtilities::fileName | ( | const std::string & | path | ) |
constexpr DirectoryEntryType IoUtilities::operator & | ( | DirectoryEntryType | lhs, |
DirectoryEntryType | rhs | ||
) |
constexpr DirectoryEntryType IoUtilities::operator| | ( | DirectoryEntryType | lhs, |
DirectoryEntryType | rhs | ||
) |
|
inline |
CPP_UTILITIES_EXPORT std::string IoUtilities::readFile | ( | const string & | path, |
std::string::size_type | maxSize | ||
) |
void IoUtilities::removeInvalidChars | ( | std::string & | fileName | ) |
bool IoUtilities::settingsDirectory | ( | std::string & | result, |
std::string | applicationDirectoryName, | ||
bool | createApplicationDirectory | ||
) |
Locates a directory meant to store application settings.
result | Specifies a string to store the path in. |
applicationDirectoryName | Specifies the name for the application subdirectory. |
createApplicationDirectory | Indicates wheter the application subdirectory should be created if not present. |
void IoUtilities::throwIoFailure | ( | const char * | what | ) |
Throws an std::ios_base::failure with the specified message.
Definition at line 49 of file catchiofailure.cpp.