Import Geant4 2.0.0 source tree
This commit is contained in:
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: cstring.icc,v 1.4 2000/02/08 14:15:42 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// $Id: cstring.icc,v 1.5 2000/06/26 16:25:57 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
@@ -228,22 +228,40 @@ G4String::operator const char*() const
|
||||
return c_str();
|
||||
}
|
||||
|
||||
int G4String::strcasecompare(const char* s1, const char* s2) const
|
||||
{
|
||||
#ifndef G4USE_STD_NAMESPACE
|
||||
return strcasecmp(s1,s2);
|
||||
#else
|
||||
char* buf1 = new char[strlen(s1)+1];
|
||||
char* buf2 = new char[strlen(s2)+1];
|
||||
|
||||
for (size_t i=0; i<=strlen(s1); i++)
|
||||
buf1[i] = tolower(s1[i]);
|
||||
for (size_t j=0; j<=strlen(s2); j++)
|
||||
buf2[j] = tolower(s2[j]);
|
||||
|
||||
int res = strcmp(buf1, buf2);
|
||||
delete [] buf1;
|
||||
delete [] buf2;
|
||||
return res;
|
||||
#endif
|
||||
}
|
||||
|
||||
int G4String::compareTo(const char* s, caseCompare mode)
|
||||
{
|
||||
//GB:OSF1-cxx if(mode=exact)
|
||||
if(mode==exact)
|
||||
return strcmp(c_str(),s);
|
||||
else
|
||||
return strcasecmp(c_str(),s);
|
||||
return strcasecompare(c_str(),s);
|
||||
}
|
||||
|
||||
int G4String::compareTo(const G4String& s, caseCompare mode)
|
||||
{
|
||||
//GB:OSF1-cxx if(mode=exact)
|
||||
if(mode==exact)
|
||||
return strcmp(data(),s.data());
|
||||
return strcmp(c_str(),s.c_str());
|
||||
else
|
||||
return strcasecmp(data(),s.data());
|
||||
return strcasecompare(c_str(),s.c_str());
|
||||
}
|
||||
|
||||
G4String& G4String::prepend (const char* str)
|
||||
|
||||
Reference in New Issue
Block a user