Functions | |
bool | isBlankLine (const std::string &s) |
bool | isIntegerString (const std::string &s) |
bool | isFloatString (const std::string &s) |
bool | isQuoted (const std::string &s) |
bool | isQuotedSentence (const std::string &s) |
std::string | removeSubstring (const std::string &str, const std::string substr) |
std::string | removeEndSlash (const std::string &str) |
std::string | parseUntilQuote (std::istringstream &parser, const std::string &begin) |
template<typename T > | |
std::string | toString (T type) |
std::string | syscallError (const std::string &syscall, int errorCode) |
std::string | getCurrentTime () |
std::string | formatSize (size_t size) |
std::string | getMacroName (int errorCode) |
Variables | |
const int | ERROR_BUFF_SIZE = 2048 |
const size_t | KILOBYTE = 1000 |
const size_t | MEGABYTE = 1000000 |
A namespace with many utility functions, both for UNIX and Win32.
string utils::formatSize | ( | size_t | size | ) |
size | A certain byte size. |
string utils::getCurrentTime | ( | ) |
string utils::getMacroName | ( | int | errorCode | ) |
errorCode | An error code (POSIX or Win32) |
bool utils::isBlankLine | ( | const std::string & | s | ) |
Costant to convert Bytes into Megabytes.
s | A generic string |
bool utils::isFloatString | ( | const std::string & | s | ) |
s | A generic string |
bool utils::isIntegerString | ( | const std::string & | s | ) |
s | A generic string |
bool utils::isQuoted | ( | const std::string & | s | ) |
s | A generic string |
bool utils::isQuotedSentence | ( | const std::string & | s | ) |
s | A generic string |
std::string utils::parseUntilQuote | ( | std::istringstream & | parser, |
const std::string & | begin | ||
) |
Extract words from the given stream until a single quote is found, to create a sentence.
parser | The input stream to be parsed |
begin | A generic string which will be used as the start of the sentence. It should start with a single quote. |
std::string utils::removeEndSlash | ( | const std::string & | str | ) |
str | A generic string |
std::string utils::removeSubstring | ( | const std::string & | str, |
const std::string | substr | ||
) |
str | A generic string |
substr | Another generic string, supposed to be a substring of str. |
string utils::syscallError | ( | const std::string & | syscall, |
int | errorCode | ||
) |
Create a well-formatted string explaining the given error code returned by a failed system call.
syscall | The name of the failed system call. |
errorCode | The error code returned by the failed system call. |
std::string utils::toString | ( | T | type | ) |
type | A generic object to be converted into a string. |
const size_t utils::KILOBYTE = 1000 |
Max char allowed in the error message buffer.
const size_t utils::MEGABYTE = 1000000 |
Constat to convert Bytes into Kilobytes.