33 #include "dcmtk/config/osconfig.h" 34 #include "dcmtk/ofstd/oflist.h" 35 #include "dcmtk/ofstd/ofstring.h" 36 #include "dcmtk/ofstd/oftypes.h" 37 #include "dcmtk/ofstd/ofcond.h" 39 #define INCLUDE_CSTDLIB 40 #define INCLUDE_CSTDIO 41 #define INCLUDE_CSTRING 42 #define INCLUDE_UNISTD 43 #include "dcmtk/ofstd/ofstdinc.h" 46 #ifdef HAVE_SYS_TYPES_H 47 #include <sys/types.h> 97 static inline size_t strlcpy(
char *dst,
const char *src,
size_t siz)
100 return ::strlcpy(dst, src, siz);
123 static inline size_t strlcat(
char *dst,
const char *src,
size_t siz)
126 return ::strlcat(dst, src, siz);
142 static const char *
strerror(
const int errnum,
144 const size_t buflen);
229 const OFBool assumeDirName = OFTrue);
244 const OFBool assumeFilename = OFTrue);
259 const OFBool allowEmptyDirName = OFFalse);
279 const OFBool allowEmptyDirName = OFFalse);
294 const OFBool allowLeadingPathSeparator = OFTrue);
312 const OFBool recurse = OFTrue);
337 const OFBool convertNonASCII = OFFalse);
361 const OFBool convertNonASCII = OFFalse,
363 const OFBool newlineAllowed = OFFalse);
387 const OFBool convertNonASCII = OFFalse,
389 const OFBool newlineAllowed = OFFalse);
405 const unsigned char *data,
407 const size_t width = 0);
425 const size_t width = 0);
441 unsigned char *&result);
477 static double atof(
const char *s,
478 OFBool *success = NULL);
503 static void ftoa(
char *target,
506 unsigned int flags = 0,
543 static inline unsigned int sleep(
unsigned int seconds)
545 #if defined(HAVE_SLEEP) && !defined(HAVE_WINDOWS_H) 548 return ::sleep(seconds);
565 const Uint32 summand2)
567 return (0xffffffff - summand1 < summand2);
580 static size_t my_strlcpy(
char *dst,
const char *src,
size_t siz);
590 static size_t my_strlcat(
char *dst,
const char *src,
size_t siz);
597 static unsigned int my_sleep(
unsigned int seconds);
HTML (Hyper Text Markup Language)
XML (Extensible Markup Language)
static const unsigned int ftoa_zeropad
pad with zeroes instead of blanks
static const OFString & convertToMarkupString(const OFString &sourceString, OFString &markupString, const OFBool convertNonASCII=OFFalse, const E_MarkupMode markupMode=MM_XML, const OFBool newlineAllowed=OFFalse)
convert character string to HTML/XHTML/XML mnenonic string.
static OFBool checkForMarkupConversion(const OFString &sourceString, const OFBool convertNonASCII=OFFalse)
check whether conversion to HTML/XML mnenonic string is required.
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 i...
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 i...
static OFBool isReadable(const OFString &pathName)
check whether the given path is readable.
static OFBool pathExists(const OFString &pathName)
check whether the given path exists.
static OFString & getDirNameFromPath(OFString &result, const OFString &pathName, const OFBool assumeDirName=OFTrue)
get directory name component from given path name.
static OFString & normalizeDirName(OFString &result, const OFString &dirName, const OFBool allowEmptyDirName=OFFalse)
normalize the given directory name.
static OFString & toUpper(OFString &result, const OFString &value)
returns the upper-case version of a given string
static const char * strerror(const int errnum, char *buf, const size_t buflen)
convert a given error code to a string.
static const unsigned int ftoa_uppercase
Use E, F or G conversion format instead of e, f or g.
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 OFString & toLower(OFString &result, const OFString &value)
returns the lower-case version of a given string
static long getProcessID()
Determines the identification of the running process.
HTML 3.2 (Hyper Text Markup Language)
static const unsigned int ftoa_format_f
Use f or F conversion format instead of g or G.
static OFBool dirExists(const OFString &dirName)
check whether the given directory exists.
XHTML (Extensible Hyper Text Markup Language)
static OFString & getFilenameFromPath(OFString &result, const OFString &pathName, const OFBool assumeFilename=OFTrue)
get file name component from given path name.
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...
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 isWriteable(const OFString &pathName)
check whether the given path is writeable.
E_MarkupMode
Markup language mode.
static const unsigned int ftoa_alternate
convert value to alternate form.
static OFCondition removeRootDirFromPathname(OFString &result, const OFString &rootDir, const OFString &pathName, const OFBool allowLeadingPathSeparator=OFTrue)
remove root directory prefix from given path name.
static const unsigned int ftoa_leftadj
left-justify number be within the field
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 size_t decodeBase64(const OFString &data, unsigned char *&result)
decode "Base64" encoded string.
a simple string class that implements a subset of std::string.
static OFBool fileExists(const OFString &fileName)
check whether the given file exists.
static size_t getFileSize(const OFString &filename)
determine size of given file (in bytes)
A class for various helper functions.
static const unsigned int ftoa_format_e
Use e or E conversion format instead of g or G.
static OFBool check32BitAddOverflow(const Uint32 summand1, const Uint32 summand2)
check whether the addition of two 32-bit integers yields in an overflow
static size_t my_strlcat(char *dst, const char *src, size_t siz)
private implementation of strlcat.
static OFBool deleteFile(const OFString &filename)
delete given file from filesystem
static OFCondition convertToMarkupStream(STD_NAMESPACE ostream &out, const OFString &sourceString, const OFBool convertNonASCII=OFFalse, const E_MarkupMode markupMode=MM_XML, const OFBool newlineAllowed=OFFalse)
convert character string to HTML/XHTML/XML mnenonic stream.
static double atof(const char *s, OFBool *success=NULL)
converts a floating-point number from an ASCII decimal representation to internal double-precision fo...
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 my_strlcpy(char *dst, const char *src, size_t siz)
private implementation of strlcpy.
General purpose class for condition codes.