# gdcm::CodeString Class Reference

CodeString This is an implementation of DICOM VR: CS The cstor will properly Trim so that operator== is correct. More...

`#include <gdcmCodeString.h>`

List of all members.

## Public Types

typedef InternalClass::const_iterator | const_iterator
typedef InternalClass::const_reference | const_reference
typedef InternalClass::const_reverse_iterator | const_reverse_iterator
typedef InternalClass::difference_type | difference_type
typedef InternalClass::iterator | iterator
typedef InternalClass::pointer | pointer
typedef InternalClass::reference | reference
typedef InternalClass::reverse_iterator | reverse_iterator
typedef InternalClass::size_type | size_type
typedef InternalClass::value_type | value_type

## Public Member Functions

| CodeString ()
| CodeString constructors.
| CodeString (const value_type *s)
| CodeString (const InternalClass &s, size_type pos=0, size_type n=InternalClass::npos)
| CodeString (const value_type *s, size_type n)
std::string | GetAsString () const
| Return the full code string as std::string.
bool | IsValid () const
| Check if CodeString obj is correct..
size_type | size () const
size_type | Size () const
| Return the size of the string.
std::string | Trim () const

## Protected Member Functions

std::string | TrimInternal () const

## Friends

bool | operator!= (const CodeString &ref, const CodeString &cs)
std::ostream & | operator<< (std::ostream &os, const CodeString &str)
bool | operator== (const CodeString &ref, const CodeString &cs)

## Detailed Description

CodeString This is an implementation of DICOM VR: CS The cstor will properly Trim so that operator== is correct.

Note:
  the cstor of CodeString will Trim the string on the fly so as to remove the extra leading and ending spaces. However it will not perform validation on the fly (CodeString obj can contains invalid char such as lower cases). This design was chosen to be a little tolerant to broken DICOM implementation, and thus allow user to compare lower case CS from there input file without the need to first rewrite them to get rid of invalid character (validation is a different operation from searching, querying).

Warning:
  when writing out DICOM file it is highly recommended to perform the IsValid() call, at least to check that the length of the string match the definition in the standard.

## Member Typedef Documentation

typedef InternalClass::const_iterator gdcm::CodeString::const_iterator

typedef InternalClass::const_reference gdcm::CodeString::const_reference

typedef InternalClass::const_reverse_iterator gdcm::CodeString::const_reverse_iterator

typedef InternalClass::difference_type gdcm::CodeString::difference_type

typedef InternalClass::iterator gdcm::CodeString::iterator

typedef InternalClass::pointer gdcm::CodeString::pointer

typedef InternalClass::reference gdcm::CodeString::reference

typedef InternalClass::reverse_iterator gdcm::CodeString::reverse_iterator

typedef InternalClass::size_type gdcm::CodeString::size_type

typedef InternalClass::value_type gdcm::CodeString::value_type

## Constructor & Destructor Documentation

gdcm::CodeString::CodeString | ( |  | ) | `[inline]`

CodeString constructors.

gdcm::CodeString::CodeString | ( | const value_type * | s | ) | `[inline]`

gdcm::CodeString::CodeString | ( | const value_type * | s,
|  | size_type | n
| ) |  | `[inline]`

gdcm::CodeString::CodeString | ( | const InternalClass & | s,
|  | size_type | pos = `0`,
|  | size_type | n = `InternalClass::npos`
| ) |  | `[inline]`

## Member Function Documentation

std::string gdcm::CodeString::GetAsString | ( |  | ) | const`[inline]`

Return the full code string as std::string.

bool gdcm::CodeString::IsValid | ( |  | ) | const

Check if CodeString obj is correct..

size_type gdcm::CodeString::size | ( |  | ) | const

Deprecated:
  Return the size of the string

size_type gdcm::CodeString::Size | ( |  | ) | const`[inline]`

Return the size of the string.

std::string gdcm::CodeString::Trim | ( |  | ) | const

Deprecated:
  Remove extra leading and ending spaces.

std::string gdcm::CodeString::TrimInternal | ( |  | ) | const`[inline, protected]`

## Friends And Related Function Documentation

bool operator!= | ( | const CodeString & | ref,
|  | const CodeString & | cs
| ) |  | `[friend]`

std::ostream& operator<< | ( | std::ostream & | os,
|  | const CodeString & | str
| ) |  | `[friend]`

bool operator== | ( | const CodeString & | ref,
|  | const CodeString & | cs
| ) |  | `[friend]`

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

- gdcmCodeString.h