13 #ifndef ossimString_HEADER 14 #define ossimString_HEADER 1 41 ossimString(
const char *aString):m_str( aString?aString:
"" ){}
53 ossimString(Iter startIter, Iter endIter):m_str(startIter, endIter){}
59 {
return m_str.find(aChar)!=std::string::npos; }
62 {
return m_str.find(aString.
m_str)!=std::string::npos; }
65 {
return m_str.find(aString)!=std::string::npos; }
68 operator const std::string&()
const {
return m_str; }
71 operator std::string&() {
return m_str; }
74 operator const char*()
const {
return m_str.c_str(); }
77 const char*
chars()
const {
return m_str.c_str(); }
97 explicit operator bool()
const {
return m_str.empty() ? false :
true; }
173 const char& at(std::string::size_type
n)
const;
186 char& at(std::string::size_type
n);
189 const ossimString& append(std::string::size_type
n,
char c);
201 returnS.
m_str.append(s);
208 if ( s ) returnS.
m_str.append(s);
215 returnS.
m_str.append(1, c);
234 return (m_str == rhs.
m_str);
248 result = (m_str.compare(std::string(rhs)) == 0);
260 return !(m_str.compare(rhs.
m_str) == 0);
274 result = !(m_str.compare(std::string(rhs)) == 0);
281 return m_str < rhs.
m_str;
285 return m_str <= rhs.
m_str;
289 return m_str > rhs.
m_str;
293 return m_str >= rhs.
m_str;
311 std::string& insert(std::string::size_type pos,
const char* s);
317 std::string substr(std::string::size_type pos = 0,
318 std::string::size_type
n = std::string::npos)
const;
332 ossimString beforePos(std::string::size_type pos)
const;
333 ossimString afterPos(std::string::size_type pos)
const;
341 bool replaceAll=
false)
const;
350 bool replaceAll=
false);
352 std::vector<ossimString> explode(
const ossimString& delimeter)
const;
396 const char*
c_str()
const {
return m_str.c_str(); }
402 const char*
data()
const {
return m_str.data(); }
405 std::string::size_type
size()
const {
return m_str.size(); }
408 std::string::size_type
length()
const {
return m_str.size(); }
411 bool empty()
const {
return m_str.empty(); }
414 const std::string&
string()
const {
return m_str; }
420 std::string::iterator
begin() {
return m_str.begin(); }
423 std::string::iterator
end() {
return m_str.end(); }
426 std::string::const_iterator
begin()
const {
return m_str.begin(); }
429 std::string::const_iterator
end()
const {
return m_str.end(); }
435 std::string::iterator erase(std::string::iterator p);
438 std::string::iterator erase(std::string::iterator first,
439 std::string::iterator last);
442 std::string& erase(std::string::size_type pos = 0,
443 std::string::size_type
n = std::string::npos);
449 std::string::size_type find(
const std::string& s,
450 std::string::size_type pos = 0)
const;
456 std::string::size_type find(
const char* s,
457 std::string::size_type pos,
458 std::string::size_type
n)
const;
464 std::string::size_type find(
const char* s,
465 std::string::size_type pos = 0)
const;
471 std::string::size_type find(
char c, std::string::size_type pos = 0)
const;
477 std::string::size_type rfind(
const std::string& s,
478 std::string::size_type pos = 0)
const;
484 std::string::size_type rfind(
const char* s,
485 std::string::size_type pos,
486 std::string::size_type
n)
const;
492 std::string::size_type rfind(
const char* s,
493 std::string::size_type pos = 0)
const;
499 std::string::size_type rfind(
char c, std::string::size_type pos = 0)
const;
502 std::string::size_type find_first_of(
503 char c, std::string::size_type pos = 0)
const;
510 std::string::size_type find_first_not_of(
511 char c, std::string::size_type pos = 0)
const;
516 std::string::size_type find_first_of(
517 const char* s, std::string::size_type pos = 0)
const;
522 std::string::size_type find_first_not_of(
523 const char* s, std::string::size_type pos = 0)
const;
526 std::string::size_type find_last_of(
527 char c, std::string::size_type pos = std::string::npos)
const;
533 std::string& assign(std::string::size_type
n,
char c);
536 std::string& replace(std::string::size_type pos,
537 std::string::size_type
n,
538 const std::string& s);
541 std::string& replace(std::string::iterator first,
542 std::string::iterator last,
543 const std::string& s);
546 std::string& replace(std::string::size_type pos,
547 std::string::size_type
n,
548 const std::string& s,
549 std::string::size_type pos1,
550 std::string::size_type n1);
553 void reserve(std::string::size_type
n);
571 char* stringDup()
const;
627 unsigned long toULong()
const;
628 static unsigned long toULong(
const ossimString& aString);
634 double toDouble()
const;
635 static double toDouble(
const ossimString& aString);
671 char characterToStrip);
679 void split(std::vector<ossimString>& result,
681 bool skipBlankFields=
false)
const;
683 std::vector<ossimString> split(
const ossimString& separatorList,
684 bool skipBlankFields=
false)
const;
686 const ossimString& join(
const std::vector<ossimString>& stringList,
697 ossimString beforeRegExp(
const char *regularExpressionPattern)
const;
703 ossimString fromRegExp(
const char *regularExpressionPattern)
const;
709 ossimString afterRegExp(
const char *regularExpressionPattern)
const;
715 ossimString match(
const char *regularExpressionPattern)
const;
717 ossimString replaceAllThatMatch(
const char *regularExpressionPattern,
718 const char *value=
"")
const;
720 ossimString replaceStrThatMatch(
const char *regularExpressionPattern,
721 const char *value=
"")
const;
738 return m_str.erase(p);
742 std::string::iterator last)
744 return m_str.erase(first, last);
748 std::string::size_type
n)
750 return m_str.erase(pos,
n);
754 const std::string& s, std::string::size_type pos)
const 756 return m_str.find(s, pos);
760 const char* s, std::string::size_type pos, std::string::size_type
n)
const 762 return m_str.find(s, pos,
n);
766 const char* s, std::string::size_type pos)
const 768 return m_str.find(s, pos);
772 char c, std::string::size_type pos)
const 774 return m_str.find(c, pos);
778 const std::string& s, std::string::size_type pos)
const 780 return m_str.rfind(s, pos);
784 const char* s, std::string::size_type pos, std::string::size_type
n)
const 786 return m_str.rfind(s, pos,
n);
790 const char* s, std::string::size_type pos)
const 792 return m_str.rfind(s, pos);
796 char c, std::string::size_type pos)
const 798 return m_str.rfind(c, pos);
802 char c, std::string::size_type pos)
const 804 return m_str.find_first_of(c, pos);
808 const char* s, std::string::size_type pos)
const 810 return m_str.find_first_of(s, pos);
814 const char c, std::string::size_type pos)
const 816 return m_str.find_first_not_of(c, pos);
820 const char* s, std::string::size_type pos)
const 822 return m_str.find_first_not_of(s, pos);
826 char c, std::string::size_type pos)
const 828 return m_str.find_last_of(c, pos);
845 if ( s )
m_str.append(s);
867 return m_str.assign(
n, c);
871 std::string::size_type pos, std::string::size_type
n,
const std::string& s)
873 return m_str.replace(pos,
n, s);
877 std::string::iterator last,
878 const std::string& s)
880 return m_str.replace(first, last, s);
884 std::string::size_type
n,
885 const std::string& s,
886 std::string::size_type pos1,
887 std::string::size_type n1)
889 return m_str.replace(pos,
n, s, pos1, n1);
901 if (s)
m_str.insert(pos, s);
911 std::string::size_type
n)
const 913 return m_str.substr(pos,
n);
957 return (rhs.operator ==(lhs));
962 return (rhs.operator ==(lhs));
void clear()
Erases the entire container.
const ossimString & operator+=(const ossimString &s)
ossimString operator+(const ossimString &s) const
std::string::iterator iterator
const ossimString & operator=(const ossimString &s)
char & operator[](std::string::size_type i)
bool contains(const ossimString &aString) const
std::string & insert(std::string::size_type pos, const char *s)
If pos > size(), throws out_of_range.
bool operator!=(const ossimString &rhs) const
Test if this ossimString is not equal to another ossimString.
bool contains(char aChar) const
bool operator>(const ossimString &rhs) const
ossimString(std::string::size_type n, char c)
constructor - constructs with n copies of c
std::string::const_iterator const_iterator
const char * data() const
Returns a pointer to an array of characters (not necessarily null-terminated) representing the string...
ossimString(const std::string &s)
constructor that takes a std::string
std::istream & getline(std::istream &is, ossimString &str, char delim)
bool operator==(const ossimString &rhs) const
Test if this ossimString is equal to another ossimString.
void reserve(std::string::size_type n)
Requests that the string's capacity be changed.
bool operator==(const char *rhs) const
Test if this ossimString is equal to a C sting.
unsigned short ossim_uint16
const char & at(std::string::size_type n) const
Provides access to the data contained in the string.
std::string::size_type rfind(const std::string &s, std::string::size_type pos=0) const
Searches backward for s as a substring of *this, beginning at character position min(pos, size()).
std::string::size_type size_type
std::string::iterator end()
bool contains(const char *aString) const
std::string::size_type find_first_of(char c, std::string::size_type pos=0) const
Equivalent to find(c, pos).
void push_back(char c)
Equivalent to insert(end(), c).
const ossimString & operator=(const char *s)
const ossimString & append(const ossimString &s)
const ossimString & operator=(const std::string &s)
std::istream & operator>>(std::istream &is, ossimString &s)
ossimString()
default constructor
ossimString(const ossimString &aString)
copy constructor
ossimString(char aChar)
constructor - constructs with 1 c.
std::string::size_type length() const
ossimString operator+(const char *s1, const ossimString &s2)
std::string::size_type find_first_not_of(char c, std::string::size_type pos=0) const
Returns the smallest character position N such that pos <= N < size(), and such that (*this)[N] does ...
std::string::size_type size() const
os2<< "> n<< " > nendobj n
std::string::iterator begin()
const char & operator[](std::string::size_type i) const
unsigned long long ossim_uint64
unsigned int ossim_uint32
std::string::iterator erase(std::string::iterator p)
Erases the character at position p.
const char * chars() const
For backward compatibility.
For use with std::map as a compare operator: std::map<ossimString, ossimString, ossimStringLtstr> ...
bool operator<(const ossimString &rhs) const
ossimString(Iter startIter, Iter endIter)
bool operator()(const ossimString &s1, const ossimString &s2) const
std::ostream & operator<<(std::ostream &os, const ossimString &s)
std::basic_istream< char > istream
Base class for char input streams.
const ossimString & operator+=(const std::string &s)
const ossimString & operator+=(const char *s)
ossimString(const char *aString)
constructor that takes char* NOTE: std::string construtor throws exception given null pointer; hence...
std::string::size_type find_last_of(char c, std::string::size_type pos=std::string::npos) const
Equivalent to rfind(c, pos).
ossimString operator+(const char *s) const
bool operator<=(const ossimString &rhs) const
std::string & replace(std::string::size_type pos, std::string::size_type n, const std::string &s)
Replaces a substring of *this with the string s.
xref push_back((std::streamoff) str->tellp())
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string's contents...
ossimString operator+(char c) const
std::string::const_iterator begin() const
std::string substr(std::string::size_type pos=0, std::string::size_type n=std::string::npos) const
Equivalent to basic_string(*this, pos, n).
std::string::const_iterator end() const
bool operator>=(const ossimString &rhs) const
const ossimString & operator+=(char c)
ossimString operator+(const std::string &s) const
std::string & assign(std::string::size_type n, char c)
Erases the existing characters and replaces them by n copies of c.
bool operator==(const char *lhs, const ossimString &rhs)
const ossimString & operator=(char c)
unsigned char ossim_uint8
std::string::size_type find(const std::string &s, std::string::size_type pos=0) const
Searches for s as a substring of *this, beginning at character pos of *this.
bool operator!=(const char *rhs) const
Test if this ossimString is not equal to a C sting.
std::basic_ostream< char > ostream
Base class for char output streams.
const std::string & string() const