gdcmCodeString.h
Go to the documentation of this file.
/*=========================================================================
Program: GDCM (Grassroots DICOM). A DICOM library
Copyright (c) 2006-2011 Mathieu Malaterre
All rights reserved.
See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#ifndef GDCMCODESTRING_H
#define GDCMCODESTRING_H
#include "gdcmString.h"
namespace gdcm
{
// Note to myself: because note all wrapped language support exception
// we could not support throwing an exception during object construction.
class GDCM_EXPORT CodeString
{
friend std::ostream& operator<< (std::ostream& os, const CodeString& str);
friend bool operator==(const CodeString &ref, const CodeString& cs);
friend bool operator!=(const CodeString &ref, const CodeString& cs);
typedef String<'\\',16> InternalClass;
public:
typedef InternalClass::value_type value_type;
typedef InternalClass::pointer pointer;
typedef InternalClass::reference reference;
typedef InternalClass::const_reference const_reference;
typedef InternalClass::size_type size_type;
typedef InternalClass::difference_type difference_type;
typedef InternalClass::iterator iterator;
typedef InternalClass::const_iterator const_iterator;
typedef InternalClass::reverse_iterator reverse_iterator;
typedef InternalClass::const_reverse_iterator const_reverse_iterator;
CodeString(): Internal() {}
CodeString(const value_type* s): Internal(s) { Internal = Internal.Trim(); }
CodeString(const value_type* s, size_type n): Internal(s, n) {
Internal = Internal.Trim(); }
CodeString(const InternalClass& s, size_type pos=0, size_type n=InternalClass::npos):
Internal(s, pos, n) { Internal = Internal.Trim(); }
bool IsValid() const;
std::string GetAsString() const {
return Internal;
}
size_type Size() const { return Internal.size(); }
protected:
std::string TrimInternal() const {
return Internal.Trim();
}
private:
String<'\\',16> Internal;
};
inline std::ostream& operator<< (std::ostream& os, const CodeString& str)
{
os << str.Internal;
return os;
}
inline bool operator==(const CodeString &ref, const CodeString& cs)
{
return ref.Internal == cs.Internal;
}
inline bool operator!=(const CodeString &ref, const CodeString& cs)
{
return ref.Internal != cs.Internal;
}
} // end namespace gdcm
#endif //GDCMCODESTRING_H
gdcm::CodeString::const_reverse_iterator
InternalClass::const_reverse_iterator const_reverse_iterator
Definition gdcmCodeString.h:57
gdcm::CodeString::reverse_iterator
InternalClass::reverse_iterator reverse_iterator
Definition gdcmCodeString.h:56
gdcm::CodeString::TrimInternal
std::string TrimInternal() const
Definition gdcmCodeString.h:79
gdcm::CodeString::CodeString
CodeString()
CodeString constructors.
Definition gdcmCodeString.h:60
gdcm::CodeString::iterator
InternalClass::iterator iterator
Definition gdcmCodeString.h:54
gdcm::CodeString::CodeString
CodeString(const value_type *s)
Definition gdcmCodeString.h:61
gdcm::CodeString::difference_type
InternalClass::difference_type difference_type
Definition gdcmCodeString.h:53
gdcm::CodeString::reference
InternalClass::reference reference
Definition gdcmCodeString.h:50
gdcm::CodeString::operator!=
friend bool operator!=(const CodeString &ref, const CodeString &cs)
Definition gdcmCodeString.h:97
gdcm::CodeString::pointer
InternalClass::pointer pointer
Definition gdcmCodeString.h:49
gdcm::CodeString::IsValid
bool IsValid() const
Check if CodeString obj is correct..
gdcm::CodeString::operator==
friend bool operator==(const CodeString &ref, const CodeString &cs)
Definition gdcmCodeString.h:93
gdcm::CodeString::const_reference
InternalClass::const_reference const_reference
Definition gdcmCodeString.h:51
gdcm::CodeString::const_iterator
InternalClass::const_iterator const_iterator
Definition gdcmCodeString.h:55
gdcm::CodeString::size_type
InternalClass::size_type size_type
Definition gdcmCodeString.h:52
gdcm::CodeString::GetAsString
std::string GetAsString() const
Return the full code string as std::string.
Definition gdcmCodeString.h:71
gdcm::CodeString::Size
size_type Size() const
Return the size of the string.
Definition gdcmCodeString.h:76
gdcm::CodeString::CodeString
CodeString(const InternalClass &s, size_type pos=0, size_type n=InternalClass::npos)
Definition gdcmCodeString.h:64
gdcm::CodeString::CodeString
CodeString(const value_type *s, size_type n)
Definition gdcmCodeString.h:62
gdcm::CodeString::value_type
InternalClass::value_type value_type
Definition gdcmCodeString.h:48
gdcm::String
String.
Definition gdcmString.h:32
gdcm::String<'\\', 16 >::value_type
std::string::value_type value_type
Definition gdcmString.h:38
gdcm::String<'\\', 16 >::size_type
std::string::size_type size_type
Definition gdcmString.h:42
gdcm::String<'\\', 16 >::const_reference
std::string::const_reference const_reference
Definition gdcmString.h:41
gdcm::String<'\\', 16 >::iterator
std::string::iterator iterator
Definition gdcmString.h:44
gdcm::String<'\\', 16 >::pointer
std::string::pointer pointer
Definition gdcmString.h:39
gdcm::String<'\\', 16 >::reverse_iterator
std::string::reverse_iterator reverse_iterator
Definition gdcmString.h:46
gdcm::String<'\\', 16 >::difference_type
std::string::difference_type difference_type
Definition gdcmString.h:43
gdcm::String<'\\', 16 >::const_reverse_iterator
std::string::const_reverse_iterator const_reverse_iterator
Definition gdcmString.h:47
gdcm::String<'\\', 16 >::const_iterator
std::string::const_iterator const_iterator
Definition gdcmString.h:45
gdcm::String<'\\', 16 >::reference
std::string::reference reference
Definition gdcmString.h:40
gdcmString.h
GDCM_EXPORT
#define GDCM_EXPORT
Definition gdcmWin32.h:34
gdcm
Definition gdcmASN1.h:21
gdcm::operator==
bool operator==(const CodeString &ref, const CodeString &cs)
Definition gdcmCodeString.h:93
gdcm::operator<<
std::ostream & operator<<(std::ostream &os, const Directory &d)
Definition gdcmDirectory.h:88
gdcm::operator!=
bool operator!=(const CodeString &ref, const CodeString &cs)
Definition gdcmCodeString.h:97