DCMTK  Version 3.6.1 20120515
OFFIS DICOM Toolkit
Public Types | Static Public Member Functions | Static Public Attributes | Static Private Member Functions
OFStandard Class Reference

A class for various helper functions. More...

List of all members.

Public Types

enum  E_MarkupMode { MM_HTML, MM_HTML32, MM_XHTML, MM_XML }
 Markup language mode. More...

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 const char * strerror (const int errnum, char *buf, const size_t buflen)
 convert a given error code to a string.
static OFStringtoUpper (OFString &result, const OFString &value)
 returns the upper-case version of a given string
static OFStringtoUpper (OFString &value)
 returns the upper-case version of a given string.
static OFStringtoLower (OFString &result, const OFString &value)
 returns the lower-case version of a given string
static OFStringtoLower (OFString &value)
 returns the lower-case version of a given string.
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 OFStringgetDirNameFromPath (OFString &result, const OFString &pathName, const OFBool assumeDirName=OFTrue)
 get directory name component from given path name.
static OFStringgetFilenameFromPath (OFString &result, const OFString &pathName, const OFBool assumeFilename=OFTrue)
 get file name component from given path name.
static OFStringnormalizeDirName (OFString &result, const OFString &dirName, const OFBool allowEmptyDirName=OFFalse)
 normalize the given directory name.
static OFStringcombineDirAndFilename (OFString &result, const OFString &dirName, const OFString &fileName, const OFBool allowEmptyDirName=OFFalse)
 combine the given directory and file name.
static OFCondition removeRootDirFromPathname (OFString &result, const OFString &rootDir, const OFString &pathName, const OFBool allowLeadingPathSeparator=OFTrue)
 remove root directory prefix from given path name.
static size_t searchDirectoryRecursively (const OFString &directory, OFList< OFString > &fileList, const OFString &pattern, const OFString &dirPrefix, const OFBool recurse=OFTrue)
 scan a given directory (recursively) and add all filenames found to a list
static OFBool deleteFile (const OFFilename &filename)
 delete given file from filesystem
static size_t getFileSize (const OFString &filename)
 determine size of given file (in bytes)
static OFBool checkForMarkupConversion (const OFString &sourceString, const OFBool convertNonASCII=OFFalse, const size_t maxLength=0)
 check whether conversion to a HTML/XML mnenonic string is required.
static OFCondition convertToMarkupStream (STD_NAMESPACE ostream &out, const OFString &sourceString, const OFBool convertNonASCII=OFFalse, const E_MarkupMode markupMode=MM_XML, const OFBool newlineAllowed=OFFalse, const size_t maxLength=0)
 convert character string to a HTML/XHTML/XML mnenonic stream.
static const OFStringconvertToMarkupString (const OFString &sourceString, OFString &markupString, const OFBool convertNonASCII=OFFalse, const E_MarkupMode markupMode=MM_XML, const OFBool newlineAllowed=OFFalse, const size_t maxLength=0)
 convert character string to a HTML/XHTML/XML mnenonic string.
static OFBool checkForOctalConversion (const OFString &sourceString, const size_t maxLength=0)
 check whether conversion to an octal format is required.
static OFCondition convertToOctalStream (STD_NAMESPACE ostream &out, const OFString &sourceString, const size_t maxLength=0)
 convert character string to an octal format stream.
static const OFStringconvertToOctalString (const OFString &sourceString, OFString &octalString, const size_t maxLength=0)
 convert character string to an octal format string.
static OFCondition encodeBase64 (STD_NAMESPACE ostream &out, const unsigned char *data, const size_t length, const size_t width=0)
 encode binary data according to "Base64" as described in RFC 2045 (MIME).
