CLI11 2.2.0
Loading...
Searching...
No Matches
StringTools.hpp File Reference
#include <algorithm>
#include <iomanip>
#include <locale>
#include <sstream>
#include <stdexcept>
#include <string>
#include <type_traits>
#include <vector>
Include dependency graph for StringTools.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  CLI
 
namespace  CLI::enums
 
namespace  CLI::detail
 

Functions

template<typename T , typename = typename std::enable_if<std::is_enum<T>::value>::type>
std::ostream & CLI::enums::operator<< (std::ostream &in, const T &item)
 output streaming for enumerations
 
std::vector< std::string > CLI::detail::split (const std::string &s, char delim)
 Split a string by a delim.
 
template<typename T >
std::string CLI::detail::join (const T &v, std::string delim=",")
 Simple function to join a string.
 
template<typename T , typename Callable , typename = typename std::enable_if<!std::is_constructible<std::string, Callable>::value>::type>
std::string CLI::detail::join (const T &v, Callable func, std::string delim=",")
 Simple function to join a string from processed elements.
 
template<typename T >
std::string CLI::detail::rjoin (const T &v, std::string delim=",")
 Join a string in reverse order.
 
std::string & CLI::detail::ltrim (std::string &str)
 Trim whitespace from left of string.
 
std::string & CLI::detail::ltrim (std::string &str, const std::string &filter)
 Trim anything from left of string.
 
std::string & CLI::detail::rtrim (std::string &str)
 Trim whitespace from right of string.
 
std::string & CLI::detail::rtrim (std::string &str, const std::string &filter)
 Trim anything from right of string.
 
std::string & CLI::detail::trim (std::string &str)
 Trim whitespace from string.
 
std::string & CLI::detail::trim (std::string &str, const std::string filter)
 Trim anything from string.
 
std::string CLI::detail::trim_copy (const std::string &str)
 Make a copy of the string and then trim it.
 
std::string & CLI::detail::remove_quotes (std::string &str)
 remove quotes at the front and back of a string either '"' or '\''
 
std::string CLI::detail::fix_newlines (const std::string &leader, std::string input)
 
std::string CLI::detail::trim_copy (const std::string &str, const std::string &filter)
 Make a copy of the string and then trim it, any filter string can be used (any char in string is filtered)
 
std::ostream & CLI::detail::format_help (std::ostream &out, std::string name, const std::string &description, std::size_t wid)
 Print a two part "help" string.
 
std::ostream & CLI::detail::format_aliases (std::ostream &out, const std::vector< std::string > &aliases, std::size_t wid)
 Print subcommand aliases.
 
template<typename T >
bool CLI::detail::valid_first_char (T c)
 
template<typename T >
bool CLI::detail::valid_later_char (T c)
 Verify following characters of an option.
 
bool CLI::detail::valid_name_string (const std::string &str)
 Verify an option/subcommand name.
 
bool CLI::detail::valid_alias_name_string (const std::string &str)
 Verify an app name.
 
bool CLI::detail::is_separator (const std::string &str)
 check if a string is a container segment separator (empty or "%%")
 
bool CLI::detail::isalpha (const std::string &str)
 Verify that str consists of letters only.
 
std::string CLI::detail::to_lower (std::string str)
 Return a lower case version of a string.
 
std::string CLI::detail::remove_underscore (std::string str)
 remove underscores from a string
 
std::string CLI::detail::find_and_replace (std::string str, std::string from, std::string to)
 Find and replace a substring with another substring.
 
bool CLI::detail::has_default_flag_values (const std::string &flags)
 check if the flag definitions has possible false flags
 
void CLI::detail::remove_default_flag_values (std::string &flags)
 
std::ptrdiff_t CLI::detail::find_member (std::string name, const std::vector< std::string > names, bool ignore_case=false, bool ignore_underscore=false)
 Check if a string is a member of a list of strings and optionally ignore case or ignore underscores.
 
template<typename Callable >
std::string CLI::detail::find_and_modify (std::string str, std::string trigger, Callable modify)
 
 CLI::detail::trim (str)
 
 CLI::detail::while (!str.empty())
 
std::size_t CLI::escape_detect (std::string &str, std::size_t offset)
 
std::string & CLI::add_quotes_if_needed (std::string &str)
 Add quotes if the string contains spaces.
 

Variables

constexpr int CLI::detail::expected_max_vector_size {1 << 29}
 
auto CLI::detail::find_ws
 
std::vector< std::string > CLI::detail::output
 
bool CLI::detail::embeddedQuote = false
 
char CLI::detail::keyChar = ' '