|
ATLAS Offline Software
|
Go to the documentation of this file.
7 #include <Inventor/C/errors/debugerror.h>
8 #include <Inventor/SbPList.h>
11 #include <Inventor/SbString.h>
16 #define SbMinimum(a,b) ((a)<(b)?(a):(b))
18 static SbString* SbStringCreateV(
int,
const char*,va_list);
30 char*
p = (
char*)::
malloc((
unsigned)::strlen(aString)+1);
33 return ::strcpy(
p,aString);
47 const SbString& aString
55 if(aString.getLength()<=0)
return list;
57 SbString
string = aString;
59 char* token = (
char*)
string.getString();
62 char*
pos = ::strstr (token,aLimiter);
68 token =
pos + ::strlen(aLimiter);
78 int wordn =
list.getLength();
128 int linen = aList.getLength();
134 const SbString& aString
140 if( (aString==
"true") || (aString==
"TRUE") ||
141 (aString==
"yes") || (aString==
"YES") ) {
144 }
else if( (aString==
"false") || (aString==
"FALSE") ||
145 (aString==
"no") || (aString==
"NO") ) {
155 const SbString& aString
161 const char*
string = aString.getString();
163 long value = ::strtol(
string,&
s,10);
173 const SbString& aString
179 const char*
string = aString.getString();
181 double value = ::strtod(
string,&
s);
191 const SbString& aString
192 ,
unsigned long& aValue
198 if(::sscanf(aString.getString(),
"%lx",&aValue)!=1) {
199 if(::sscanf(aString.getString(),
"%lu",&aValue)!=1) {
217 va_start(
args,aFormat);
218 SbString* sbString = SbStringCreateV(aNumber,aFormat,
args);
238 va_start(
args,aFormat);
239 SbString* sbString = SbStringCreateV(aNumber,aFormat,
args);
241 if(sbString==NULL)
return "";
242 SbString
s(*sbString);
248 const SbString& aString
249 ,
const SbString& aSearch
254 int lsearch = aSearch.getLength();
256 int number = aString.getLength();
264 const SbString& aString
265 ,
const SbString& aSearch
270 int lsearch = aSearch.getLength();
272 int number = aString.getLength();
280 const SbString& aString
287 return aString.getSubString(
index+1);
298 if(aLength<=0) aLength = 0;
299 char*
string = (
char*)::
malloc((aLength+1)*
sizeof(
char));
300 if(
string==NULL)
return NULL;
301 string[aLength] =
'\0';
303 SbString* sbString =
new SbString(
string);
325 SbString* SbStringCreateV (
333 if(aNumber<0)
return NULL;
335 if(sbString==NULL)
return NULL;
336 const char*
string = sbString->getString();
337 ::vsprintf((
char*)
string,aFormat,aArgs);
338 if(
string[aNumber]!=
'\0') {
339 ::printf(
"SbStringCreateV : buffer overflow \n");
347 const SbString& aString
352 if(aString.getLength()<4)
return FALSE;
353 if(aString.getSubString(0,3)!=
"TTF/")
return FALSE;
365 std::string a_String(aString.getString());
366 std::string::size_type dollar;
367 while((dollar=a_String.find(
'$'))!=std::string::npos){
368 std::string::size_type slash = a_String.find(
'/',dollar+1);
369 std::string::size_type back_slash = a_String.find(
'\\',dollar+1);
370 std::string::size_type
pos = std::string::npos;
371 if(slash!=std::string::npos) {
372 if(back_slash!=std::string::npos) {
378 if(back_slash!=std::string::npos) {
381 pos = std::string::npos;
385 if(
pos==std::string::npos) {
386 env = a_String.substr(dollar+1,a_String.length()-(dollar+1));
390 env = a_String.substr(dollar+1,
pos-(dollar+1));
394 std::string
value = a_String.substr(0,dollar);
396 if(
pos!=std::string::npos)
397 value += a_String.substr(
pos,a_String.length()-
pos);
401 aString = SbString(a_String.c_str());
405 aString = SbString(a_String.c_str());
410 const SbString& aString
420 const SbString& aString
429 aValue = SbString(
env);
439 ,
const SbString& aOld
440 ,
const SbString& aNew
448 std::string a_Old(aOld.getString());
449 std::string a_New(aNew.getString());
450 if(a_Old==
"")
return FALSE;
452 std::string::size_type lold = a_Old.length();
454 std::string stmp(aString.getString());
456 std::string::size_type
pos = stmp.find(a_Old);
457 if(
pos==std::string::npos){
461 snew += stmp.substr(0,
pos);
463 stmp = stmp.substr(
pos+lold,stmp.length()-(
pos+lold));
467 aString = SbString(snew.c_str());
void SbSTRDEL(char *&aString)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
SbString SbStringSuffix(const SbString &aString)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
SbBool SbStringConvertToBool(const SbString &aString, SbBool &aValue)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
SbBool SbString_isenv(const SbString &aString)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
char * SbSTRDUP(const char *aString)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
SbPList SbStringGetWords(const SbString &aString, const char *aLimiter)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
int SbStringFind(const SbString &aString, const SbString &aSearch)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
SbBool SbStringReplace(SbString &aString, const SbString &aOld, const SbString &aNew)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
bool TRUE
for job options legacy (TODO: get rid of these!) ----------------------—
SbBool SbStringIsTTF(const SbString &aString)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
SbBool SbStringConvertToFloat(const SbString &aString, float &aValue)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
SbString * SbStringCreateEmpty(int aLength)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
SbBool SbStringConvertToInt(const SbString &aString, int &aValue)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void SbStringDelete(SbPList &aList)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
SbBool SbStringConvertToUnsignedLong(const SbString &aString, unsigned long &aValue)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
SbBool SbStringPrintF(SbString &aString, int aNumber, const char *aFormat,...)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
std::string getenv(const std::string &variableName)
get an environment variable
int SbStringReverseFind(const SbString &aString, const SbString &aSearch)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
SbBool SbStringGetenv(SbString &aString)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
SbBool SbString_getenv(const SbString &aString, SbString &aValue)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//