DCMTK Version 3.7.0 OFFIS DICOM Toolkit

Public Member Functions | Private Attributes | List of all members
OFFilename Class Reference

class for managing filenames consisting either of conventional (8-bit) or wide (e.g. 16-bit) characters. More...

## Public Member Functions
| OFFilename ()
| default constructor
| OFFilename (const char *filename, const OFBool convert=OFFalse)
| constructor expecting a conventional character string More...
| OFFilename (const OFString &filename, const OFBool convert=OFFalse)
| constructor expecting a character string as an OFString instance More...
| OFFilename (const OFpath &path, const OFBool convert=OFFalse)
| constructor expecting an OFpath instance More...
| OFFilename (const wchar_t *filename, const OFBool convert=OFTrue)
| constructor expecting a wide character string More...
| OFFilename (const OFFilename &arg)
| copy constructor More...
| ~OFFilename ()
| destructor. More...
OFFilename & | operator= (const OFFilename &arg)
| assignment operator More...
void | clear ()
| clear currently stored filename
void | swap (OFFilename &arg)
| fast, non-throwing swap function. More...
OFBool | isEmpty () const
| check whether this object stores an empty filename More...
OFBool | usesWideChars () const
| check whether this object stores a wide character filename More...
const char * | getCharPointer () const
| get stored filename consisting of conventional characters More...
const wchar_t * | getWideCharPointer () const
| get stored filename consisting of wide characters More...
OFBool | isStandardStream () const
| check whether the standard input or output streams should be used by comparing the filename with "-" More...
void | set (const char *filename, const OFBool convert=OFFalse)
| replace currently stored filename by given value More...
void | set (const OFString &filename, const OFBool convert=OFFalse)
| replace currently stored filename by given value More...
void | set (const OFpath &path, const OFBool convert=OFFalse)
| replace currently stored filename by given value More...
void | set (const wchar_t *filename, const OFBool convert=OFTrue)
| replace currently stored filename by given value More...

## Private Attributes
char * | filename_
| filename consisting of conventional characters (8-bit, e.g. UTF-8)
wchar_t * | wfilename_
| filename consisting of wide characters (e.g. More...

## Detailed Description

class for managing filenames consisting either of conventional (8-bit) or wide (e.g. 16-bit) characters.

The wide character support is currently Windows-specific because most other operating systems use UTF-8, which is compatible with conventional 8-bit character strings.

## Constructor & Destructor Documentation

## ◆ OFFilename() [1/5]

OFFilename::OFFilename | ( | const char * | filename,
|  | const OFBool | convert = `OFFalse`
| ) |  |

constructor expecting a conventional character string

Parameters

  filename | filename to be stored (8-bit characters, e.g. UTF-8)
  convert | convert given filename to wide character encoding as an alternative representation. Only works on Windows systems.

## ◆ OFFilename() [2/5]

OFFilename::OFFilename | ( | const OFString & | filename,
|  | const OFBool | convert = `OFFalse`
| ) |  |

constructor expecting a character string as an OFString instance

Parameters

  filename | filename to be stored (8-bit characters, e.g. UTF-8)
  convert | convert given filename to wide character encoding as an alternative representation. Only works on Windows systems.

## ◆ OFFilename() [3/5]

OFFilename::OFFilename | ( | const OFpath & | path,
|  | const OFBool | convert = `OFFalse`
| ) |  |

constructor expecting an OFpath instance

Parameters

  path | OFpath instance storing a filename in native format (currently, identical to an 8-bit character string)
  convert | convert given filename to wide character encoding as an alternative representation. Only works on Windows systems.

## ◆ OFFilename() [4/5]

OFFilename::OFFilename | ( | const wchar_t * | filename,
|  | const OFBool | convert = `OFTrue`
| ) |  |

constructor expecting a wide character string

Remarks
  This constructor is only available if DCMTK is compiled on Windows Operating Systems with wide chars enabled (defining _WIN32 as well as WIDE_CHAR_FILE_IO_FUNCTIONS or WIDE_CHAR_MAIN_FUNCTION).

Parameters

  filename | filename to be stored (e.g. 16-bit characters)
  convert | convert given filename to UTF-8 encoding as an alternative representation. Only works on Windows systems.

## ◆ OFFilename() [5/5]

OFFilename::OFFilename | ( | const OFFilename & | arg | ) |

copy constructor

Parameters

  arg | filename object to be copied

## ◆ ~OFFilename()

OFFilename::~OFFilename | ( |  | ) |

destructor.

Frees memory.

## Member Function Documentation

## ◆ getCharPointer()

const char* OFFilename::getCharPointer | ( |  | ) | const
| inline

get stored filename consisting of conventional characters

Returns
  filename (might be NULL if none is stored)

## ◆ getWideCharPointer()

const wchar_t* OFFilename::getWideCharPointer | ( |  | ) | const
| inline

get stored filename consisting of wide characters

Remarks
  This method is only available if DCMTK is compiled on Windows Operating Systems with wide chars enabled (defining _WIN32 as well as WIDE_CHAR_FILE_IO_FUNCTIONS or WIDE_CHAR_MAIN_FUNCTION).

Returns
  wide char filename (might be NULL if none is stored)

## ◆ isEmpty()

OFBool OFFilename::isEmpty | ( |  | ) | const

check whether this object stores an empty filename

Returns
  OFTrue if the filename is empty, OFFalse otherwise

## ◆ isStandardStream()

OFBool OFFilename::isStandardStream | ( |  | ) | const
| inline

check whether the standard input or output streams should be used by comparing the filename with "-"

Returns
  OFTrue if stdin or stdout should be used, OFFalse otherwise

## ◆ operator=()

OFFilename& OFFilename::operator= | ( | const OFFilename & | arg | ) |

assignment operator

Parameters

  arg | filename object to be copied

Returns
  reference to this filename object

## ◆ set() [1/4]

void OFFilename::set | ( | const char * | filename,
|  | const OFBool | convert = `OFFalse`
| ) |  |

replace currently stored filename by given value

Parameters

  filename | filename to be stored (8-bit characters, e.g. UTF-8)
  convert | convert given filename to wide character encoding as an alternative representation. Only works on Windows systems.

## ◆ set() [2/4]

void OFFilename::set | ( | const OFpath & | path,
|  | const OFBool | convert = `OFFalse`
| ) |  |

replace currently stored filename by given value

Parameters

  OFpath | OFpath instance storing a filename in native format (currently, identical to an 8-bit character string)
  convert | convert given filename to wide character encoding as an alternative representation). Only works on Windows systems.

