Geant4-11
Public Types | Public Member Functions
G4String Class Reference

#include <G4String.hh>

Inheritance diagram for G4String:

Public Types

enum  caseCompare { exact , ignoreCase }
 
enum  stripType { leading , trailing , both }
 

Public Member Functions

G4int compareTo (std::string_view, caseCompare mode=exact) const
 Deprecated function. More...
 
G4bool contains (char) const
 Deprecated function. More...
 
G4bool contains (const std::string &) const
 Deprecated function. More...
 
 G4String ()=default
 
 G4String (const G4String &)
 
 G4String (const std::string &)
 
 G4String (G4String &&)
 
 G4String (std::string &&)
 
 operator const char * () const
 Implicitly convert to const char* More...
 
G4Stringoperator= (const G4String &)
 
G4Stringoperator= (G4String &&)
 
reference operator[] (int)
 Override of subscript operator for int to suppress C2666 errors with MSVC. More...
 
const_reference operator[] (int) const
 
std::istream & readLine (std::istream &, G4bool skipWhite=true)
 Deprecated function. More...
 
G4Stringremove (size_type)
 Deprecated function. More...
 
G4String strip (stripType strip_Type=trailing, char c=' ')
 Deprecated function. More...
 
void toLower ()
 Deprecated function. More...
 
void toUpper ()
 Deprecated function. More...
 

Detailed Description

Definition at line 61 of file G4String.hh.

Member Enumeration Documentation

◆ caseCompare

Deprecated:
Will be removed in future release
Enumerator
exact 
ignoreCase 

Definition at line 66 of file G4String.hh.

67 {
68 exact,
70 };
@ ignoreCase
Definition: G4String.hh:69

◆ stripType

Deprecated:
Will be removed in future release
Enumerator
leading 
trailing 
both 

Definition at line 74 of file G4String.hh.

75 {
76 leading,
78 both
79 };
@ trailing
Definition: G4String.hh:77
@ leading
Definition: G4String.hh:76

Constructor & Destructor Documentation

◆ G4String() [1/5]

G4String::G4String ( )
inlinedefault

◆ G4String() [2/5]

G4String::G4String ( const std::string &  )
inline

◆ G4String() [3/5]

G4String::G4String ( const G4String )
inline

◆ G4String() [4/5]

G4String::G4String ( std::string &&  )
inline

◆ G4String() [5/5]

G4String::G4String ( G4String &&  )
inline

Member Function Documentation

◆ compareTo()

G4int G4String::compareTo ( std::string_view  ,
caseCompare  mode = exact 
) const
inline

Deprecated function.

Deprecated:
Use std::string::compare or G4StrUtil::icompare instead

◆ contains() [1/2]

G4bool G4String::contains ( char  ) const
inline

Deprecated function.

Deprecated:
Use G4StrUtil::contains instead

◆ contains() [2/2]

G4bool G4String::contains ( const std::string &  ) const
inline

Deprecated function.

Deprecated:
Use G4StrUtil::contains instead

◆ operator const char *()

G4String::operator const char * ( ) const
inline

Implicitly convert to const char*

Deprecated:
Will be removed in future releases for std::string compliance If passing G4String to functions requiring const char*, use std::string::c_str to explicitly convert. G4String also implicitly converts to std::string_view to match the std::string interface.

◆ operator=() [1/2]

G4String & G4String::operator= ( const G4String )
inline

◆ operator=() [2/2]

G4String & G4String::operator= ( G4String &&  )
inline

◆ operator[]() [1/2]

reference G4String::operator[] ( int  )
inline

Override of subscript operator for int to suppress C2666 errors with MSVC.

Deprecated:
Will be removed at the same time as operator const char* that requires it

This override is required because of G4String's provision of an implicit conversion operator to const char*. Together with the subscript operator and C++'s built-in `operator[](const char*, int) operator, use of G4String::operator[] will trigger MSVC error C2666 This is a known issue with mixing implicit conversion to const char* and subscript operators. Provision of the override with int argument is thus a workaround until the conversion operator is removed.

◆ operator[]() [2/2]

const_reference G4String::operator[] ( int  ) const
inline

◆ readLine()

std::istream & G4String::readLine ( std::istream &  ,
G4bool  skipWhite = true 
)
inline

Deprecated function.

Deprecated:
Use std::getline plus G4StrUtil::lstrip instead

◆ remove()

G4String & G4String::remove ( size_type  )
inline

Deprecated function.

Deprecated:
Use std::string::erase instead

◆ strip()

G4String G4String::strip ( stripType  strip_Type = trailing,
char  c = ' ' 
)
inline

Deprecated function.

Deprecated:
Use G4StrUtil functions instead

◆ toLower()

void G4String::toLower ( )
inline

Deprecated function.

Deprecated:
Use G4StrUtil functions instead

◆ toUpper()

void G4String::toUpper ( )
inline

Deprecated function.

Deprecated:
Use G4StrUtil functions instead

The documentation for this class was generated from the following file: