|
FEAT 3
Finite Element Analysis Toolbox
|
String class implementation. More...
#include <string.hpp>
Classes | |
| class | NoCaseLess |
| A class providing case-insensitive String comparison. More... | |
Public Member Functions | |
| String () | |
| default constructor More... | |
| String (const char *str) | |
| CTOR. More... | |
| String (const char *str, size_type count) | |
| CTOR. More... | |
| String (const std::string &str) | |
| CTOR. More... | |
| String (const std::string &str, size_type offset, size_type count=npos) | |
| CTOR. More... | |
| String (const String &str) | |
| copy CTOR More... | |
| String (size_type count, char c) | |
| CTOR. More... | |
| String (std::string &&str) | |
| CTOR. More... | |
| String (String &&str) | |
| move CTOR More... | |
| int | compare_no_case (const String &other) const |
| Compares two strings without regard to case. More... | |
| bool | ends_with (const char tail) const |
| Checks whether this string ends with a specified character. More... | |
| bool | ends_with (const String &tail) const |
| Checks whether this string ends with another string. More... | |
| bool | is_one_of (const String &set, const String &sep=" ", bool case_insensitive=false) const |
| Checks whether this string is equal to one in a set of strings. More... | |
| String | lower () const |
| Converts the string to lower case. More... | |
| String | pad_back (size_type len, char c=' ') const |
| Pads the back of the string up to a desired length. More... | |
| String | pad_front (size_type len, char c=' ') const |
| Pads the front of the string up to a desired length. More... | |
| template<typename T_ > | |
| bool | parse (T_ &t) const |
| Parses the string and stores its value in the provided variable. More... | |
| void | pop_back () |
| Removes the last character from the string. More... | |
| void | pop_front () |
| Removes the first character from the string. More... | |
| void | push_front (char value) |
| Inserts a character at the front of the string. More... | |
| size_type | replace_all (const String &find_string, const String &replace_string) |
| Replaces all occurrences of a substring by another substring. More... | |
| std::deque< String > | split_by_charset (const String &charset) const |
| Splits the string by a delimiter charset. More... | |
| std::deque< String > | split_by_string (const String &delimiter) const |
| Splits the string by a delimiter substring. More... | |
| std::deque< String > | split_by_whitespaces () const |
| Splits the string by white-spaces. More... | |
| bool | starts_with (const char head) const |
| Checks whether this string starts with a specified character. More... | |
| bool | starts_with (const String &head) const |
| Checks whether this string starts with another string. More... | |
| String | trim () const |
| Trims the string of all white-spaces. More... | |
| String | trim (const String &charset) const |
| Trims the string. More... | |
| String | trim_back () const |
| Trims the back of the string of all white-spaces. More... | |
| String | trim_back (const String &charset) const |
| Trims the back of the string. More... | |
| String | trim_front () const |
| Trims the front of the string of all white-spaces. More... | |
| String | trim_front (const String &charset) const |
| Trims the front of the string. More... | |
| String & | trim_me () |
| Trims this string of all white-spaces. More... | |
| String & | trim_me (const String &charset) |
| Trims this string. More... | |
| String | trunc_back (size_type len) const |
| Truncates the back of the string to a given maximum length. More... | |
| String | trunc_front (size_type len) const |
| Truncates the front of the string to a given maximum length. More... | |
| String | upper () const |
| Converts the string to upper case. More... | |
Static Public Member Functions | |
| static const char * | whitespaces () |
| Returns a null-terminated char string containing all white-space characters. More... | |
String class implementation.
This class inherits from the STL class std::string, so in consequence any algorithm working with std::string will also work with this class.
Definition at line 44 of file string.hpp.
|
inline |
default constructor
Definition at line 81 of file string.hpp.
Referenced by pad_back(), pad_front(), FEAT::stringify_join(), trim_back(), and trim_front().
|
inline |
CTOR.
Definition at line 87 of file string.hpp.
|
inline |
CTOR.
Definition at line 93 of file string.hpp.
|
inline |
CTOR.
Definition at line 99 of file string.hpp.
|
inline |
CTOR.
Definition at line 106 of file string.hpp.
|
inline |
copy CTOR
Definition at line 113 of file string.hpp.
|
inline |
move CTOR
Definition at line 120 of file string.hpp.
|
inline |
CTOR.
Definition at line 127 of file string.hpp.
|
inline |
CTOR.
Definition at line 133 of file string.hpp.
|
inline |
Compares two strings without regard to case.
| [in] | other | The string that is to be compared to this. |
this is less than other this is greater than other Definition at line 679 of file string.hpp.
Referenced by FEAT::Control::Domain::PartiDomainControlBase< DomainLevel_ >::_parse_parti_type(), FEAT::Control::Domain::PartiDomainControl< DomainLevel_ >::_parse_parti_type(), FEAT::Analytic::ParsedScalarFunction< dim_ >::add_variable(), FEAT::Analytic::ParsedVectorFunction< dom_dim_, img_dim_ >::add_variable(), FEAT::Cubature::DriverFactory< Driver_, Shape_, false >::create(), FEAT::Cubature::DriverFactory< Driver_, Shape_, true >::create(), FEAT::Cubature::Scalar::DriverFactory< Driver_, false >::create(), FEAT::Cubature::Scalar::DriverFactory< Driver_, true >::create(), is_one_of(), and FEAT::Pack::operator>>().
|
inline |
Checks whether this string ends with a specified character.
| [in] | tail | The character that the back of this string is to be checked against. |
true, if this ends with tail, otherwise false Definition at line 791 of file string.hpp.
|
inline |
Checks whether this string ends with another string.
| [in] | tail | The string that the back of this string is to be checked against. |
true, if this ends with tail, otherwise false Definition at line 754 of file string.hpp.
Referenced by FEAT::Xml::Scanner::scan(), and FEAT::Xml::Scanner::scan_markup().
|
inline |
Checks whether this string is equal to one in a set of strings.
| [in] | set | The set of strings that this string is to be checked against, separated by sep. |
| [in] | sep | The separator string. |
| [in] | case_insensitive | Specifies whether to perform a case sensitive or case insensitive comparison. |
true, if this is equal to at least one of the substrings in set, otherwise false. Definition at line 811 of file string.hpp.
References compare_no_case(), and split_by_string().
|
inline |
Converts the string to lower case.
Definition at line 652 of file string.hpp.
|
inline |
Pads the back of the string up to a desired length.
This function returns a string that is back-padded with a specific character up to a desired minimum length. If the length of this already has the desired minimum length, this function returns *this.
| [in] | len | The desired (minimum) length of the string. |
| [in] | c | The character to be used for padding. |
Definition at line 415 of file string.hpp.
References String().
Referenced by FEAT::Global::PMDCDSCMatrix< Global::Matrix< LAFEM::SparseMatrixBCSR< DT_, IT_, dim_, 1 >, MirrorV_, MirrorP_ >, Global::Matrix< LAFEM::SparseMatrixBCSR< DT_, IT_, 1, dim_ >, MirrorP_, MirrorV_ > >::_fmt_time(), FEAT::Assembly::VelocityInfo< DataType_, dim_ >::format_string(), FEAT::Assembly::ScalarErrorInfo< DataType_ >::format_string(), FEAT::Assembly::VectorErrorInfo< DataType_, dim_ >::format_string(), FEAT::MemoryUsage::get_formatted_memory_usage(), FEAT::Statistics::get_formatted_solver_internals(), FEAT::Statistics::get_formatted_times(), FEAT::Meshopt::HyperelasticityFunctional< DT_, IT_, Trafo_, CellFunctionalType_, RefCellTrafo_ >::info(), FEAT::Meshopt::ConcentrationFunctionDefault< DT_ >::info(), FEAT::Meshopt::ConcentrationFunctionPowOfDist< DT_ >::info(), FEAT::Meshopt::RumpfFunctionalBase< DataType_ >::info(), FEAT::Control::Meshopt::DuDvFunctionalControl< DT_, IT_, DomainControl_ >::info(), FEAT::Control::Meshopt::HyperelasticityFunctionalControl< DT_, IT_, DomainControl_, Hyperelasticity_ >::info(), FEAT::Meshopt::ChartDistanceFunction< ElementalFunction_, Trafo_, RefCellTrafo_ >::info(), FEAT::Assembly::FunctionIntegralInfo< DataType_, ValueType_, GradientType_, HessianType_ >::print_field_info(), FEAT::Assembly::FunctionIntegralInfo< DataType_, ValueType_, GradientType_, HessianType_ >::print_norms(), and FEAT::Control::Statistics::report().
|
inline |
Pads the front of the string up to a desired length.
This function returns a string that is front-padded with a specific character up to a desired minimum length. If the length of this already has the desired minimum length, this function returns *this.
| [in] | len | The desired (minimum) length of the string. |
| [in] | c | The character to be used for padding. |
Definition at line 392 of file string.hpp.
References String().
Referenced by FEAT::Solver::QPenalty< Functional_ >::_apply_intern(), FEAT::Solver::Linesearch< Functional_, Filter_ >::_check_convergence(), FEAT::Solver::IterativeSolver< Vector_ >::_plot_iter_line(), FEAT::DistFileIO::_rankname(), FEAT::Solver::QPenalty< Functional_ >::_set_initial_defect(), FEAT::Solver::NLOptLS< Functional_, Filter_ >::_set_initial_defect(), FEAT::Solver::NLOptLS< Functional_, Filter_ >::_set_new_defect(), FEAT::Solver::Linesearch< Functional_, Filter_ >::_startup(), FEAT::Dist::Comm::allprint(), FEAT::Assembly::DomainAssembler< Trafo_ >::dump(), FEAT::Control::Domain::PartiDomainControlBase< DomainLevel_ >::dump_ancestry(), FEAT::Control::Domain::VoxelDomainControl< DomainLevel_ >::dump_slag_layer_levels(), FEAT::Geometry::VoxelMap::export_to_bmp(), FEAT::Geometry::VoxelMap::render_to_bmp(), FEAT::stringify_bytes(), and FEAT::Geometry::ExportVTK< Mesh_, cell_dim_ >::write_pvtu().
|
inline |
Parses the string and stores its value in the provided variable.
| [out] | t | A transient reference to an object that receives the parsed value, if the parse succeeded. |
true, if the parse succeeds, otherwise false. Definition at line 837 of file string.hpp.
References trim().
Referenced by FEAT::Geometry::Atlas::BezierParamsParser< Mesh_ >::content(), FEAT::Cubature::DriverFactory< Driver_, Shape_, true >::create(), and FEAT::Cubature::Scalar::DriverFactory< Driver_, true >::create().
|
inline |
Removes the last character from the string.
Definition at line 245 of file string.hpp.
Referenced by FEAT::PropertyMap::read(), and FEAT::Xml::Scanner::scan_markup().
|
inline |
Removes the first character from the string.
Definition at line 239 of file string.hpp.
Referenced by FEAT::Analytic::ParsedVectorFunction< dom_dim_, img_dim_ >::parse(), FEAT::PropertyMap::read(), and FEAT::Xml::Scanner::scan_markup().
|
inline |
Inserts a character at the front of the string.
| [in] | value | The character to the pushed. |
Definition at line 233 of file string.hpp.
References FEAT::value.
|
inline |
Replaces all occurrences of a substring by another substring.
This function will replace all occurrences of a substring find_string by replace_string.
*this = "aaa", find_string = "aa" and replace_string = "pa" the resulting string will be "paa" and not "ppa".| [in] | find_string | The substring that is to be searched for. Must not be empty. |
| [in] | replace_string | The substring that is to be replaced by. |
Definition at line 598 of file string.hpp.
Splits the string by a delimiter charset.
This function separates the string into substrings, where two substrings are separated a delimiter substring consisting only of delimiter charset characters.
This function is frequently used by parsers, which split strings by whitespace characters.
Example:
When using the default whitespace delimiter character set, the string " 5 42\t7 " will be split into 3 substrings: "5", "42" and "7".
| [in] | charset | The character set which is to be treated as the delimiter charset. |
Definition at line 467 of file string.hpp.
Referenced by FEAT::Dist::Comm::allprint(), and split_by_whitespaces().
Splits the string by a delimiter substring.
This function separates the string into substrings, where the substrings are separated by a delimiter string.
Example:
When using "," as a delimiter string, the input string " ,5,,3" will be split into 4 substrings: " ", "5", "" and "3".
| [in] | delimiter | The string that is to be treated as a delimiter. |
Definition at line 539 of file string.hpp.
Referenced by is_one_of(), FEAT::Analytic::Common::ParProfileBase< DataType_ >::parse(), and FEAT::Geometry::MeshFileReader::read_root_markup().
|
inline |
Splits the string by white-spaces.
Definition at line 518 of file string.hpp.
References split_by_charset(), and whitespaces().
Referenced by FEAT::Geometry::Atlas::BezierPointsParser< Mesh_ >::content(), FEAT::Meshopt::MeshConcentrationFunctionFactory< Trafo_, RefCellTrafo_ >::create(), FEAT::Control::Domain::PartiDomainControlBase< DomainLevel_ >::set_desired_levels(), and FEAT::MemoryUsage::stamp().
|
inline |
Checks whether this string starts with a specified character.
| [in] | head | The character that the front of this string is to be checked against. |
true, if this starts with head, otherwise false Definition at line 777 of file string.hpp.
|
inline |
Checks whether this string starts with another string.
| [in] | head | The string that the front of this string is to be checked against. |
true, if this starts with head, otherwise false Definition at line 731 of file string.hpp.
Referenced by FEAT::SimpleArgParser::query_unsupported(), FEAT::Xml::Scanner::scan(), FEAT::Xml::Scanner::scan_markup(), and FEAT::MemoryUsage::stamp().
|
inline |
Trims the string of all white-spaces.
Definition at line 341 of file string.hpp.
References trim(), and whitespaces().
Trims the string.
This method removes any leading and trailing characters contained in the character set from the string.
| [in] | charset | The character set which is to be trimmed from the string. |
Definition at line 327 of file string.hpp.
References trim_back(), and trim_front().
Referenced by FEAT::Cubature::DriverFactory< Driver_, Shape_, false >::create(), FEAT::Cubature::DriverFactory< Driver_, Shape_, true >::create(), FEAT::Cubature::Scalar::DriverFactory< Driver_, false >::create(), FEAT::Cubature::Scalar::DriverFactory< Driver_, true >::create(), FEAT::Control::Meshopt::DuDvFunctionalControl< DT_, IT_, DomainControl_ >::info(), FEAT::Control::Meshopt::HyperelasticityFunctionalControl< DT_, IT_, DomainControl_, Hyperelasticity_ >::info(), FEAT::PropertyMap::query(), FEAT::PropertyMap::query_section(), FEAT::PropertyMap::read(), FEAT::Control::Statistics::report(), and FEAT::Xml::Scanner::scan_markup().
|
inline |
Trims the back of the string of all white-spaces.
Definition at line 309 of file string.hpp.
References trim_back(), and whitespaces().
Referenced by trim_back().
Trims the back of the string.
This method removes any trailing characters contained in the character set from the string.
| [in] | charset | The character set which is to be trimmed from the back of the string. |
Definition at line 293 of file string.hpp.
References String().
Referenced by trim().
|
inline |
Trims the front of the string of all white-spaces.
Definition at line 277 of file string.hpp.
References trim_front(), and whitespaces().
Referenced by trim(), and trim_front().
Trims the front of the string.
This method removes any leading characters contained in the character set from the string.
| [in] | charset | The character set which is to be trimmed from the front of the string. |
Definition at line 261 of file string.hpp.
References String().
|
inline |
Trims this string of all white-spaces.
*this Definition at line 370 of file string.hpp.
References trim().
Trims this string.
This method removes any leading and trailing characters contained in the character set from this string.
| [in] | charset | The character set which is to be trimmed from the string. |
*this Definition at line 358 of file string.hpp.
References trim().
Referenced by FEAT::LAFEM::PowerColMatrix< SubType_, blocks_ >::PowerColMatrix(), FEAT::LAFEM::PowerDiagMatrix< SubType_, blocks_ >::PowerDiagMatrix(), FEAT::LAFEM::PowerRowMatrix< SubType_, blocks_ >::PowerRowMatrix(), FEAT::LAFEM::TupleDiagMatrix< First_, Rest_ >::TupleDiagMatrix(), FEAT::PropertyMap::query(), FEAT::PropertyMap::query_section(), FEAT::PropertyMap::read(), FEAT::LAFEM::SaddlePointMatrix< MatrixA_, MatrixB_, MatrixD_ >::read_from(), and FEAT::Xml::Scanner::read_next_line().
|
inline |
Truncates the back of the string to a given maximum length.
| [in] | len | The desired maximum length of the string. |
Definition at line 444 of file string.hpp.
|
inline |
Truncates the front of the string to a given maximum length.
| [in] | len | The desired maximum length of the string. |
Definition at line 430 of file string.hpp.
|
inline |
Converts the string to upper case.
Definition at line 630 of file string.hpp.
|
inlinestatic |
Returns a null-terminated char string containing all white-space characters.
Definition at line 222 of file string.hpp.
Referenced by FEAT::Xml::Scanner::scan_markup(), split_by_whitespaces(), trim(), trim_back(), and trim_front().