OFFIS DCMTK  Version 3.6.0
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
DSRStringValue Class Reference

Class for string values. More...

Inheritance diagram for DSRStringValue:
[legend]
Collaboration diagram for DSRStringValue:
[legend]

Public Member Functions

 DSRStringValue ()
 default contructor
 
 DSRStringValue (const OFString &stringValue)
 constructor The string value is only set if it passed the validity check (see setValue()).
 
 DSRStringValue (const DSRStringValue &stringValue)
 copy constructor
 
virtual ~DSRStringValue ()
 destructor
 
DSRStringValueoperator= (const DSRStringValue &stringValue)
 assignment operator
 
virtual void clear ()
 clear all internal variables.
 
virtual OFBool isValid () const
 check whether the current code is valid.
 
void print (STD_NAMESPACE ostream &stream, const size_t maxLength=0) const
 print string value.
 
OFCondition read (DcmItem &dataset, const DcmTagKey &tagKey)
 read string value from dataset.
 
OFCondition write (DcmItem &dataset, const DcmTagKey &tagKey) const
 write string value to dataset
 
OFCondition readXML (const DSRXMLDocument &doc, DSRXMLCursor cursor, const OFBool encoding=OFFalse)
 read string value from XML document
 
OFCondition renderHTML (STD_NAMESPACE ostream &docStream, const size_t flags) const
 render string value in HTML/XHTML format
 
const OFStringgetValue () const
 get string value
 
OFCondition setValue (const OFString &stringValue)
 set string value.
 

Protected Member Functions

virtual OFBool checkValue (const OFString &stringValue) const
 check the specified string value for validity.
 

Private Attributes

OFString Value
 string value (various VRs, mandatory)
 

Detailed Description

Class for string values.

Definition at line 47 of file dsrstrvl.h.

Constructor & Destructor Documentation

DSRStringValue::DSRStringValue ( const OFString stringValue)

constructor The string value is only set if it passed the validity check (see setValue()).

Parameters
stringValuestring value to be set
DSRStringValue::DSRStringValue ( const DSRStringValue stringValue)

copy constructor

Parameters
stringValuestring value to be copied (not checked !)

Member Function Documentation

virtual OFBool DSRStringValue::checkValue ( const OFString stringValue) const
protectedvirtual

check the specified string value for validity.

This base class just checks that the string value is not empty (since all corresponding DICOM attributes are type 1). Derived classes might overwrite this method to perform more sophisticated tests.

Parameters
stringValuestring value to be checked
Returns
OFTrue if code is valid, OFFalse otherwise
virtual void DSRStringValue::clear ( )
virtual

clear all internal variables.

Please note that the string value might become invalid afterwards.

Reimplemented in DSRDateTreeNode, DSRDateTimeTreeNode, DSRPNameTreeNode, DSRTextTreeNode, DSRTimeTreeNode, and DSRUIDRefTreeNode.

const OFString& DSRStringValue::getValue ( ) const
inline

get string value

Returns
reference to string value

Definition at line 140 of file dsrstrvl.h.

References Value.

virtual OFBool DSRStringValue::isValid ( ) const
virtual

check whether the current code is valid.

See checkValue() for details.

Returns
OFTrue if code is valid, OFFalse otherwise

Reimplemented in DSRDateTreeNode, DSRDateTimeTreeNode, DSRPNameTreeNode, DSRTextTreeNode, DSRTimeTreeNode, and DSRUIDRefTreeNode.

DSRStringValue& DSRStringValue::operator= ( const DSRStringValue stringValue)

assignment operator

Parameters
stringValuestring value to be copied (not checked !)
Returns
reference to this string value after 'stringValue' has been copied
void DSRStringValue::print ( STD_NAMESPACE ostream &  stream,
const size_t  maxLength = 0 
) const

print string value.

The output of a typical string value looks like this: "Short text" or "Very long t..." (incl. the quotation marks).

Parameters
streamoutput stream to which the string value should be printed
maxLengthmaximum number of characters to be printed. If the string value is longer the output is shortened automatically and three dots "..." are added. The value of 'maxLength' includes these three trailing char's. A value of 0 turns this meachanism off (default), i.e. the full string value is printed.
OFCondition DSRStringValue::read ( DcmItem dataset,
const DcmTagKey tagKey 
)

read string value from dataset.

If error/warning output is enabled a warning message is printed if the string value does not conform with the type (= 1) and value multiplicity (= 1).

Parameters
datasetDICOM dataset from which the string value should be read
tagKeyDICOM tag specifying the attribute which should be read
Returns
status, EC_Normal if successful, an error code otherwise
OFCondition DSRStringValue::readXML ( const DSRXMLDocument doc,
DSRXMLCursor  cursor,
const OFBool  encoding = OFFalse 
)

read string value from XML document

Parameters
docdocument containing the XML file content
cursorcursor pointing to the starting node
encodinguse encoding handler if OFTrue, ignore character set otherwise
Returns
status, EC_Normal if successful, an error code otherwise
OFCondition DSRStringValue::renderHTML ( STD_NAMESPACE ostream &  docStream,
const size_t  flags 
) const

render string value in HTML/XHTML format

Parameters
docStreamoutput stream to which the main HTML/XHTML document is written
flagsflag used to customize the output (see DSRTypes::HF_xxx)
Returns
status, EC_Normal if successful, an error code otherwise
OFCondition DSRStringValue::setValue ( const OFString stringValue)

set string value.

Before setting the string value it is checked (see checkValue()). If the value is invalid the current value is not replaced and remains unchanged. Use clear() to empty the string value (which becomes invalid afterwards).

Parameters
stringValuevalue to be set
Returns
status, EC_Normal if successful, an error code otherwise
OFCondition DSRStringValue::write ( DcmItem dataset,
const DcmTagKey tagKey 
) const

write string value to dataset

Parameters
datasetDICOM dataset to which the string value should be written
tagKeyDICOM tag specifying the attribute which should be written
Returns
status, EC_Normal if successful, an error code otherwise

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


Generated on Thu Dec 20 2012 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.8.2