OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimHexString.h
Go to the documentation of this file.
1 //*******************************************************************
2 //
3 // License: See top level LICENSE.txt file.
4 //
5 // Author: Garrett Potts (gpotts@imagelinks.com)
6 //
7 //********************************************************************
8 // $Id: ossimHexString.h 23584 2015-10-18 13:03:33Z dburken $
9 
10 #ifndef ossimHexString_H
11 #define ossimHexString_H 1
12 
13 #include <ossim/base/ossimString.h>
15 #include <cstring>
16 
18 {
19 public:
21  {}
22  template <class Iter>
23  ossimHexString(Iter start, Iter end):ossimString(start, end){}
24  ossimHexString(const std::string& aString):ossimString(aString)
25  {}
26  ossimHexString(const char *aString):ossimString(aString?aString:"")
27  {}
28  ossimHexString(const ossimString& aString):ossimString(aString.c_str())
29  {}
30 
32  {
33  assign(value);
34  }
36  {
37  assign(value);
38  }
40  {
41  assign(value);
42  }
44  {
45  assign(value);
46  }
48  {
49  assign(value);
50  }
52  {
53  assign(value);
54  }
55 
56  bool operator==(const ossimHexString& s) const {return (std::strcmp(this->c_str(),s.c_str())==0);}
57  bool operator==(const char* s) const {return (std::strcmp(this->c_str(),s)==0);}
58  bool operator!=(const ossimHexString& s) const {return (std::strcmp(this->c_str(),s.c_str())!=0);}
59  bool operator!=(const char* s) const {return (std::strcmp(this->c_str(),s)!=0);}
60  operator const char*()const{return c_str();}
61  const char* chars()const{return c_str();}
62  char& operator[](int i)
63  {
64  return *( const_cast<char*>(c_str())+i);
65  }
66  const char& operator[](int i)const
67  {
68  return *(c_str()+i);
69  }
71  {
72  assign(value);
73  return *this;
74  }
76  {
77  assign(value);
78  return *this;
79  }
81  {
82  assign(value);
83  return *this;
84  }
86  {
87  assign(value);
88  return *this;
89  }
91  {
92  assign(value);
93  return *this;
94  }
96  {
97  assign(value);
98  return *this;
99  }
100  const ossimHexString& operator =(const ossim_int8* value)
101  {
102  ossimString::operator=(value);
103  return *this;
104  }
105  const ossimHexString& operator =(const ossimString& value)
106  {
107  ossimString::operator=(value);
108  return *this;
109  }
110 
112  {
113  ossimString::operator=(value);
114  return *this;
115  }
116 
117  const ossimHexString& operator =(const std::string& value)
118  {
119  ossimString::operator=(value);
120  return *this;
121  }
122 
123  ossim_int32 toInt32()const;
124  ossim_int16 toInt16()const;
125  ossim_int8 toChar()const;
126  ossim_uint8 toUchar()const;
127  ossim_uint32 toUint32()const;
128  ossim_uint16 toUint16()const;
129 
130  void assign(ossim_int16 value)
131  {
132  assign((ossim_uint16)value);
133  }
134  void assign(ossim_int32 value)
135  {
136  assign((ossim_uint32)value);
137  }
138  void assign(ossim_int8 value)
139  {
140  assign((ossim_uint8)value);
141  }
142  void assign(ossim_uint16 value);
143  void assign(ossim_uint32 value);
144  void assign(ossim_uint8 value);
145 };
146 
147 #endif /* #ifndef ossimHexString_H */
void assign(ossim_int16 value)
char ossim_int8
Previous DLL import export section.
#define OSSIMDLLEXPORT
bool operator!=(const ossimHexString &s) const
const char * chars() const
ossimHexString(ossim_uint8 value)
ossimHexString(ossim_uint32 value)
void assign(ossim_int8 value)
unsigned short ossim_uint16
ossimHexString(const std::string &aString)
ossim_int32 toInt32() const
const ossimString & operator=(const std::string &s)
Definition: ossimString.h:99
ossimHexString(ossim_int16 value)
ossimHexString(const ossimString &aString)
bool operator!=(const char *s) const
unsigned int ossim_uint32
bool operator==(const char *s) const
bool operator==(const ossimHexString &s) const
const char & operator[](int i) const
char & operator[](int i)
ossimHexString(ossim_uint16 value)
ossimHexString(ossim_int32 value)
short ossim_int16
ossimHexString(const char *aString)
ossimHexString(Iter start, Iter end)
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string&#39;s contents...
Definition: ossimString.h:396
std::string & assign(std::string::size_type n, char c)
Erases the existing characters and replaces them by n copies of c.
Definition: ossimString.h:865
ossimHexString(char value)
unsigned char ossim_uint8
ossim_int16 toInt16() const
int ossim_int32
void assign(ossim_int32 value)