#ifndef ARGPARSE_UTIL_HPP #define ARGPARSE_UTIL_HPP #include #include #include #include #include namespace argparse { class Argument; //Splits off the leading dashes of a string, returning the dashes (index 0) //and the rest of the string (index 1) std::array split_leading_dashes(std::string str); //Converts a string to upper case std::string toupper(std::string str); //Converts a string to lower case std::string tolower(std::string str); //Returns true if str represents a named argument starting with //'-' or '--' followed by one or more letters bool is_argument(std::string str, const std::map>& arg_map); //Returns true if str is in choices, or choices is empty bool is_valid_choice(std::string str, const std::vector& choices); //Returns 'str' interpreted as type T // Throws an exception if conversion fails template T as(std::string str); template std::string join(Container container, std::string join_str); char* strdup(const char* str); std::vector wrap_width(std::string str, size_t width, std::vector split_str={" ", "/"}); std::string basename(std::string filepath); } //namespace #include "argparse_util.tpp" #endif