|
The Vish Visualization Shell 0.3
Vish
|
Classes | |
| class | MemCore::simplestring |
Typedefs | |
| using | MemCore::StringUtil::SUBST = const std::tuple< const char *, std::string > |
| A type definition that in conjunction with the string division operators allows a compact syntax for string substitutions such as: | |
Functions | |
| template<typename E > | |
| std::basic_string< E > | MemCore::StringUtil::basename (const std::basic_string< E > &url) |
| Return the basic name of the URL, which is without extension and path information. | |
| template<typename E > | |
| std::basic_string< E > | MemCore::StringUtil::crop_after_first (std::basic_string< E > const &s, const E c) |
| Crop all what follows after first occurance of character 'c'. | |
| template<typename E > | |
| std::basic_string< E > | MemCore::StringUtil::crop_after_last (std::basic_string< E > const &s, const E c) |
| Crop all what follows after last occurance of character 'c'. | |
| template<typename E > | |
| std::basic_string< E > | MemCore::StringUtil::crop_before_first (std::basic_string< E > const &s, const E c) |
| Crop all what follows after first occurance of character 'c'. | |
| template<typename E > | |
| std::basic_string< E > | MemCore::StringUtil::crop_before_last (std::basic_string< E > const &s, const E c) |
| Crop all what is before last occurance of character 'c'. | |
| template<typename E > | |
| std::basic_string< E > | MemCore::StringUtil::crop_first (std::basic_string< E > const &s, int n) |
| Crop n characters from the beginning of this string. | |
| template<typename E > | |
| std::basic_string< E > | MemCore::StringUtil::crop_last (std::basic_string< E > const &s, int n) |
| Crop n characters from the end of this string. | |
| template<typename E > | |
| std::basic_string< E > | MemCore::StringUtil::crop_postfix (const std::basic_string< E > &text, const std::basic_string< E > &postfix) |
| Remove some trailing text from a string. | |
| template<typename E > | |
| std::basic_string< E > | MemCore::StringUtil::crop_prefix (const std::basic_string< E > &text, const std::basic_string< E > &prefix) |
| Crop a prefix from some text, returning the unmodified text if not possible. | |
| std::string | MemCore::StringUtil::crop_prefix (const std::string &text, const char *prefix) |
| Crop a prefix from some text, returning the unmodified text if not possible. | |
| template<typename E > | |
| bool | MemCore::StringUtil::ends_with (const std::basic_string< E > &who, const std::basic_string< E > &what) |
| Determine if a given string ends with a specific sequence. | |
| template<typename E > | |
| std::basic_string< E > | MemCore::StringUtil::extname (const std::basic_string< E > &url) |
| Return the filename extension, which is the string after the last '. | |
| template<typename E > | |
| std::basic_string< E > | MemCore::StringUtil::extract_left (std::basic_string< E > &text, const E c) |
| Modify the given text string, cutting off all what is left of the occurance of that first given character, and return whatever is left of it. | |
| template<typename E > | |
| bool | MemCore::StringUtil::left_crop (std::basic_string< E > &text, const E *what) |
| Remove some leading text from a string. | |
| template<typename E > | |
| bool | MemCore::StringUtil::left_crop (std::basic_string< E > &text, const std::basic_string< E > &what) |
| Remove some leading text from a string. | |
| std::string | MemCore::StringUtil::ltrim (const std::string &input) |
| Remove leading white space. | |
| std::string | MemCore::StringUtil::pad_left (const std::string &str, size_t result_length, const char padchar=' ') |
| Add spaces to the left such that the resulting string is at least of the given length. | |
| std::string | MemCore::StringUtil::percent_encode (const std::string &s, bool EncodeSpaceAsPlus=true) |
| https://en.wikipedia.org/wiki/Percent-encoding | |
| template<typename E > | |
| bool | MemCore::StringUtil::right_crop (std::basic_string< E > &text, const std::basic_string< E > &postfix) |
| Remove some trailing text from a string. | |
| std::string | MemCore::StringUtil::rtrim (const std::string &input) |
| Remove trailing tabs and new line charactes, but not spaces. | |
| template<typename E , typename C > | |
| size_t | MemCore::StringUtil::split (std::basic_string< E > const &s, C &container, E const delimiter, bool keepBlankFields=true, E const terminator=0) |
| Splitting a string using a given delimiter. | |
| template<typename E , typename C > | |
| size_t | MemCore::StringUtil::split (std::basic_string< E > const &s, C &container, std::basic_string< E > delimiter, bool keepBlankFields=true, E const terminator=0) |
| Splitting a string using a given set of delimiters. | |
| template<typename E > | |
| std::tuple< std::basic_string< E >, std::basic_string< E > > | MemCore::StringUtil::split_at_first (std::basic_string< E > const &s, const E c) |
| Split a string into two at first occurance of character 'c'. | |
| template<typename E > | |
| std::tuple< std::basic_string< E >, std::basic_string< E > > | MemCore::StringUtil::split_at_last (std::basic_string< E > const &s, const E c) |
| Split a string into two at last occurance of character 'c'. | |
| template<typename E , typename C > | |
| size_t | MemCore::StringUtil::split_string (std::basic_string< E > const &s, C &container, E const delimiter, bool keepBlankFields=true) |
| Splitting a string using a given delimiter but also handling 0-bytes in the string correctly. | |
| template<typename E > | |
| bool | MemCore::StringUtil::starts_with (const std::basic_string< E > &who, const std::basic_string< E > &what) |
| Determine if a given string starts with a specific sequence. | |
| template<typename CHAR > | |
| constexpr std::basic_string< CHAR > | MemCore::StringUtil::str (const CHAR *text) |
| A "safe" conversion operation from C strings to std::string which also checks for nullptr , which is forbidden to be passed to a std::string by the C++ standard according to https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p2166r1.html . | |
| template<typename CHAR , size_t N> | |
| constexpr std::basic_string< CHAR > | MemCore::StringUtil::str (const CHAR(&text)[N]) |
| An optimized version to construct a std::string from a static character array where the length is known. | |
| template<typename E > | |
| std::basic_string< E > | MemCore::StringUtil::subst (std::basic_string< E > const &s, const E whom, const E withwhat) |
| Substitute a character in a string by another one. | |
| using MemCore::StringUtil::SUBST = typedef const std::tuple<const char*, std::string> |
A type definition that in conjunction with the string division operators allows a compact syntax for string substitutions such as:
|
inline |
Return the basic name of the URL, which is without extension and path information.
This is the text between the last '/' or '\' and the last '.'
Referenced by Wizt::VNutrition::computeExpectedOutput().
| std::basic_string< E > MemCore::StringUtil::crop_after_first | ( | std::basic_string< E > const & | s, |
| const E | c | ||
| ) |
Crop all what follows after first occurance of character 'c'.
This is equivalent to the shell function ${s%c.*}
| std::basic_string< E > MemCore::StringUtil::crop_after_last | ( | std::basic_string< E > const & | s, |
| const E | c | ||
| ) |
Crop all what follows after last occurance of character 'c'.
This is equivalent to the shell function ${sc.*}
Referenced by MemCore::DirName(), Wizt::VScriptLoader::exec(), MemCore::getExecutableDir(), and Wizt::openModules().
| std::basic_string< E > MemCore::StringUtil::crop_before_first | ( | std::basic_string< E > const & | s, |
| const E | c | ||
| ) |
Crop all what follows after first occurance of character 'c'.
This is equivalent to the shell function ${s#.*c}.
| std::basic_string< E > MemCore::StringUtil::crop_before_last | ( | std::basic_string< E > const & | s, |
| const E | c | ||
| ) |
Crop all what is before last occurance of character 'c'.
This is equivalent to the shell function ${s##*c}
|
inline |
Remove some trailing text from a string.
|
inline |
Crop a prefix from some text, returning the unmodified text if not possible.
Referenced by Wizt::createVScript(), and MemCore::StringUtil::crop_prefix().
|
inline |
Crop a prefix from some text, returning the unmodified text if not possible.
References MemCore::StringUtil::crop_prefix().
|
inline |
Return the filename extension, which is the string after the last '.
' - excluding the '.' !
Referenced by VishScriptSaver::save().
|
inline |
Splitting a string using a given delimiter.
Unfortunately the STL doesn't provide any direct way to achieve this. This split implementation is templatised and uses type deduction to determine what kind of string and container are being passed as arguments, which must must be some form of basic_string<> and any container that implements the push_back() method.
Note that the string type is not fully specified, allowing the traits and allocator to default. In some situations this may not be what you want and some compilers might not like it.
FROM: http://www.codeproject.com/KB/stl/Split_string.aspx
Example code:
Referenced by Wizt::WebVish::communicate(), Wizt::ProgrammableGeometry::CompileGeometryShader(), Wizt::createVScript(), Wizt::VEnumSelection::fromString(), Wizt::CommandLineParser::getDataDirs(), Wizt::Slottify::getObjectInfo(), and MemCore::StringList::StringList().
|
inlineconstexpr |
An optimized version to construct a std::string from a static character array where the length is known.
This avoids determining the string length.
Referenced by MemCore::StringUtil::pad_left().