1 #ifndef COIN_SBSTRING_H 2 #define COIN_SBSTRING_H 39 #include <Inventor/system/inttypes.h> 43 #define COIN_ALLOW_SBINTLIST 44 #include <Inventor/lists/SbIntList.h> 45 #undef COIN_ALLOW_SBINTLIST 47 #include <Inventor/lists/SbIntList.h> 48 #endif // COIN_INTERNAL 54 SbString(
void) { cc_string_construct(&this->str); }
57 { cc_string_construct(&this->str); cc_string_set_text(&this->str, s); }
60 { cc_string_construct(&this->str); cc_string_set_wtext(&this->str, s); }
63 { cc_string_construct(&this->str); cc_string_set_subtext(&this->str, s, start, end); }
66 { cc_string_construct(&this->str); cc_string_set_string(&this->str, &s.str); }
69 { cc_string_construct(&this->str); cc_string_set_integer(&this->str, digits); }
73 uint32_t
hash(
void)
const {
return cc_string_hash(&this->str); }
74 static uint32_t
hash(
const char * s) {
return cc_string_hash_text(s); }
76 int getLength(
void)
const {
return cc_string_length(&this->str); }
80 if ( freeold ) cc_string_clear(&this->str);
81 else cc_string_clear_no_free(&this->str);
84 const char *
getString(
void)
const {
return cc_string_get_text(&this->str); }
89 cc_string_set_subtext(&s.str, cc_string_get_text(&this->str), startidx, endidx);
94 cc_string_remove_substring(&this->str, startidx, endidx);
97 void addIntString(
const int value) { cc_string_append_integer(&this->str, value); }
99 char operator[](
int index)
const {
return this->str.pointer[index]; }
102 { cc_string_set_text(&this->str, s);
return *
this; }
104 { cc_string_set_text(&this->str, s.str.pointer);
return *
this; }
107 { cc_string_append_text(&this->str, s);
return *
this; }
109 { cc_string_append_string(&this->str, &s.str);
return *
this; }
111 { cc_string_append_char(&this->str, c);
return *
this; }
113 int operator!(
void)
const {
return ! cc_string_is(&this->str); }
116 {
return cc_string_compare_subtext(&this->str, text, offset); }
120 va_list args; va_start(args, formatstr);
121 cc_string_vsprintf(&this->str, formatstr, args);
122 va_end(args);
return *
this;
125 { cc_string_vsprintf(&this->str, formatstr, args);
return *
this; }
127 void apply(
char (*func)(
char input)) {
128 cc_string_apply(&this->str, reinterpret_cast<cc_apply_f>(func));
137 void print(std::FILE * fp)
const;
139 friend int operator==(
const SbString & sbstr,
const char * s);
140 friend int operator==(
const char * s,
const SbString & sbstr);
142 friend int operator!=(
const SbString & sbstr,
const char * s);
143 friend int operator!=(
const char * s,
const SbString & sbstr);
145 friend int operator<(
const SbString & sbstr,
const char * s);
146 friend int operator<(
const char * s,
const SbString & sbstr);
148 friend int operator>(
const SbString & sbstr,
const char * s);
149 friend int operator>(
const char * s,
const SbString & sbstr);
160 {
return (cc_string_compare_text(sbstr.str.pointer, s) == 0); }
162 {
return (cc_string_compare_text(s, sbstr.str.pointer) == 0); }
164 {
return (cc_string_compare_text(str1.str.pointer, str2.str.pointer) == 0); }
167 {
return (cc_string_compare_text(sbstr.str.pointer, s) != 0); }
169 {
return (cc_string_compare_text(s, sbstr.str.pointer) != 0); }
171 {
return (cc_string_compare_text(str1.str.pointer, str2.str.pointer) != 0); }
173 inline int operator<(
const SbString & sbstr,
const char * s)
174 {
return (cc_string_compare_text(sbstr.str.pointer, s) < 0); }
175 inline int operator<(
const char * s,
const SbString & sbstr)
176 {
return (cc_string_compare_text(s, sbstr.str.pointer) < 0); }
178 {
return (cc_string_compare_text(str1.str.pointer, str2.str.pointer) < 0); }
180 inline int operator>(
const SbString & sbstr,
const char * s)
181 {
return (cc_string_compare_text(sbstr.str.pointer, s) > 0); }
182 inline int operator>(
const char * s,
const SbString & sbstr)
183 {
return (cc_string_compare_text(s, sbstr.str.pointer) > 0); }
185 {
return (cc_string_compare_text(str1.str.pointer, str2.str.pointer) > 0); }
206 #ifndef COIN_INTERNAL 208 #include <Inventor/SbName.h> 209 #endif // !COIN_INTERNAL 211 #endif // !COIN_SBSTRING_H SbString(const SbString &s)
Definition: SbString.h:65
void makeEmpty(SbBool freeold=TRUE)
Definition: SbString.h:78
uint32_t hash(void) const
Definition: SbString.h:73
SbString & sprintf(const char *formatstr,...)
Definition: SbString.h:118
SbString(const char *s)
Definition: SbString.h:56
SbString & operator+=(const char *s)
Definition: SbString.h:106
SbString(const int digits)
Definition: SbString.h:68
const char * getString(void) const
Definition: SbString.h:84
int operator==(const SbBox2s &b1, const SbBox2s &b2)
Definition: SbBox2s.h:102
int getLength(void) const
Definition: SbString.h:76
int operator!(void) const
Definition: SbString.h:113
SbString & operator+=(const SbString &s)
Definition: SbString.h:108
SbString(void)
Definition: SbString.h:54
SbString & operator=(const char *s)
Definition: SbString.h:101
~SbString()
Definition: SbString.h:71
SbString & vsprintf(const char *formatstr, va_list args)
Definition: SbString.h:124
void deleteSubString(int startidx, int endidx=-1)
Definition: SbString.h:92
int operator!=(const SbBox2s &b1, const SbBox2s &b2)
Definition: SbBox2s.h:106
SbString & operator+=(const char c)
Definition: SbString.h:110
SbString(const char *s, int start, int end)
Definition: SbString.h:62
The cc_string type is a C ADT for ASCII string management.
Definition: string.h:51
void addIntString(const int value)
Definition: SbString.h:97
SbString(const wchar_t *s)
Definition: SbString.h:59
static uint32_t hash(const char *s)
Definition: SbString.h:74
SbString getSubString(int startidx, int endidx=-1) const
Definition: SbString.h:86
int compareSubString(const char *text, int offset=0) const
Definition: SbString.h:115
The SbString class is a string class with convenience functions for string operations.
Definition: SbString.h:52
The SbIntList class is a container for integer list arrays.
Definition: SbIntList.h:40
SbString & operator=(const SbString &s)
Definition: SbString.h:103
SbVec2s operator+(const SbVec2s &v1, const SbVec2s &v2)
char operator[](int index) const
Definition: SbString.h:99