Static Public Member Functions | |
static size_t | strlcpy (char *dst, const char *src, size_t siz) |
This function copies up to size - 1 characters from the NUL- terminated string src to dst, NUL-terminating the result. | |
static size_t | strlcat (char *dst, const char *src, size_t siz) |
This function appends the NUL-terminated string src to the end of dst. | |
static OFBool | pathExists (const OFString &pathName) |
check whether the given path exists. | |
static OFBool | fileExists (const OFString &fileName) |
check whether the given file exists. | |
static OFBool | dirExists (const OFString &dirName) |
check whether the given directory exists. | |
static OFBool | isReadable (const OFString &pathName) |
check whether the given path is readable. | |
static OFBool | isWriteable (const OFString &pathName) |
check whether the given path is writeable. | |
static OFString & | normalizeDirName (OFString &result, const OFString &dirName, const OFBool allowEmptyDirName=OFFalse) |
normalize the given directory name. | |
static OFString & | combineDirAndFilename (OFString &result, const OFString &dirName, const OFString &fileName, const OFBool allowEmptyDirName=OFFalse) |
combine the given directory and file name. | |
static size_t | searchDirectoryRecursively (const OFString &directory, OFList< OFString > &fileList, const OFString &pattern, const OFString &dirPrefix) |
scan a given directory recursively and add all filenames found to a list | |
static const OFString & | convertToMarkupString (const OFString &sourceString, OFString &markupString, const OFBool convertNonASCII=OFFalse, const OFBool xmlMode=OFTrue, const OFBool newlineAllowed=OFFalse) |
convert character string to HTML/XML mnenonic string. | |
static const OFString & | encodeBase64 (const unsigned char *data, const size_t length, OFString &result, const size_t width=0) |
encode binary data according to "Base64" as described in RFC 2045 (MIME). | |
static size_t | decodeBase64 (const OFString &data, unsigned char *&result) |
decode "Base64" encoded string. | |
static double | atof (const char *s, OFBool *success=NULL) |
converts a floating-point number from an ASCII decimal representation to internal double-precision format. | |
static void | ftoa (char *target, size_t targetSize, double value, unsigned int flags=0, int width=0, int precision=-1) |
formats a floating-point number into an ASCII string. | |
static OFBool | stringMatchesCharacterSet (const char *str, const char *charset) |
Checks if a given string consists only of characters which are specified in a given charset. | |
static unsigned int | sleep (unsigned int seconds) |
makes the current process sleep until seconds seconds have elapsed or a signal arrives which is not ignored. | |
Static Public Attributes | |
ftoa() processing flags. | |
These flags can be combined by bit-wise or. | |
static const unsigned int | ftoa_format_e |
Use e or E conversion format instead of g or G. | |
static const unsigned int | ftoa_format_f |
Use f or F conversion format instead of g or G. | |
static const unsigned int | ftoa_uppercase |
Use E, F or G conversion format instead of e, f or g. | |
static const unsigned int | ftoa_alternate |
convert value to alternate form. | |
static const unsigned int | ftoa_leftadj |
left-justify number be within the field | |
static const unsigned int | ftoa_zeropad |
pad with zeroes instead of blanks | |
Static Private Member Functions | |
static size_t | my_strlcpy (char *dst, const char *src, size_t siz) |
private implementation of strlcpy. | |
static size_t | my_strlcat (char *dst, const char *src, size_t siz) |
private implementation of strlcat. | |
static unsigned int | my_sleep (unsigned int seconds) |
makes the current process sleep until seconds seconds have elapsed or a signal arrives which is not ignored. |
This class is used to comprise a number of "global" helper functions.
Definition at line 62 of file ofstd.h.
|
converts a floating-point number from an ASCII decimal representation to internal double-precision format. Unlike the atof() function defined in Posix, this implementation is not affected by a locale setting, the radix character is always assumed to be '.' This implementation does not set errno if the input cannot be parsed and it does not implement special handling for overflow/underflow or NaN values. However, a return code indicates whether or not a successful conversion could be performed. The precision of this implementation is limited to approx. 9 decimal digits. The use of this implementation can be disabled by defining the macro DISABLE_OFSTD_ATOF at compile time; in this case, the locale dependent Posix implementation of sscanf is used and the application is responsible for making sure that the Posix locale is activated at all times.
|
|
combine the given directory and file name. Normalizes the directory name and appends the file name (with a path separator) if not empty. If both 'dirName' and 'fileName' are empty strings and the flag 'allowEmptyDirName' is OFFalse the resulting path name is set to "." (current directory). If 'dirName' is "." and the flag 'allowEmptyDirName' is OFTrue an empty directory name is used. NB: This function neither checks whether the given 'dirName' exists nor whether the resulting path name points to a valid or existing file name.
|
|
convert character string to HTML/XML mnenonic string. Characters with special meaning for HTML/XML (e.g. '<' and '&') are replaced by the corresponding mnenonics (e.g. "<" and "&"). If flag 'convertNonASCII' is OFTrue all characters > #127 are also converted (useful if only HTML 3.2 is supported which does not allow to specify the character set).
|
|
decode "Base64" encoded string. Any character that does not belong to the Base64 alphabet (0..9, A..Z, a..z, + and /) is ignored when decoding the input string. This is especially true for line breaks which are usually contained in MIME (RFC 2045) encoded streams (see above). The first occurence of a '=' character is taken as evidence that the end of the data has been reached. NB: The memory buffer in which the binary output is stored is allocated inside this function and has to to be freed (using "delete[]") by the caller! Do not pass a pointer to an already allocated buffer to this function, the caller does not know the exact size anyway.
|
|
check whether the given directory exists. This function also checks that the specified path points to directory and not to a file (or the like).
|
|
encode binary data according to "Base64" as described in RFC 2045 (MIME). Basic algorithm: groups of 3 bytes from the binary input are coded as groups of 4 bytes in the textual output. The input data is 'padded' with zeros to create a length that is an even multiple of 3. A special character ('=') is used to denote padding so that the output can be decoded back to its exact size. If the input data is NULL an empty string is returned.
|
|
check whether the given file exists. This function also checks that the specified path points to file and not to a directory (or the like).
|
|
formats a floating-point number into an ASCII string. This function works similar to sprintf(), except that this implementation is not affected by a locale setting. The radix character is always '.'. This implementation guarantees that the given string size is always respected by using strlcpy to copy the formatted string into the target buffer. The use of this implementation can be disabled by defining the macro DISABLE_OFSTD_FTOA at compile time; in this case, the locale dependent Posix implementation of sprintf is used and the application is responsible for making sure that the Posix locale is activated at all times.
|
|
check whether the given path is readable. This function works for both files and directories.
|
|
check whether the given path is writeable. This function works for both files and directories.
|
|
makes the current process sleep until seconds seconds have elapsed or a signal arrives which is not ignored.
Referenced by sleep(). |
|
private implementation of strlcat. Called when strlcat is not available in the standard library.
Referenced by strlcat(). |
|
private implementation of strlcpy. Called when strlcpy is not available in the standard library.
Referenced by strlcpy(). |
|
normalize the given directory name. Removes trailing path separators from the directory name. If the resulting directory name is an empty string and the flag 'allowEmptyDirName' is OFFalse the directory name is set to "." (current directory). If the resulting directory name is "." and the flag 'allowEmptyDirName' is OFTrue the directory name is set to an empty string.
|
|
check whether the given path exists. This function does not distinguish files from directories (use 'fileExists()' or 'directoryExists()' if required).
|
|
scan a given directory recursively and add all filenames found to a list
|
|
makes the current process sleep until seconds seconds have elapsed or a signal arrives which is not ignored.
Definition at line 378 of file ofstd.h. References my_sleep(). |
|
Checks if a given string consists only of characters which are specified in a given charset. Note that in case one of the parameters equals NULL, OFTrue will be returned.
|
|
This function appends the NUL-terminated string src to the end of dst. It will append at most size - strlen(dst) - 1 bytes, NUL- terminating the result. It is designed to be a safer, more consistent, and less error-prone replacement for strncat(3). strlcat takes the full size of the buffer (not just the length) and guarantees to NUL-terminate the result (as long as size is larger than 0). Note that you should include a byte for the NUL in size. Also note that strlcat only operates on true C strings, i. e. dst and src must be NUL-terminated.
Definition at line 110 of file ofstd.h. References my_strlcat(). |
|
This function copies up to size - 1 characters from the NUL- terminated string src to dst, NUL-terminating the result. It is designed to be a safer, more consistent, and less error-prone replacement for strncpy(3). strlcpy takes the full size of the buffer (not just the length) and guarantees to NUL-terminate the result (as long as size is larger than 0). Note that you should include a byte for the NUL in size. Also note that strlcpy only operates on true C strings, i. e. src must be NUL-terminated.
Definition at line 84 of file ofstd.h. References my_strlcpy(). |
|
convert value to alternate form. The result will always contain a decimal point, even if no digits follow the point. For g and G conversions, trailing zeroes will not be removed from the result. |