static const OFStringencodeBase64 (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 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 void milliSleep (unsigned int millisecs)
 makes the current process sleep until the given number of milliseconds have elapsed or a signal which is not ignored arrives
static long getProcessID ()
 Determines the identification of the running process.
static OFBool check32BitAddOverflow (const Uint32 summand1, const Uint32 summand2)
 check whether the addition of two 32-bit integers yields in an overflow
static int rand_r (unsigned int &seed)
 simple but thread safe random number generator.

Static Public Attributes

static const unsigned int rand_max
 maximum value that can be returned by rand_r()
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

Detailed Description

A class for various helper functions.

This class is used to comprise a number of "global" helper functions.


Member Enumeration Documentation

Markup language mode.

Enumerator:
MM_HTML 

HTML (Hyper Text Markup Language)

MM_HTML32 

HTML 3.2 (Hyper Text Markup Language)

MM_XHTML 

XHTML (Extensible Hyper Text Markup Language)

MM_XML 

XML (Extensible Markup Language)


Member Function Documentation

static double OFStandard::atof ( const char *  s,
OFBool *  success = NULL 
) [static]

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.

Parameters:
sA decimal ASCII floating-point number, optionally preceded by white space. Must have form "-I.FE-X", where I is the integer part of the mantissa, F is the fractional part of the mantissa, and X is the exponent. Either of the signs may be "+", "-", or omitted. Either I or F may be omitted, or both. The decimal point isn't necessary unless F is present. The "E" may actually be an "e". E and X may both be omitted (but not just one).
successpointer to return status code, may be NULL. if present, a status code is stored in the variable pointed to by this parameter. The status is OFTrue if a conversion could be performed and OFFalse if the string does not have the expected format.
Returns:
floating-point equivalent of string. If a terminating character is found before any floating-point digits, then zero is returned.
static OFBool OFStandard::check32BitAddOverflow ( const Uint32  summand1,
const Uint32  summand2 
) [inline, static]

check whether the addition of two 32-bit integers yields in an overflow

Parameters:
summand1first integer value to be added
summand2second integer value to be added
Returns:
OFTrue if an overflow occurred during the addition, OFFalse otherwise
static OFBool OFStandard::checkForMarkupConversion ( const OFString sourceString,
const OFBool  convertNonASCII = OFFalse,
const size_t  maxLength = 0 
) [static]

check whether conversion to a HTML/XML mnenonic string is required.

This check can be performed before convertToMarkupStream() or convertToMarkupString() is called in order to speed up the process in case the conversion is not required.

Parameters:
sourceStringsource string to be checked. May contain one or more NULL bytes.
convertNonASCIIconvert non-ASCII characters (< #32 and >= #127) to numeric value (&#nnn;) if OFTrue
maxLengthmaximum number of characters from the source string to be converted. A value of 0 means all characters.
Returns:
OFTrue if markup conversion is required, OFFalse otherwise
static OFBool OFStandard::checkForOctalConversion ( const OFString sourceString,
const size_t  maxLength = 0 
) [static]

check whether conversion to an octal format is required.

This check can be performed before convertToOctalStream() or convertToOctalString() is called in order to speed up the process in case the conversion is not required.

Parameters:
sourceStringsource string to be checked. May contain one or more NULL bytes.
maxLengthmaximum number of characters from the source string to be converted. A value of 0 means all characters.
Returns:
OFTrue if markup conversion is required, OFFalse otherwise
static OFString& OFStandard::combineDirAndFilename ( OFString result,
const OFString dirName,
const OFString fileName,
const OFBool  allowEmptyDirName = OFFalse 
) [static]

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. Furthermore, the value of 'dirName' is ignored if 'fileName' starts with a path separator.

Parameters:
resultstring variable in which the resulting path name is stored
dirNamedirectory name to be combined with the file name
fileNamefile name to be combined with the directory name
allowEmptyDirNameflag indicating whether an empty directory name is allowed
Returns:
reference to the resulting path name (same as 'result')
static OFCondition OFStandard::convertToMarkupStream ( STD_NAMESPACE ostream &  out,
const OFString sourceString,
const OFBool  convertNonASCII = OFFalse,
const E_MarkupMode  markupMode = MM_XML,
const OFBool  newlineAllowed = OFFalse,
const size_t  maxLength = 0 
) [static]

convert character string to a HTML/XHTML/XML mnenonic stream.

Characters with special meaning for HTML/XHTML/XML (e.g. '<' and '&') are replaced by the corresponding mnenonics (e.g. "&lt;" and "&amp;"). If flag 'convertNonASCII' is OFTrue, all characters < #32 and >= #127 are also converted (useful if only HTML 3.2 is supported which does not allow to specify the character set). In HTML 3.2 mode, the quotation mark (") is converted to "&#34;" instead of """ because the latter entity is not defined. In HTML mode, the apostrophe sign (') is converted to "&#39;" instead of "'" for the same reason.

Parameters:
outstream used for the HTML/XHTML/XML mnenonic output
sourceStringsource string to be converted. May contain one or more NULL bytes.
convertNonASCIIconvert non-ASCII characters (< # 32 and >= #127) to numeric value (&#nnn;) if OFTrue
markupModeconvert to HTML, HTML 3.2, XHTML or XML markup. LF and CR are encoded as "&#10;" and "&#13;" in XML mode, the flag 'newlineAllowed' has no meaning in this case.
newlineAllowedoptional flag indicating whether newlines are allowed or not. If they are allowed, the text "<br>" (HTML) or "<br />" (XHTML) is used, "&para;" otherwise. The following combinations are accepted: LF, CR, LF CR, CF LF.
maxLengthmaximum number of characters from the source string to be converted. A value of 0 means all characters.
Returns:
status, always returns EC_Normal
static const OFString& OFStandard::convertToMarkupString ( const OFString sourceString,
OFString markupString,
const OFBool  convertNonASCII = OFFalse,
const E_MarkupMode  markupMode = MM_XML,
const OFBool  newlineAllowed = OFFalse,
const size_t  maxLength = 0 
) [static]

convert character string to a HTML/XHTML/XML mnenonic string.

Characters with special meaning for HTML/XHTML/XML (e.g. '<' and '&') are replaced by the corresponding mnenonics (e.g. "&lt;" and "&amp;"). If flag 'convertNonASCII' is OFTrue, all characters < #32 and >= #127 are also converted (useful if only HTML 3.2 is supported which does not allow to specify the character set). In HTML 3.2 mode, the quotation mark (") is converted to "&#34;" instead of """ because the latter entity is not defined. In HTML mode, the apostrophe sign (') is converted to "&#39;" instead of "'" for the same reason.

Parameters:
sourceStringsource string to be converted. May also contain one or more NULL bytes.
markupStringreference to character string where the result should be stored
convertNonASCIIconvert non-ASCII characters (< # 32 and >= #127) to numeric value (&#nnn;) if OFTrue
markupModeconvert to HTML, HTML 3.2, XHTML or XML markup string. LF and CR are encoded as "@&@#10;" and "@&@#13;" in XML mode, the flag 'newlineAllowed' has no meaning in this case.
newlineAllowedoptional flag indicating whether newlines are allowed or not. If they are allowed, the text "<br>" (HTML) or "<br />" (XHTML) is used, "&para;" otherwise. The following combinations are accepted: LF, CR, LF CR, CF LF.
maxLengthmaximum number of characters from the source string to be converted. A value of 0 means all characters.
Returns:
reference to resulting 'markupString' (might be empty if 'sourceString' was empty)
static OFCondition OFStandard::convertToOctalStream ( STD_NAMESPACE ostream &  out,
const OFString sourceString,
const size_t  maxLength = 0 
) [static]

convert character string to an octal format stream.

All non-ASCII and control characters (code < #32 and >= #127) are converted to their octal representation, i.e. to '' where 'ooo' are the three octal digits of the character. All other characters are output as is. See section 6.1.2.3 in DICOM PS 3.5.

Parameters:
outstream used for the output
sourceStringsource string to be converted. May contain one or more NULL bytes.
maxLengthmaximum number of characters from the source string to be converted. A value of 0 means all characters.
Returns:
status, always returns EC_Normal
static const OFString& OFStandard::convertToOctalString ( const OFString sourceString,
OFString octalString,
const size_t  maxLength = 0 
) [static]

convert character string to an octal format string.

All non-ASCII and control characters (code < #32 and >= #127) are converted to their octal representation, i.e. to '' where 'ooo' are the three octal digits of the character. All other characters are output as is. See section 6.1.2.3 in DICOM PS 3.5.

Parameters:
sourceStringsource string to be converted. May contain one or more NULL bytes.
octalStringreference to character string where the result should be stored
maxLengthmaximum number of characters from the source string to be converted. A value of 0 means all characters.
Returns:
reference to resulting 'octalString' (might be empty if 'sourceString' was empty)
static size_t OFStandard::decodeBase64 ( const OFString data,
unsigned char *&  result 
) [static]

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.

Parameters:
dataBase64 encoded input data (possibly padded with '=' at the end)
resultreceives pointer to resulting buffer with binary data (big endian encoded)
Returns:
length of the resulting binary data (0 if an error occurred, in this case the buffer is deleted internally)
static OFBool OFStandard::deleteFile ( const OFFilename filename) [static]

delete given file from filesystem

Parameters:
filenamename of the file (including directory) to delete. This filename may contain wide characters if support enabled. Since there are various constructors for the OFFilename class, a "char *", "OFString" or "wchar_t *" can also be passed directly to this parameter.
Returns:
OFTrue if deletion was successul, OFFalse otherwise
static OFBool OFStandard::dirExists ( const OFString dirName) [static]

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).

Parameters:
dirNamename of the directory to be checked
Returns:
OFTrue if directory exists, OFFalse otherwise
static OFCondition OFStandard::encodeBase64 ( STD_NAMESPACE ostream &  out,
const unsigned char *  data,
const size_t  length,
const size_t  width = 0 
) [static]

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 error code (EC_IllegalParameter) is returned.

Parameters:
outoutput stream used for the base64 encoded data
databuffer with binary data to be encoded (big endian required!)
lengthlength of the input data buffer (in bytes)
widthmaximum number of characters per line in the output stream (default: 0 = no line breaks, typical for MIME = 72)
Returns:
status, EC_Normal if successful, an error code otherwise
static const OFString& OFStandard::encodeBase64 ( const unsigned char *  data,
const size_t  length,
OFString result,
const size_t  width = 0 
) [static]

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.

Parameters:
databuffer with binary data to be encoded (big endian required!)
lengthlength of the input data buffer (in bytes)
resultreference to resulting string variable (Base64 encoded)
widthmaximum number of characters per line in the output string (default: 0 = no line breaks, typical for MIME = 72)
Returns:
reference to the resulting string
static OFBool OFStandard::fileExists ( const OFString fileName) [static]

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).

Parameters:
fileNamename of the file to be checked
Returns:
OFTrue if file exists, OFFalse otherwise
static void OFStandard::ftoa ( char *  target,
size_t  targetSize,
double  value,
unsigned int  flags = 0,
int  width = 0,
int  precision = -1 
) [static]

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.

Parameters:
targetpointer to target string buffer
targetSizesize of target string buffer
valuedouble value to be formatted
flagsprocessing flags. Any of the flags defined below can be combined by bit-wise or.
widthwidth from format (%8d), or 0
precisionprecision from format (%.3d), or -1
static OFString& OFStandard::getDirNameFromPath ( OFString result,
const OFString pathName,
const OFBool  assumeDirName = OFTrue 
) [static]

get directory name component from given path name.

Extracts the substring before the last path separator. If there is no path separator in the given path name, the value of 'pathName' is returned by default; if 'assumeDirName' is OFFalse, an empty string is returned. NB: This function neither checks whether the given 'pathName' exists nor whether the resulting name points to a valid or existing directory.

Parameters:
resultstring variable in which the resulting directory name is stored
pathNamepath name from which the directory name should be extracted
assumeDirNameassume that there always is a directory name in 'pathName'
Returns:
reference to the resulting directory name (same as 'result')
static OFString& OFStandard::getFilenameFromPath ( OFString result,
const OFString pathName,
const OFBool  assumeFilename = OFTrue 
) [static]

get file name component from given path name.

Extracts the substring after the last path separator. If there is no path separator in the given path name, the value of 'pathName' is returned by default; if 'assumeFilename' is OFFalse, an empty string is returned. NB: This function neither checks whether the given 'pathName' exists nor whether the resulting name points to a valid or existing file.

Parameters:
resultstring variable in which the resulting file name is stored
pathNamepath name from which the file name should be extracted
assumeFilenameassume that there always is a file name in 'pathName'
Returns:
reference to the resulting file name (same as 'result')
static size_t OFStandard::getFileSize ( const OFString filename) [static]

determine size of given file (in bytes)

Parameters:
filenamename of the file to be checked
Returns:
size of the file in bytes (0 in case of error)
static long OFStandard::getProcessID ( ) [static]

Determines the identification of the running process.

Returns:
the process ID of the currently running process.
static OFBool OFStandard::isReadable ( const OFString pathName) [static]

check whether the given path is readable.

This function works for both files and directories.

Parameters:
pathNamename of the path to be checked
Returns:
OFTrue if path is readable, OFFalse otherwise
static OFBool OFStandard::isWriteable ( const OFString pathName) [static]

check whether the given path is writeable.

This function works for both files and directories.

Parameters:
pathNamename of the path to be checked
Returns:
OFTrue if path is writeable, OFFalse otherwise
static void OFStandard::milliSleep ( unsigned int  millisecs) [static]

makes the current process sleep until the given number of milliseconds have elapsed or a signal which is not ignored arrives

Parameters:
millisecsnumber of milliseconds to sleep
static unsigned int OFStandard::my_sleep ( unsigned int  seconds) [static, private]

makes the current process sleep until seconds seconds have elapsed or a signal arrives which is not ignored

Parameters:
secondsnumber of seconds to sleep
Returns:
zero if the requested time has elapsed, or the number of seconds left to sleep
static size_t OFStandard::my_strlcat ( char *  dst,
const char *  src,
size_t  siz 
) [static, private]

private implementation of strlcat.

Called when strlcat is not available in the standard library.

Parameters:
dstdestination buffer of size siz, must not be NULL
srcsource string, must not be NULL
sizsize of destination buffer
Returns:
the total length of the string the function tried to create, i.e. the initial length of dst plus the length of src
static size_t OFStandard::my_strlcpy ( char *  dst,
const char *  src,
size_t  siz 
) [static, private]

private implementation of strlcpy.

Called when strlcpy is not available in the standard library.

Parameters:
dstdestination buffer of size siz, must not be NULL
srcsource string, must not be NULL
sizsize of destination buffer
Returns:
the total length of the string the function tried to create, i.e. strlen(src)
static OFString& OFStandard::normalizeDirName ( OFString result,
const OFString dirName,
const OFBool  allowEmptyDirName = OFFalse 
) [static]

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.

Parameters:
resultstring variable in which the resulting directory name is stored
dirNamedirectory name to be normalized
allowEmptyDirNameflag indicating whether an empty directory name is allowed
Returns:
reference to the resulting directory name (same as 'result')
static OFBool OFStandard::pathExists ( const OFString pathName) [static]

check whether the given path exists.

This function does not distinguish files from directories (use 'fileExists()' or 'directoryExists()' if required).

Parameters:
pathNamename of the path to be checked
Returns:
OFTrue if path exists, OFFalse otherwise
static int OFStandard::rand_r ( unsigned int &  seed) [static]

simple but thread safe random number generator.

The interface is derived from the Posix rand_r function. Uses a multiplicative congruential random-number generator with period 2**32 that returns successive pseudo-random numbers in the range of 0 to randr_max (0x7fffffff).

Parameters:
seedpointer to seed of random number generator, must not be NULL.
Returns:
pseudo-random number in the range of 0 to myrandr_max.
static OFCondition OFStandard::removeRootDirFromPathname ( OFString result,
const OFString rootDir,
const OFString pathName,
const OFBool  allowLeadingPathSeparator = OFTrue 
) [static]

remove root directory prefix from given path name.

In case 'pathName' starts with 'rootDir', the common prefix is removed. Otherwise, an empty string is returned.

Parameters:
resultstring variable in which the resulting path name is stored
rootDirname of the root directory to be removed
pathNamepath name from which the root directory (prefix) is removed
allowLeadingPathSeparatorflag indicating whether a leading path separator is allowed for the resulting path name (automatically removed otherwise)
Returns:
status, EC_Normal if successful, an error code otherwise
static size_t OFStandard::searchDirectoryRecursively ( const OFString directory,
OFList< OFString > &  fileList,
const OFString pattern,
const OFString dirPrefix,
const OFBool  recurse = OFTrue 
) [static]

scan a given directory (recursively) and add all filenames found to a list

Parameters:
directoryname of the directory to be scanned
fileListlist to which the filenames are added. Please note that the list is not not cleared automatically.
patternoptional wildcard pattern used to match the filenames against. By default all files match. In order to work under Unix the system function fnmatch() is required.
dirPrefixoptional prefix added to the directory name. This prefix will, however, not be part of the filenames added to the list.
recurseflag indicating whether to search recursively (default) or not
Returns:
number of new files added to the list
static unsigned int OFStandard::sleep ( unsigned int  seconds) [inline, static]

makes the current process sleep until seconds seconds have elapsed or a signal arrives which is not ignored

Parameters:
secondsnumber of seconds to sleep
Returns:
zero if the requested time has elapsed, or the number of seconds left to sleep
static const char* OFStandard::strerror ( const int  errnum,
char *  buf,
const size_t  buflen 
) [static]

convert a given error code to a string.

This function wraps the various approaches found on different systems. Internally, the standard function strerror() or strerror_r() is used.

Parameters:
errnumerror code to be converted
bufbuffer which is used to store the result string (if supported)
buflensize if the buffer in bytes
Returns:
pointer to string describing the error code. Please note that depending on the implementation of the function used, the result may or may not be a pointer to buf. The return value can also be NULL if the buffer is invalid.
static size_t OFStandard::strlcat ( char *  dst,
const char *  src,
size_t  siz 
) [inline, static]

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.

Parameters:
dstdestination buffer of size siz, must not be NULL
srcsource string, must not be NULL
sizsize of destination buffer
Returns:
the total length of the string the function tried to create, i.e. the initial length of dst plus the length of src. While this may seem somewhat confusing it was done to make truncation detection simple.
static size_t OFStandard::strlcpy ( char *  dst,
const char *  src,
size_t  siz 
) [inline, static]

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.

Parameters:
dstdestination buffer of size siz, must not be NULL
srcsource string, must not be NULL
sizsize of destination buffer
Returns:
the total length of the string the function tried to create, i.e. strlen(src). While this may seem somewhat confusing it was done to make truncation detection simple.
static OFString& OFStandard::toLower ( OFString result,
const OFString value 
) [static]

returns the lower-case version of a given string

Parameters:
resultstring variable in which the result is stored
valuestring value to be converted to lower case
Returns:
reference to the resulting string (same as 'result')
static OFString& OFStandard::toLower ( OFString value) [static]

returns the lower-case version of a given string.

NB: This function changes the parameter 'value'.

Parameters:
valuestring value to be converted to lower case
Returns:
reference to the resulting string (same as 'value')
static OFString& OFStandard::toUpper ( OFString result,
const OFString value 
) [static]

returns the upper-case version of a given string

Parameters:
resultstring variable in which the result is stored
valuestring value to be converted to upper case
Returns:
reference to the resulting string (same as 'result')
static OFString& OFStandard::toUpper ( OFString value) [static]

returns the upper-case version of a given string.

NB: This function changes the parameter 'value'.

Parameters:
valuestring value to be converted to upper case
Returns:
reference to the resulting string (same as 'value')

Member Data Documentation

const unsigned int OFStandard::ftoa_alternate [static]

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.


The documentation for this class was generated from the following file:


Generated on Tue May 15 2012 for DCMTK Version 3.6.1 20120515 by Doxygen 1.7.5.1-20111027