The Sparta Modeling Framework
|
Cool string utilities. More...
#include <cinttypes>
#include <cstring>
#include <string>
#include <sstream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <memory>
Go to the source code of this file.
Classes | |
class | sparta::utils::TransformedString< AppliedTransform > |
function LevenshteinDistance() More... | |
struct | sparta::utils::make_lowercase |
Functor for ::tolower. More... | |
struct | sparta::utils::make_uppercase |
Functor for ::toupper. More... | |
Namespaces | |
namespace | sparta |
Macros for handling exponential backoff. | |
Typedefs | |
typedef TransformedString< make_lowercase > | sparta::utils::lowercase_string |
always lowercase string data type | |
typedef TransformedString< make_uppercase > | sparta::utils::UPPERCASE_STRING |
ALWAYS UPPERCASE STRING DATA TYPE. | |
Functions | |
std::string | sparta::utils::uint64_to_hexstr (uint64_t val) |
std::string | sparta::utils::uint32_to_hexstr (uint32_t val) |
std::string | sparta::utils::uint64_to_str (uint64_t val) |
std::string | sparta::utils::uint32_to_str (uint32_t val) |
std::string | sparta::utils::int64_to_str (int64_t val) |
std::string | sparta::utils::int32_to_str (int32_t val) |
std::string | sparta::utils::bool_to_str (bool val) |
std::string | sparta::utils::bin_to_hexstr (const uint8_t *data, size_t size, const std::string &sep=" ") |
std::string | sparta::utils::bin_to_bitstr (const uint8_t *data, size_t size, const std::string &sep=" ") |
std::string | sparta::utils::eliminate_whitespace (const std::string &str) |
std::string | sparta::utils::strip_whitespace (const std::string &str) |
function eliminate_whitespace() | |
std::string | sparta::utils::strip_string_pattern (const std::string &pat, const std::string &str) |
function strip_whitespace() | |
void | sparta::utils::tokenize (const std::string &in_str, std::vector< std::string > &str_vector, const std::string &delimiters=" ") |
function strip_string_pattern() | |
void | sparta::utils::split_lines_around_tokens (std::istream &in_stream, std::vector< std::vector< std::string > > &str_vectors, const std::string &delimiters=" ", const char line_separator='\n') |
function tokenize() | |
void | sparta::utils::tokenize (const char *in_char_str, std::vector< std::string > &str_vector, const std::string &delimiters=" ") |
function split_lines_around_tokens() | |
void | sparta::utils::tokenize_strip_whitespace (const std::string &in_str, std::vector< std::string > &str_vector, const std::string &delimiters=" ") |
function tokenize() | |
void | sparta::utils::tokenize_strip_whitespace (const char *in_char_str, std::vector< std::string > &str_vector, const std::string &delimiters=" ") |
function tokenize_strip_whitespace() | |
void | sparta::utils::tokenize_on_whitespace (const std::string &in_str, std::vector< std::string > &str_vector) |
function tokenize_strip_whitespace() | |
void | sparta::utils::tokenize_on_whitespace (const char *in_char_str, std::vector< std::string > &str_vector) |
function tokenize() | |
bool | sparta::utils::strcmp_with_null (const char *s1, const char *s2) |
function tokenize() | |
uint32_t | sparta::utils::LevenshteinDistance (const char *s, size_t n, const char *t, size_t m) |
template<class AppliedTransform > | |
bool | sparta::utils::operator< (const TransformedString< AppliedTransform > &one, const TransformedString< AppliedTransform > &two) |
template<class AppliedTransform > | |
bool | sparta::utils::operator== (const std::string &one, const TransformedString< AppliedTransform > &two) |
Comparisons against std::string where the utils object is the rhs: | |
template<class AppliedTransform > | |
bool | sparta::utils::operator!= (const std::string &one, const TransformedString< AppliedTransform > &two) |
Cool string utilities.
Definition in file StringUtils.hpp.
typedef TransformedString<make_lowercase> sparta::utils::lowercase_string |
always lowercase string data type
Definition at line 494 of file StringUtils.hpp.
typedef TransformedString<make_uppercase> sparta::utils::UPPERCASE_STRING |
ALWAYS UPPERCASE STRING DATA TYPE.
Definition at line 497 of file StringUtils.hpp.
|
inline |
=========================================================================== function bin_to_bitstr()
Definition at line 125 of file StringUtils.hpp.
|
inline |
=========================================================================== function bin_to_hexstr()
Definition at line 108 of file StringUtils.hpp.
|
inline |
=========================================================================== function bool_to_str()
Definition at line 98 of file StringUtils.hpp.
|
inline |
=========================================================================== function eliminate_whitespace()
Definition at line 148 of file StringUtils.hpp.
|
inline |
=========================================================================== function int32_to_hexstr()
Definition at line 88 of file StringUtils.hpp.
|
inline |
=========================================================================== function int64_to_str()
Definition at line 77 of file StringUtils.hpp.
|
inline |
=========================================================================== function LevenshteinDistance()
A deletion
An insertion
A substitution
Definition at line 377 of file StringUtils.hpp.
|
inline |
Definition at line 523 of file StringUtils.hpp.
|
inline |
Less than comparison, so you can put these data types into ordered containers like std::set's
Definition at line 502 of file StringUtils.hpp.
|
inline |
Comparisons against std::string where the utils object is the rhs:
std::string s1(...); lowercase_string s2(...); if (s1 == s2) { ... }
Definition at line 516 of file StringUtils.hpp.
|
inline |
function tokenize()
=========================================================================== function split_lines_around_tokens()
Definition at line 248 of file StringUtils.hpp.
|
inline |
function tokenize()
=========================================================================== function strcmp_with_null()
Definition at line 355 of file StringUtils.hpp.
|
inline |
function strip_whitespace()
=========================================================================== function strip_string_pattern()
Look for the pattern at the beginning of the string
It's at the beginning...
Look for the pattern at the end of the string
Found the beginning one OR we found a match NOT at the end
Definition at line 177 of file StringUtils.hpp.
|
inline |
function eliminate_whitespace()
=========================================================================== function strip_whitespace()
Definition at line 160 of file StringUtils.hpp.
|
inline |
function split_lines_around_tokens()
=========================================================================== function tokenize()
Copy char * into a string
Definition at line 269 of file StringUtils.hpp.
|
inline |
function strip_string_pattern()
=========================================================================== function tokenize()
Definition at line 211 of file StringUtils.hpp.
|
inline |
function tokenize()
=========================================================================== function tokenize_on_whitespace()
Copy char * into a string
Definition at line 343 of file StringUtils.hpp.
|
inline |
function tokenize_strip_whitespace()
=========================================================================== function tokenize_on_whitespace()
Definition at line 318 of file StringUtils.hpp.
|
inline |
function tokenize_strip_whitespace()
=========================================================================== function tokenize_strip_whitespace()
Copy char * into a string
Definition at line 303 of file StringUtils.hpp.
|
inline |
function tokenize()
=========================================================================== function tokenize_strip_whitespace()
Definition at line 282 of file StringUtils.hpp.
|
inline |
=========================================================================== function uint32_to_hexstr()
Definition at line 44 of file StringUtils.hpp.
|
inline |
=========================================================================== function uint32_to_hexstr()
Definition at line 67 of file StringUtils.hpp.
|
inline |
=========================================================================== function uint64_to_hexstr()
Definition at line 30 of file StringUtils.hpp.
|
inline |
=========================================================================== function uint64_to_str()
Definition at line 56 of file StringUtils.hpp.