## ◆ set() [3/4]

void OFFilename::set | ( | const OFString & | filename,
|  | const OFBool | convert = `OFFalse`
| ) |  |

replace currently stored filename by given value

Parameters

  filename | filename to be stored (8-bit characters, e.g. UTF-8)
  convert | convert given filename to wide character encoding as an alternative representation). Only works on Windows systems.

## ◆ set() [4/4]

void OFFilename::set | ( | const wchar_t * | filename,
|  | const OFBool | convert = `OFTrue`
| ) |  |

replace currently stored filename by given value

Remarks
  This method is only available if DCMTK is compiled on Windows Operating Systems with wide chars enabled (defining _WIN32 as well as WIDE_CHAR_FILE_IO_FUNCTIONS or WIDE_CHAR_MAIN_FUNCTION).

Parameters

  filename | filename to be stored (e.g. 16-bit characters)
  convert | convert given filename to UTF-8 encoding as an alternative representation. Only works on Windows systems.

## ◆ swap()

void OFFilename::swap | ( | OFFilename & | arg | ) |

fast, non-throwing swap function.

The time complexity of this function is constant.

Parameters

  arg | filename object to swap with

## ◆ usesWideChars()

OFBool OFFilename::usesWideChars | ( |  | ) | const
| inline

check whether this object stores a wide character filename

Returns
  OFTrue if the filename uses wide characters, OFFalse otherwise

## Member Data Documentation

## ◆ wfilename_

wchar_t* OFFilename::wfilename_
| private

filename consisting of wide characters (e.g.

16-bit on Windows)

Remarks
  This member is only available if DCMTK is compiled on Windows Operating Systems with wide chars enabled (defining _WIN32 as well as WIDE_CHAR_FILE_IO_FUNCTIONS or WIDE_CHAR_MAIN_FUNCTION).

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

- ofstd/include/dcmtk/ofstd/offile.h

Generated on Mon Dec 15 2025 for DCMTK Version 3.7.0 by Doxygen 1.9.1