32 #include "dcmtk/config/osconfig.h"
34 #include "dcmtk/ofstd/oftypes.h"
35 #include "dcmtk/ofstd/ofcast.h"
39 #define OFSTRING_GUARD(c_string) ((c_string != NULL) ? (c_string) : "")
42 #ifdef HAVE_STD_STRING
49 #define OFString std::string
50 #define OFString_npos std::string::npos
58 #define INCLUDE_CASSERT
59 #define INCLUDE_CSTRING
60 #define INCLUDE_CSTDLIB
62 #define INCLUDE_UNISTD
63 #include "dcmtk/ofstd/ofstdinc.h"
65 #include "dcmtk/ofstd/ofstream.h"
66 #include "dcmtk/ofstd/oftypes.h"
71 #define OFSTRING_OUTOFRANGE(cond) assert (!(cond))
72 #define OFSTRING_LENGTHERROR(cond) assert (!(cond))
73 #define OFSTRING_MEMORYALLOCERROR(cond) assert (!(cond))
80 static const size_t OFString_npos = (OFstatic_cast(
size_t, -1));
254 size_t pos2 = 0,
size_t n = OFString_npos);
305 size_t pos2 = 0,
size_t n2 = OFString_npos);
342 const char&
at(
size_t pos)
const
344 OFSTRING_OUTOFRANGE (pos >= this->
size());
356 OFSTRING_OUTOFRANGE (pos >= this->
size());
367 if (pos == this->
size())
return '\0';
370 OFSTRING_OUTOFRANGE (pos > this->
size());
383 OFSTRING_OUTOFRANGE (pos >= this->
size());
404 const char*
data()
const;
429 return (this->
size() == 0)?(OFTrue):(OFFalse);
437 void resize(
size_t n,
char c =
'\0');
452 return ((OFString_npos - 1)/
sizeof(
char));
482 size_t copy(
char* s,
size_t n,
size_t pos = 0)
const;
527 int compare(
size_t pos1,
size_t n1,
const OFString& str,
size_t pos2,
size_t n2)
const;
534 int compare(
const char* s)
const;
544 int compare(
size_t pos1,
size_t n1,
const char* s,
size_t n2 = OFString_npos)
const;
555 size_t find(
const OFString& pattern,
size_t pos = 0)
const;
567 size_t find(
const char* pattern,
size_t pos,
size_t n)
const;
578 size_t find(
const char* pattern,
size_t pos = 0)
const;
589 size_t find(
char pattern,
size_t pos = 0)
const;
600 size_t rfind(
const OFString& pattern,
size_t pos = OFString_npos)
const;
612 size_t rfind(
const char* pattern,
size_t pos,
size_t n)
const;
623 size_t rfind(
const char* pattern,
size_t pos = OFString_npos)
const;
634 size_t rfind(
char pattern,
size_t pos = OFString_npos)
const;
657 size_t find_first_of(
const char* s,
size_t pos,
size_t n)
const;
700 size_t find_last_of(
const char* s,
size_t pos,
size_t n)
const;
710 size_t find_last_of(
const char* s,
size_t pos = OFString_npos)
const;
720 size_t find_last_of(
char s,
size_t pos = OFString_npos)
const;
851 STD_NAMESPACE ostream& operator<< (STD_NAMESPACE ostream& o,
const OFString& s);
859 STD_NAMESPACE istream& operator>> (STD_NAMESPACE istream& i,
OFString& s);
908 OFBool operator== (
const char* lhs,
const OFString& rhs);
915 OFBool operator== (
char lhs,
const OFString& rhs);
922 OFBool operator== (
const OFString& lhs,
const char* rhs);
929 OFBool operator== (
const OFString& lhs,
char rhs);
943 OFBool operator< (
const char* lhs,
const OFString& rhs);
950 OFBool operator< (
char lhs,
const OFString& rhs);
957 OFBool operator< (
const OFString& lhs,
const char* rhs);
964 OFBool operator< (
const OFString& lhs,
char rhs);
978 OFBool operator<= (
const char* lhs,
const OFString& rhs);
985 OFBool operator<= (
char lhs,
const OFString& rhs);
992 OFBool operator<= (
const OFString& lhs,
const char* rhs);
999 OFBool operator<= (
const OFString& lhs,
char rhs);
1013 OFBool operator!= (
const char* lhs,
const OFString& rhs);
1020 OFBool operator!= (
char lhs,
const OFString& rhs);
1027 OFBool operator!= (
const OFString& lhs,
const char* rhs);
1034 OFBool operator!= (
const OFString& lhs,
char rhs);
1048 OFBool operator> (
const char* lhs,
const OFString& rhs);
1055 OFBool operator> (
char lhs,
const OFString& rhs);
1062 OFBool operator> (
const OFString& lhs,
const char* rhs);
1069 OFBool operator> (
const OFString& lhs,
char rhs);
1083 OFBool operator>= (
const char* lhs,
const OFString& rhs);
1090 OFBool operator>= (
char lhs,
const OFString& rhs);
1097 OFBool operator>= (
const OFString& lhs,
const char* rhs);
1104 OFBool operator>= (
const OFString& lhs,
char rhs);