#include <OSGIDString.h>
Inheritance diagram for osg::IDString:

Public Types | |
| typedef std::vector< IDString > | StringVec |
| typedef std::vector< IDString * > | StringPVec |
| enum | MemType { COPY, LINK } |
Public Member Functions | |
Constructors | |
| * | IDString (UInt32 size=0) |
| IDString (const Char8 *str, MemType memType=COPY) | |
| IDString (const IDString &obj, MemType memType=COPY) | |
Destructors | |
| *virtual | ~IDString (void) |
Access | |
| *const Char8 * | str (void) const |
| bool | isEmpty (void) const |
| void | set (const Char8 *str, MemType memType=COPY) |
| void | toUpper (void) |
| void | toLower (void) |
| UInt32 | getLength (void) const |
| void | setLength (UInt32 length) |
| void | tokenize (StringVec &v) |
| void | tokenize (StringPVec &v) |
Assignment | |
| *const IDString & | operator= (const IDString &obj) |
Comparison | |
| *bool | operator== (const IDString &obj) const |
| bool | operator!= (const IDString &obj) const |
| bool | operator< (const IDString &obj) const |
| bool | operator> (const IDString &obj) const |
| bool | operator>= (const IDString &obj) const |
| bool | operator<= (const IDString &obj) const |
Protected Attributes | |
| Char8 * | _str |
| MemType | _memType |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const IDString &obj) |
Definition at line 62 of file OSGIDString.h.
|
|
Definition at line 74 of file OSGIDString.h. |
|
|
Definition at line 75 of file OSGIDString.h. |
|
|
Definition at line 68 of file OSGIDString.h.
|
|
|
Definition at line 55 of file OSGIDString.cpp. References setLength(). Referenced by tokenize().
|
|
||||||||||||
|
Definition at line 62 of file OSGIDString.cpp. References set().
|
|
||||||||||||
|
Definition at line 69 of file OSGIDString.cpp.
|
|
|
Definition at line 79 of file OSGIDString.cpp. References _memType, _str, and COPY.
|
|
|
|
Definition at line 48 of file OSGIDString.inl. References _str. Referenced by osg::TypeFactory::registerType().
|
|
||||||||||||
|
Definition at line 88 of file OSGIDString.cpp. References _memType, _str, and COPY. Referenced by osg::ImageFileHandler::addImageFileType(), osg::SceneFileHandler::addSceneFileType(), osg::SceneFileHandler::getFileType(), osg::ImageFileHandler::getFileType(), IDString(), osg::ImageFileType::ImageFileType(), osg::IDStringLink::operator=(), operator=(), and osg::SceneFileHandler::subSceneFileType(). 00089 { 00090 if(str == _str) 00091 { 00092 // !!! can you change _memType here? I think not. IMHO 00093 return; 00094 } 00095 00096 if(_memType == COPY) 00097 delete [] _str; 00098 00099 if(memType == COPY) 00100 { 00101 if(str != NULL) 00102 { 00103 _str = new Char8[strlen(str) + 1]; 00104 00105 strcpy(_str, str); 00106 } 00107 else 00108 { 00109 _str = NULL; 00110 } 00111 } 00112 else 00113 { 00114 _str = const_cast<Char8 *>(str); 00115 } 00116 00117 _memType = memType; 00118 }
|
|
|
Definition at line 124 of file OSGIDString.cpp. References _str, and getLength(). 00125 { 00126 UInt32 l = getLength(); 00127 00128 for(UInt32 i = 0; i < l; ++i) 00129 { 00130 _str[i] = ::toupper(_str[i]); 00131 } 00132 00133 }
|
|
|
Definition at line 135 of file OSGIDString.cpp. References _str, and getLength(). Referenced by osg::ImageFileHandler::addImageFileType(), osg::SceneFileHandler::addSceneFileType(), osg::SceneFileHandler::getFileType(), osg::ImageFileHandler::getFileType(), and osg::SceneFileHandler::subSceneFileType(). 00136 { 00137 UInt32 l = getLength(); 00138 00139 for(UInt32 i = 0; i < l; ++i) 00140 { 00141 _str[i] = ::tolower(_str[i]); 00142 } 00143 00144 }
|
|
|
Definition at line 150 of file OSGIDString.cpp. References _str. Referenced by osg::FieldDescription::isValid(), tokenize(), toLower(), and toUpper().
|
|
|
Definition at line 155 of file OSGIDString.cpp. References _memType, _str, and COPY. Referenced by IDString(). 00156 { 00157 if(_memType == COPY) 00158 delete [] _str; 00159 00160 if(length != 0) 00161 { 00162 _str = new Char8[length]; 00163 *_str = 0; 00164 } 00165 else 00166 { 00167 _str = 0; 00168 } 00169 00170 _memType = COPY; 00171 }
|
|
|
Definition at line 173 of file OSGIDString.cpp. References _str, getLength(), and IDString(). 00174 { 00175 UInt32 l = getLength(); 00176 UInt32 oldpos = 0; 00177 UInt32 pos = 0; 00178 bool inQuotes = false; 00179 bool inToken = false; 00180 00181 if(l > 0) 00182 { 00183 Char8 *buf = new Char8[l + 1]; 00184 00185 for(pos = 0; pos <= l; ++pos) 00186 { 00187 if(!inQuotes) 00188 { 00189 if(!inToken) 00190 { 00191 if(_str[pos] == '"') 00192 { 00193 inQuotes = true; 00194 oldpos = pos + 1; 00195 } 00196 else if(_str[pos] != ' ') 00197 { 00198 inToken = true; 00199 oldpos = pos; 00200 } 00201 } 00202 else if(inToken) 00203 { 00204 if(_str[pos] == '"') 00205 { 00206 inToken = false; 00207 00208 strncpy(buf, _str + oldpos, pos - oldpos); 00209 00210 buf[pos - oldpos] = '\0'; 00211 00212 v.push_back(IDString(buf)); 00213 00214 inQuotes = true; 00215 oldpos = pos; 00216 } 00217 else if(_str[pos] == ' ') 00218 { 00219 inToken = false; 00220 00221 strncpy(buf, _str + oldpos, pos - oldpos); 00222 00223 buf[pos - oldpos] = '\0'; 00224 00225 v.push_back(IDString(buf)); 00226 } 00227 else if(pos == l) 00228 { 00229 strncpy(buf, _str + oldpos, pos - oldpos); 00230 00231 buf[pos - oldpos] = '\0'; 00232 00233 v.push_back(IDString(buf)); 00234 } 00235 } 00236 } 00237 else if(inQuotes) 00238 { 00239 if(_str[pos] == '"') 00240 { 00241 inQuotes = false; 00242 00243 if(pos > oldpos) 00244 { 00245 strncpy(buf, _str + oldpos, pos - oldpos); 00246 00247 buf[pos - oldpos] = '\0'; 00248 00249 v.push_back(IDString(buf)); 00250 } 00251 } 00252 else if(pos == l) 00253 { 00254 if(pos > oldpos) 00255 { 00256 strncpy(buf, _str + oldpos, pos - oldpos); 00257 00258 buf[pos - oldpos] = '\0'; 00259 00260 v.push_back(IDString(buf)); 00261 } 00262 } 00263 } 00264 } 00265 00266 delete [] buf; 00267 } 00268 }
|
|
|
Definition at line 270 of file OSGIDString.cpp. References _str, getLength(), and IDString(). 00271 { 00272 UInt32 l = getLength(); 00273 UInt32 oldpos = 0; 00274 UInt32 pos = 0; 00275 bool inQuotes = false; 00276 bool inToken = false; 00277 00278 IDString *pString = NULL; 00279 00280 if(l > 0) 00281 { 00282 Char8 *buf = new Char8[l + 1]; 00283 00284 for(pos = 0; pos <= l; ++pos) 00285 { 00286 if(!inQuotes) 00287 { 00288 if(!inToken) 00289 { 00290 if(_str[pos] == '"') 00291 { 00292 inQuotes = true; 00293 oldpos = pos + 1; 00294 } 00295 else if(_str[pos] != ' ') 00296 { 00297 inToken = true; 00298 oldpos = pos; 00299 } 00300 } 00301 else if(inToken) 00302 { 00303 if(_str[pos] == '"') 00304 { 00305 inToken = false; 00306 00307 strncpy(buf, _str + oldpos, pos - oldpos); 00308 00309 buf[pos - oldpos] = '\0'; 00310 00311 pString = new IDString(buf); 00312 00313 v.push_back(pString); 00314 00315 inQuotes = true; 00316 oldpos = pos; 00317 00318 } 00319 else if(_str[pos] == ' ') 00320 { 00321 inToken = false; 00322 00323 strncpy(buf, _str + oldpos, pos - oldpos); 00324 00325 buf[pos - oldpos] = '\0'; 00326 00327 pString = new IDString(buf); 00328 00329 v.push_back(pString); 00330 } 00331 else if(pos == l) 00332 { 00333 strncpy(buf, _str + oldpos, pos - oldpos); 00334 00335 buf[pos - oldpos] = '\0'; 00336 00337 pString = new IDString(buf); 00338 00339 v.push_back(pString); 00340 } 00341 } 00342 } 00343 else if(inQuotes) 00344 { 00345 if(_str[pos] == '"') 00346 { 00347 inQuotes = false; 00348 00349 if(pos > oldpos) 00350 { 00351 strncpy(buf, _str + oldpos, pos - oldpos); 00352 00353 buf[pos - oldpos] = '\0'; 00354 00355 pString = new IDString(buf); 00356 00357 v.push_back(pString); 00358 } 00359 } 00360 else if(pos == l) 00361 { 00362 if(pos > oldpos) 00363 { 00364 strncpy(buf, _str + oldpos, pos - oldpos); 00365 00366 buf[pos - oldpos] = '\0'; 00367 00368 pString = new IDString(buf); 00369 00370 v.push_back(pString); 00371 } 00372 } 00373 } 00374 } 00375 00376 delete [] buf; 00377 } 00378 }
|
|
|
Definition at line 54 of file OSGIDString.inl.
|
|
|
Definition at line 62 of file OSGIDString.inl. References _str. 00063 { 00064 return ((_str == obj._str) ? 00065 1 : 00066 (_str != NULL && obj._str != NULL && !::strcmp(_str, obj._str))); 00067 }
|
|
|
Definition at line 70 of file OSGIDString.inl. 00071 { 00072 return ! (*this == obj); 00073 }
|
|
|
Definition at line 76 of file OSGIDString.inl. References _str. 00077 { 00078 return ( _str != NULL && 00079 obj._str != NULL && 00080 (::strcmp(_str, obj._str) < 0)); 00081 }
|
|
|
Definition at line 84 of file OSGIDString.inl.
|
|
|
Definition at line 90 of file OSGIDString.inl. 00091 { 00092 return ! (*this < obj); 00093 }
|
|
|
Definition at line 96 of file OSGIDString.inl.
|
|
||||||||||||
|
Definition at line 383 of file OSGIDString.cpp.
|
|
|
Definition at line 145 of file OSGIDString.h. Referenced by getLength(), IDString(), isEmpty(), operator<(), operator=(), operator==(), set(), setLength(), str(), tokenize(), toLower(), toUpper(), and ~IDString(). |
|
|
Definition at line 146 of file OSGIDString.h. Referenced by set(), setLength(), and ~IDString(). |
1.4.3