ARTS
2.4.0(git:4fb77825)
|
The implementation for String, the ARTS string class. More...
#include <mystring.h>
Public Types | |
typedef Index | size_type |
Public Member Functions | |
my_basic_string ()=default | |
my_basic_string (Index n, char c=' ') | |
Constructor setting size. More... | |
my_basic_string (const std::basic_string< charT > &A, Index pos=0, Index numpos=my_basic_string< charT >::npos) | |
Construnctor from a basic_string. More... | |
my_basic_string (const char A[]) | |
Constructor from a C-style char array. More... | |
void | insert_substr (const my_basic_string< charT > &searchstr, const my_basic_string< charT > &insstr) |
Insert string before all occurrences of the substring. More... | |
void | split (Array< my_basic_string< charT > > &aos, const my_basic_string< charT > &delim) const |
Split string into substrings. More... | |
void | toupper () |
Convert to upper case. More... | |
my_basic_string | toupper () const |
void | tolower () |
Convert to lower case. More... | |
my_basic_string | tolower () const |
void | trim () |
Trim leading and trailing whitespace. More... | |
Index | nelem () const |
Number of elements. More... | |
char | operator[] (Index n) const |
Constant index operator. More... | |
char & | operator[] (Index n) |
Non-constant index operator. More... | |
Static Public Attributes | |
static const Index | npos = static_cast<Index>(std::basic_string<charT>::npos) |
Define npos: More... | |
The implementation for String, the ARTS string class.
This adds some additional functionality to the standard stl string class, notably:
a) Range checking by assert
b) nelem() member function, return the size of the String of type Index.
The type string is just a typedef for basic_string<char>. Therefore, to make everything work correctly, we have to derive our own class from basic_string, not from string directly.
Definition at line 55 of file mystring.h.
typedef Index my_basic_string< charT >::size_type |
Definition at line 108 of file mystring.h.
|
default |
|
inlineexplicit |
Constructor setting size.
You may give as a second argument a character with which to fill the new string. Per default this is zero.
n | Number of characters |
c | Optional fill character |
Definition at line 123 of file mystring.h.
|
inline |
Construnctor from a basic_string.
This is important for handling of expressions like this to work correctly:
String a = b+'.'+c
As for basic_string, this constructor can also be used to initialize the new string from a subrange of the original string.
A | The original string |
pos | Start position (0 means from the beginning) |
numpos | How many characters to copy |
Definition at line 140 of file mystring.h.
|
inline |
Constructor from a C-style char array.
Definition at line 174 of file mystring.h.
|
inline |
Insert string before all occurrences of the substring.
[in] | searchstr | String to search for. |
[in] | insstr | String to insert. |
Definition at line 184 of file mystring.h.
Referenced by write_method_header_documentation().
|
inline |
Number of elements.
Definition at line 246 of file mystring.h.
Referenced by abs_linesChangeBaseParameterForMatchingLevel(), abs_linesChangeBaseParameterForMatchingLines(), abs_linesSetBaseParameterForMatchingLevel(), abs_linesSetBaseParameterForMatchingLines(), add_basedir(), AgendaExecute(), chk_griddedfield_gridname(), expand_path(), find_file(), ArtsXMLTag::get_attribute_value(), get_dirname(), get_wsv_group_ids(), main(), LineShape::MetaData2ModelShape(), operator<<(), parse_a5_hitran(), ArtsParser::parse_agenda(), parse_f51_hitran(), Absorption::ReadFromArtscat3Stream(), Absorption::ReadFromArtscat4Stream(), Absorption::ReadFromArtscat5Stream(), CIARecord::ReadFromCIA(), Absorption::ReadFromHitran2001Stream(), Absorption::ReadFromHitran2004Stream(), Absorption::ReadFromHitranOnlineStream(), Absorption::ReadFromLBLRTMStream(), Absorption::ReadFromMytran2Stream(), SpeciesAuxData::ReadFromStream(), QuantumIdentifier::SetFromStringForCO2Band(), SpeciesTag::SpeciesTag(), my_basic_string< charT >::split(), my_basic_string< charT >::trim(), and write_method_header().
|
inline |
Non-constant index operator.
We redifine this here so that we can have range checking by assert.
[in] | n | Index |
Definition at line 272 of file mystring.h.
References Absorption::nelem().
|
inline |
Constant index operator.
We redifine this here so that we can have range checking by assert.
[in] | n | Index |
Definition at line 259 of file mystring.h.
References Absorption::nelem().
|
inline |
Split string into substrings.
[out] | aos | ArrayOfString containing the returned substrings. |
[in] | delim | Delimiter string. |
Definition at line 206 of file mystring.h.
References my_basic_string< charT >::nelem(), and Absorption::nelem().
Referenced by get_dirname(), operator>>(), parse_a5_hitran(), parse_atmcompact_scattype(), parse_atmcompact_speciesname(), parse_atmcompact_speciestype(), parse_f51_hitran(), parse_partfield_name(), and ScatSpeciesScatAndMetaRead().
|
inline |
Convert to lower case.
Definition at line 85 of file mystring.h.
Referenced by time_stepper_selection(), and my_basic_string< char >::tolower().
|
inline |
Definition at line 89 of file mystring.h.
|
inline |
Convert to upper case.
Definition at line 74 of file mystring.h.
Referenced by atm_fields_compactFromMatrix(), chk_griddedfield_gridname(), scat_dataCheck(), and my_basic_string< char >::toupper().
|
inline |
Definition at line 78 of file mystring.h.
void my_basic_string< charT >::trim |
Trim leading and trailing whitespace.
Definition at line 225 of file mystring.h.
References my_basic_string< charT >::nelem().
Referenced by parse_a5_hitran(), parse_f51_hitran(), species_index_from_species_name(), and SpeciesTag::SpeciesTag().
|
static |
Define npos:
Definition at line 106 of file mystring.h.
Referenced by array_species_tag_from_string(), replace_all(), and SpeciesTag::SpeciesTag().