GDCM  2.2.6
gdcmCodeString.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: GDCM (Grassroots DICOM). A DICOM library
4 
5  Copyright (c) 2006-2011 Mathieu Malaterre
6  All rights reserved.
7  See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notice for more information.
12 
13 =========================================================================*/
14 #ifndef GDCMCODESTRING_H
15 #define GDCMCODESTRING_H
16 
17 #include "gdcmString.h"
18 
19 namespace gdcm
20 {
21 
39 // Note to myself: because note all wrapped language support exception
40 // we could not support throwing an exception during object construction.
42 {
43  friend std::ostream& operator<< (std::ostream& os, const CodeString& str);
44  friend bool operator==(const CodeString &ref, const CodeString& cs);
45  friend bool operator!=(const CodeString &ref, const CodeString& cs);
47 public:
58 
60  CodeString(): Internal() {}
61  CodeString(const value_type* s): Internal(s) { Internal = Internal.Trim(); }
62  CodeString(const value_type* s, size_type n): Internal(s, n) {
63  Internal = Internal.Trim(); }
64  CodeString(const InternalClass& s, size_type pos=0, size_type n=InternalClass::npos):
65  Internal(s, pos, n) { Internal = Internal.Trim(); }
66 
68  bool IsValid() const;
69 
71  std::string GetAsString() const {
72  return Internal;
73  }
74 
76  size_type Size() const { return Internal.size(); }
77 
78 protected:
79  std::string TrimInternal() const {
80  return Internal.Trim();
81  }
82 
83 private:
84  String<'\\',16> Internal;
85 };
86 
87 inline std::ostream& operator<< (std::ostream& os, const CodeString& str)
88 {
89  os << str.Internal;
90  return os;
91 }
92 
93 inline bool operator==(const CodeString &ref, const CodeString& cs)
94 {
95  return ref.Internal == cs.Internal;
96 }
97 inline bool operator!=(const CodeString &ref, const CodeString& cs)
98 {
99  return ref.Internal != cs.Internal;
100 }
101 
102 
103 } // end namespace gdcm
104 
105 #endif //GDCMCODESTRING_H
InternalClass::reference reference
Definition: gdcmCodeString.h:50
CodeString()
CodeString constructors.
Definition: gdcmCodeString.h:60
CodeString(const InternalClass &s, size_type pos=0, size_type n=InternalClass::npos)
Definition: gdcmCodeString.h:64
size_type Size() const
Return the size of the string.
Definition: gdcmCodeString.h:76
CodeString(const value_type *s, size_type n)
Definition: gdcmCodeString.h:62
CodeString This is an implementation of DICOM VR: CS The cstor will properly Trim so that operator== ...
Definition: gdcmCodeString.h:41
std::string::value_type value_type
Definition: gdcmString.h:38
InternalClass::const_reverse_iterator const_reverse_iterator
Definition: gdcmCodeString.h:57
InternalClass::value_type value_type
Definition: gdcmCodeString.h:48
#define GDCM_EXPORT
Definition: gdcmWin32.h:34
bool operator!=(const CodeString &ref, const CodeString &cs)
Definition: gdcmCodeString.h:97
std::ostream & operator<<(std::ostream &os, const Directory &d)
Definition: gdcmDirectory.h:92
std::string::iterator iterator
Definition: gdcmString.h:44
std::string GetAsString() const
Return the full code string as std::string.
Definition: gdcmCodeString.h:71
bool operator==(const CodeString &ref, const CodeString &cs)
Definition: gdcmCodeString.h:93
InternalClass::const_iterator const_iterator
Definition: gdcmCodeString.h:55
std::string TrimInternal() const
Definition: gdcmCodeString.h:79
InternalClass::reverse_iterator reverse_iterator
Definition: gdcmCodeString.h:56
InternalClass::size_type size_type
Definition: gdcmCodeString.h:52
CodeString(const value_type *s)
Definition: gdcmCodeString.h:61
std::string::size_type size_type
Definition: gdcmString.h:42
std::string::reference reference
Definition: gdcmString.h:40
String.
Definition: gdcmString.h:31
InternalClass::difference_type difference_type
Definition: gdcmCodeString.h:53
std::string::reverse_iterator reverse_iterator
Definition: gdcmString.h:46
InternalClass::const_reference const_reference
Definition: gdcmCodeString.h:51
std::string::const_reference const_reference
Definition: gdcmString.h:41
std::string::difference_type difference_type
Definition: gdcmString.h:43
InternalClass::iterator iterator
Definition: gdcmCodeString.h:54
std::string::pointer pointer
Definition: gdcmString.h:39
InternalClass::pointer pointer
Definition: gdcmCodeString.h:49
std::string::const_iterator const_iterator
Definition: gdcmString.h:45
std::string::const_reverse_iterator const_reverse_iterator
Definition: gdcmString.h:47

Generated on Sat Dec 21 2013 05:56:16 for GDCM by doxygen 1.8.5
SourceForge.net Logo