#include <G4String.hh>
Public Types | |
exact | |
ignoreCase | |
leading | |
trailing | |
both | |
enum | caseCompare { exact, ignoreCase } |
enum | stripType { leading, trailing, both } |
Public Member Functions | |
G4String () | |
G4String (char) | |
G4String (const char *) | |
G4String (const char *, str_size) | |
G4String (const G4String &) | |
G4String (const G4SubString &) | |
G4String (const std::string &) | |
~G4String () | |
G4String & | operator= (const G4String &) |
G4String & | operator= (const std::string &) |
G4String & | operator= (const char *) |
char | operator() (str_size) const |
char & | operator() (str_size) |
G4String & | operator+= (const G4SubString &) |
G4String & | operator+= (const char *) |
G4String & | operator+= (const std::string &) |
G4String & | operator+= (const char &) |
G4bool | operator== (const G4String &) const |
G4bool | operator== (const char *) const |
G4bool | operator!= (const G4String &) const |
G4bool | operator!= (const char *) const |
operator const char * () const | |
G4SubString | operator() (str_size, str_size) |
G4int | compareTo (const char *, caseCompare mode=exact) const |
G4int | compareTo (const G4String &, caseCompare mode=exact) const |
G4String & | prepend (const char *) |
G4String & | append (const G4String &) |
std::istream & | readLine (std::istream &, G4bool skipWhite=true) |
G4String & | replace (unsigned int, unsigned int, const char *, unsigned int) |
G4String & | replace (str_size, str_size, const char *) |
G4String & | remove (str_size) |
G4String & | remove (str_size, str_size) |
G4int | first (char) const |
G4int | last (char) const |
G4bool | contains (const std::string &) const |
G4bool | contains (char) const |
G4String | strip (G4int strip_Type=trailing, char c=' ') |
void | toLower () |
void | toUpper () |
G4bool | isNull () const |
str_size | index (const char *, G4int pos=0) const |
str_size | index (char, G4int pos=0) const |
str_size | index (const G4String &, str_size, str_size, caseCompare) const |
const char * | data () const |
G4int | strcasecompare (const char *, const char *) const |
unsigned int | hash (caseCompare cmp=exact) const |
unsigned int | stlhash () const |
Definition at line 104 of file G4String.hh.
enum G4String::stripType |
G4String::G4String | ( | ) | [inline] |
G4String::G4String | ( | char | ) | [inline] |
Definition at line 141 of file G4String.icc.
00142 { 00143 char str[2]; 00144 str[0]=ch; 00145 str[1]='\0'; 00146 std_string::operator=(str); 00147 }
G4String::G4String | ( | const char * | ) | [inline] |
G4String::G4String | ( | const char * | , | |
str_size | ||||
) | [inline] |
G4String::G4String | ( | const G4String & | ) | [inline] |
G4String::G4String | ( | const G4SubString & | ) | [inline] |
G4String::G4String | ( | const std::string & | ) | [inline] |
G4String::~G4String | ( | ) | [inline] |
Definition at line 275 of file G4String.icc.
Referenced by G4UIcommandTree::AddNewCommand(), G4UImessenger::CreateDirectory(), G4CascadeParamMessenger::CreateDirectory(), G4UIcommand::DoIt(), G4UIcommandTree::FindCommandTree(), G4UIcommandTree::FindPath(), G4XmlAnalysisManager::FinishNtuple(), G4CloneDaughters(), G4CreateCloneVTE(), G4CreateCloneVTEWithDivision(), G4UIGainServer::GetCommand(), G4UIGAG::GetCommand(), G4UItcsh::GetCommandLineString(), G4UIcsh::GetCommandLineString(), G4UImanager::GetCurrentStringValue(), G4VAnalysisManager::GetFullFileName(), G4tgrFileIn::GetWordsInLine(), G4VUIshell::MakePrompt(), G4UItcsh::MakePrompt(), G4XmlAnalysisManager::OpenFile(), G4RootAnalysisManager::OpenFile(), G4CsvAnalysisManager::OpenFile(), G4UIcommandTree::RemoveCommand(), G4GDMLEvaluator::SolveBrackets(), G4XmlAnalysisManager::Write(), and G4VAnalysisManager::WriteAscii().
G4int G4String::compareTo | ( | const G4String & | , | |
caseCompare | mode = exact | |||
) | const [inline] |
Definition at line 264 of file G4String.icc.
References compareTo().
00265 { 00266 return compareTo(str.c_str(), mode); 00267 }
G4int G4String::compareTo | ( | const char * | , | |
caseCompare | mode = exact | |||
) | const [inline] |
Definition at line 258 of file G4String.icc.
References exact, and strcasecompare().
Referenced by compareTo(), G4VisCommandsViewerSet::SetNewValue(), and G4VisCommandSceneHandlerCreate::SetNewValue().
00259 { 00260 return (mode==exact) ? strcmp(c_str(),str) 00261 : strcasecompare(c_str(),str); 00262 }
G4bool G4String::contains | ( | char | ) | const [inline] |
G4bool G4String::contains | ( | const std::string & | ) | const [inline] |
Definition at line 334 of file G4String.icc.
Referenced by G4GDMLWrite::GenerateName(), and G3VolTableEntry::GetMasterClone().
const char * G4String::data | ( | ) | const [inline] |
Definition at line 430 of file G4String.icc.
Referenced by G4UImanager::ApplyCommand(), G4HEPEvtInterface::G4HEPEvtInterface(), G4SubString::operator=(), PG4gsdetu(), PG4gsmixt(), and G4AnalysisMessenger::SetNewValue().
G4int G4String::first | ( | char | ) | const [inline] |
Definition at line 324 of file G4String.icc.
Referenced by G4SDStructure::Activate(), G4UIcommandTree::AddNewCommand(), G4NeutronHPThermalScatteringData::BuildPhysicsTable(), G4HadronicProcess::CheckEnergyMomentumConservation(), G4GDMLReadStructure::DivisionvolRead(), G4UIcommandTree::FindCommandTree(), G4UIcommandTree::FindPath(), G4SDStructure::FindSensitiveDetector(), G3VolTableEntry::GetMasterClone(), G4AttDefStore::GetStoreKey(), G4AttValueFilterT< T, ConversionErrorPolicy >::GetValidElement(), operator<<(), G4GDMLReadStructure::PhysvolRead(), G4UIcommandTree::RemoveCommand(), and G4GDMLReadStructure::ReplicaRead().
unsigned int G4String::hash | ( | caseCompare | cmp = exact |
) | const [inline] |
Definition at line 435 of file G4String.icc.
00436 { 00437 const char* str=c_str(); 00438 unsigned long h = 0; 00439 for ( ; *str; ++str) 00440 { h = 5*h + *str; } 00441 00442 return str_size(h); 00443 }
str_size G4String::index | ( | const G4String & | , | |
str_size | , | |||
str_size | , | |||
caseCompare | ||||
) | const [inline] |
Definition at line 415 of file G4String.icc.
Referenced by G4UImanager::ApplyCommand(), G4VBasicShell::Complete(), G4UIcommandTree::CompleteCommandPath(), G4UIcommand::DoIt(), G4VBasicShell::FindCommand(), G4UIcommandTree::FindCommandTree(), G4VBasicShell::FindDirectory(), G4UIcommandTree::FindPath(), G4UIArrayString::G4UIArrayString(), G4VUIshell::GetAbsCommandDirPath(), G4HCtable::GetCollectionID(), G4DCtable::GetCollectionID(), G4VUIshell::ListCommand(), G4VBasicShell::ModifyToFullPathCommand(), G4UImanager::ParseMacroSearchPath(), G4RunManager::RestoreRandomNumberStatus(), G4UImanager::SetAlias(), G4UImanager::SolveAlias(), and G4VBasicShell::TerminalHelp().
G4bool G4String::isNull | ( | ) | const [inline] |
Definition at line 402 of file G4String.icc.
Referenced by G4SDStructure::Activate(), G4UIcommandTree::AddNewCommand(), G4SDStructure::AddNewDetector(), G4UImanager::ApplyCommand(), G4UIparameter::CheckNewValue(), G4UIcommand::CheckNewValue(), G4UIcommand::DoIt(), G4TrajectoryDrawByAttribute::Draw(), G4AttributeFilterT< T >::Evaluate(), G4VisCommandOpen::G4VisCommandOpen(), G4VisCommandSceneHandlerCreate::G4VisCommandSceneHandlerCreate(), G4UImanager::GetCurrentStringValue(), G4MolecularConfiguration::GetName(), G4UIparameter::List(), G4UIcommand::List(), G4VBasicShell::ModifyToFullPathCommand(), G4VisListManager< T >::Print(), G4VisFilterManager< T >::Print(), G4UIcommandTree::RemoveCommand(), G4VisCommandModelCreate< Factory >::SetNewValue(), G4ProcessTableMessenger::SetNewValue(), G4PolarizationMessenger::SetNewValue(), G4VUserPhysicsList::SetPhysicsTableRetrieved(), G4VBasicShell::ShowCurrent(), G4TextPPRetriever::SparseOption(), G4TextPPReporter::SparseOption(), and G4VUserPhysicsList::StorePhysicsTable().
G4int G4String::last | ( | char | ) | const [inline] |
Definition at line 329 of file G4String.icc.
Referenced by G4UItcsh::CompleteCommand(), G4UIcommandTree::CompleteCommandPath(), G4SDStructure::G4SDStructure(), G4VSensitiveDetector::G4VSensitiveDetector(), G4VUIshell::GetAbsCommandDirPath(), and G4UItcsh::ListMatchedCommand().
G4String::operator const char * | ( | ) | const [inline] |
G4bool G4String::operator!= | ( | const char * | ) | const [inline] |
G4SubString G4String::operator() | ( | str_size | , | |
str_size | ||||
) | [inline] |
Definition at line 425 of file G4String.icc.
00426 { 00427 return G4SubString(*this,start,extent); 00428 }
char & G4String::operator() | ( | str_size | ) | [inline] |
char G4String::operator() | ( | str_size | ) | const [inline] |
G4String & G4String::operator+= | ( | const char & | ) | [inline] |
G4String & G4String::operator+= | ( | const std::string & | ) | [inline] |
G4String & G4String::operator+= | ( | const char * | ) | [inline] |
G4String & G4String::operator+= | ( | const G4SubString & | ) | [inline] |
Definition at line 192 of file G4String.icc.
00193 { 00194 G4String tmp(str); 00195 std_string::operator+=(tmp); 00196 return *this; 00197 }
G4String & G4String::operator= | ( | const char * | ) | [inline] |
G4String & G4String::operator= | ( | const std::string & | ) | [inline] |
Definition at line 158 of file G4String.icc.
00159 { 00160 if (&str == this) { return *this; } 00161 std_string::operator=(str); 00162 return *this; 00163 }
G4bool G4String::operator== | ( | const char * | ) | const [inline] |
G4String & G4String::prepend | ( | const char * | ) | [inline] |
Definition at line 269 of file G4String.icc.
Referenced by G4SDManager::Activate(), G4SDManager::AddNewDetector(), G4CascadeParamMessenger::CreateDirectory(), G4SDManager::FindSensitiveDetector(), and G4VSensitiveDetector::G4VSensitiveDetector().
std::istream & G4String::readLine | ( | std::istream & | , | |
G4bool | skipWhite = true | |||
) | [inline] |
Definition at line 282 of file G4String.icc.
Referenced by G3CLRead(), G4UIGainServer::GetCommand(), G4UIGAG::GetCommand(), and G4UIcsh::GetCommandLineString().
00283 { 00284 char tmp[1024]; 00285 if ( skipWhite ) 00286 { 00287 strm >> std::ws; 00288 strm.getline(tmp,1024); 00289 *this=tmp; 00290 } 00291 else 00292 { 00293 strm.getline(tmp,1024); 00294 *this=tmp; 00295 } 00296 return strm; 00297 }
Definition at line 312 of file G4String.icc.
Referenced by G4SDStructure::Activate(), G4UIcommandTree::AddNewCommand(), G4SDStructure::AddNewDetector(), G4UImanager::ApplyCommand(), G4UItcsh::CompleteCommand(), G4UIcommandTree::CompleteCommandPath(), G4UIcommandTree::FindCommandTree(), G4UIcommandTree::FindPath(), G4SDStructure::FindSensitiveDetector(), G4SDStructure::G4SDStructure(), G4VSensitiveDetector::G4VSensitiveDetector(), G4VUIshell::GetAbsCommandDirPath(), G4UIGainServer::GetCommand(), G4UIGAG::GetCommand(), G4UItcsh::GetCommandLineString(), G4UIcsh::GetCommandLineString(), G4UItcsh::ListMatchedCommand(), G4AdjointSimManager::RegisterAtEndOfAdjointTrack(), G4UIcommandTree::RemoveCommand(), G4GDMLRead::Strip(), and G4GDMLRead::StripName().
Definition at line 306 of file G4String.icc.
00307 { 00308 std_string::replace(pos,n,str); 00309 return *this; 00310 }
G4String & G4String::replace | ( | unsigned | int, | |
unsigned | int, | |||
const char * | , | |||
unsigned | int | |||
) | [inline] |
unsigned int G4String::stlhash | ( | ) | const [inline] |
Definition at line 445 of file G4String.icc.
00446 { 00447 const char* str=c_str(); 00448 unsigned long h = 0; 00449 for ( ; *str; ++str) 00450 { h = 5*h + *str; } 00451 00452 return str_size(h); 00453 }
G4int G4String::strcasecompare | ( | const char * | , | |
const char * | ||||
) | const [inline] |
Definition at line 242 of file G4String.icc.
Referenced by compareTo().
00243 { 00244 char* buf1 = new char[strlen(s1)+1]; 00245 char* buf2 = new char[strlen(s2)+1]; 00246 00247 for (str_size i=0; i<=strlen(s1); i++) 00248 { buf1[i] = tolower(char(s1[i])); } 00249 for (str_size j=0; j<=strlen(s2); j++) 00250 { buf2[j] = tolower(char(s2[j])); } 00251 00252 G4int res = strcmp(buf1, buf2); 00253 delete [] buf1; 00254 delete [] buf2; 00255 return res; 00256 }
Definition at line 344 of file G4String.icc.
References both, leading, and trailing.
Referenced by G4VBasicShell::ApplyShellCommand(), G4VBasicShell::ChangeDirectory(), G4VBasicShell::ChangeDirectoryCommand(), G4VBasicShell::Complete(), G4UItcsh::CompleteCommand(), G4ConversionUtils::Convert(), G4VBasicShell::FindCommand(), G4VBasicShell::FindDirectory(), G4gsmate(), G4UIArrayString::G4UIArrayString(), G4UItcsh::G4UItcsh(), G4VisCommandOpen::G4VisCommandOpen(), G4VisCommandSceneHandlerCreate::G4VisCommandSceneHandlerCreate(), G4VViewer::G4VViewer(), G4UIGainServer::GetCommand(), G4UIGAG::GetCommand(), G4UIcsh::GetCommandLineString(), G4VUIshell::GetCommandTree(), G4VUIshell::ListCommand(), G4VBasicShell::ListDirectory(), G4UItcsh::ListMatchedCommand(), G4RadioactiveDecay::LoadDecayTable(), G4VBasicShell::ModifyToFullPathCommand(), G4UImanager::RemoveAlias(), G4VViewer::SetName(), G4VisCommandViewerCreate::SetNewValue(), G4VisCommandViewerClone::SetNewValue(), G4AttCheck::Standard(), G4VBasicShell::TerminalHelp(), and G4VisManager::ViewerShortName().
00345 { 00346 G4String retVal = *this; 00347 if(length()==0) { return retVal; } 00348 str_size i=0; 00349 switch ( strip_Type ) { 00350 case leading: 00351 { 00352 for(i=0;i<length();i++) 00353 { if (std_string::operator[](i) != ch) { break; } } 00354 retVal = substr(i,length()-i); 00355 } 00356 break; 00357 case trailing: 00358 { 00359 G4int j=0; 00360 for(j=length()-1;j>=0;j--) 00361 { if (std_string::operator[](j) != ch) { break; } } 00362 retVal = substr(0,j+1); 00363 } 00364 break; 00365 case both: 00366 { 00367 for(i=0;i<length();i++) 00368 { if (std_string::operator[](i) != ch) { break; } } 00369 G4String tmp(substr(i,length()-i)); 00370 G4int k=0; 00371 for(k=tmp.length()-1;k>=0;k--) 00372 { if (tmp.std_string::operator[](k) != ch) { break; } } 00373 retVal = tmp.substr(0,k+1); 00374 } 00375 break; 00376 default: 00377 break; 00378 } 00379 return retVal; 00380 }
void G4String::toLower | ( | ) | [inline] |
Definition at line 382 of file G4String.icc.
Referenced by G4Colour::AddToMap(), G4UIExecutive::G4UIExecutive(), G4Colour::GetColour(), G4VAnalysisManager::GetFileType(), G4VisManager::GetVerbosityValue(), G4VisFilterManager< T >::SetMode(), and G4INCLXXInterfaceMessenger::SetNewValue().
00383 { 00384 for (str_size i=0; i<size();i++) 00385 { 00386 //GB:HP-UX-aCC,Linux-KCC 00387 std_string::operator[](i) = tolower(char(std_string::operator[](i))); 00388 //at(i) = tolower(at(i)); 00389 } 00390 }
void G4String::toUpper | ( | ) | [inline] |
Definition at line 392 of file G4String.icc.
Referenced by G4UIcommand::ConvertToBool(), and G4UImessenger::StoB().
00393 { 00394 for (str_size i=0; i<size();i++) 00395 { 00396 //GB:HP-UX-aCC,Linux-KCC 00397 std_string::operator[](i) = toupper(char(std_string::operator[](i))); 00398 //at(i) = toupper(at(i)); 00399 } 00400 }