arsenalgear-cpp
A library containing general purpose C++ utils.
|
Classes | |
class | savebuf |
Class used to store the output sent to an output stream. More... | |
struct | select_cout |
Struct used to define a way to template the choice of the "std::cout" object in order to be "std::cout" for "char" type or "std::wcout" for "wchar_t" type. More... | |
struct | select_cin |
Struct used to define a way to template the choice of the "std::cin" object in order to be "std::cin" for "char" type or "std::wcin" for "wchar_t" type. More... | |
struct | is_streamable |
Struct used to check if a type is a streamable or not, i.e. it has operator << overload or not. More... | |
struct | is_streamable< S, T, std::void_t< decltype(std::declval< S & >()<< std::declval< T >()) > > |
Enumerations | |
enum class | ANSI { first , generic } |
Functions | |
std::string | getCommandOut (const char *command) |
Function used to get the output of a shell command. More... | |
std::string | multi (const std::string &element, unsigned int n_times) |
Function used to multiply a string for n times. More... | |
std::vector< std::string > | split_string (const std::string &input, const std::string ®ex) |
Function used to split a string based on a certain reges. More... | |
template<typename TK , typename TV > | |
std::vector< TK > | extract_map_keys (std::map< TK, TV > const &input_map) |
Function used to extract a vector of keys from a map. More... | |
template<typename TK , typename TV > | |
std::vector< TV > | extract_map_elem (std::map< TK, TV > const &input_map) |
Function used to extract a vector of elements from a map. More... | |
template<typename T > | |
T | roundoff (T value, unsigned char prec) |
Function to round a floating point to n-th decimal place after comma. More... | |
template<typename T > | |
bool | IsInBounds (T value, T low, T high) |
Function to check if a number lies in a certain bound or not. More... | |
template<typename T , std::size_t N> | |
constexpr bool | is_pointer_to_const_char (T(&)[N]) |
Function used to check if an input array is a pointer to const char. More... | |
template<typename T > | |
constexpr bool | is_pointer_to_const_char (T &&) |
Function used to check if an input variable is a pointer to const char. More... | |
template<class T > | |
constexpr bool | is_str (const T &obj) |
Function used to check if a variable is a string object (std::string, const char*, etc...). More... | |
template<typename Kind , typename... Kinds> | |
bool | is_any () |
Function used to check if a type is in a list or not. More... | |
template<typename T_err = std::runtime_error> | |
T_err | except_error_func (const std::string &beg="", std::string var=nullptr, const std::string &end="") |
Function used to throw customized stdexception error. This function is extremely specific to my purposes and you can find examples usages in other my projects lik "osmanip" or "SAFD-algorithm". More... | |
template<typename T > | |
bool | isFloatingPoint (const T &) |
Function to check if an expression (not a type) is a floating point or not. I know this function is almost useless, but it has been created for lazy purposes and since it is used in other projects it cannot be eliminated now in order to not break backward compatibility. More... | |
template<typename T > | |
T | one (const T &iterating_var) |
Function to find the incremented unit of a loop. Not easy to understand its purpose without context, but it is used to get the loop incremented unit in case of loops with floating-point indexes. See example usage in "osmanip" in progress bars "update" method. More... | |
template<class CharT > | |
std::conditional_t< std::is_same_v< CharT, char >, const std::basic_string< CharT > &, std::basic_string< CharT > > | StringConverter (const std::string &input_str) |
Function used to convert an std::string into other string types (std::wstring etc...). If the argument is an std::string it will be returned without any modification. More... | |
template<typename T > | |
bool | is_escape (const T &str, const ANSI &flag) |
This method is used to check if an input variable is an ANSI escape sequency or not. More... | |
Variables | |
template<typename T > | |
const T | null_str = "" |
The string used to represent the null value. More... | |
template<typename T > | |
const T | empty_space = " " |
The string used to represent the empty space. More... | |
|
strong |
|
inline |
Function used to throw customized stdexception error. This function is extremely specific to my purposes and you can find examples usages in other my projects lik "osmanip" or "SAFD-algorithm".
T_err | The type of the exception error. |
beg | The first part of the error message. |
var | The variable to be inserted in the error message. |
end | The last part of the error message. |
|
inline |
Function used to extract a vector of elements from a map.
TK | Template parameter of the map key. |
TV | Template parameter of the map element. |
input_map | The input map. |
|
inline |
Function used to extract a vector of keys from a map.
TK | Template parameter of the map key. |
TV | Template parameter of the map element. |
input_map | The input map. |
std::string agr::getCommandOut | ( | const char * | command | ) |
Function used to get the output of a shell command.
command | The command which output is required. |
bool agr::is_any | ( | ) |
Function used to check if a type is in a list or not.
Kind | The type to be checked. |
Kinds | The types to which the type is compared. |
bool agr::is_escape | ( | const T & | str, |
const ANSI & | flag | ||
) |
This method is used to check if an input variable is an ANSI escape sequency or not.
T | Template type of the input variable. |
str | The input variable. |
flag | A flag which let to return different things with respect to its value. If flag = ANSI::first the ANSI is searched as the first substring of the str argument, otherwise, if flag = ANSI::generic the ANSI is searched as a substring inside the str argument. |
|
constexpr |
Function used to check if an input variable is a pointer to const char.
T | The input variable to be check. |
|
constexpr |
Function used to check if an input array is a pointer to const char.
T | The input array to be check. |
N | The dimension of the array. |
|
constexpr |
Function used to check if a variable is a string object (std::string, const char*, etc...).
T | The type of the input variable. |
obj | The input variable. |
|
inline |
Function to check if an expression (not a type) is a floating point or not. I know this function is almost useless, but it has been created for lazy purposes and since it is used in other projects it cannot be eliminated now in order to not break backward compatibility.
T | The type of the expression. |
|
inline |
Function to check if a number lies in a certain bound or not.
T | The Type of the variable to be checked. |
value | The variable to be checked. |
low | The lower bound. |
high | The upper bound. |
std::string agr::multi | ( | const std::string & | element, |
unsigned int | n_times | ||
) |
Function used to multiply a string for n times.
element | The string to be multiplied. |
n_times | The times for the string multiplication. |
|
inline |
Function to find the incremented unit of a loop. Not easy to understand its purpose without context, but it is used to get the loop incremented unit in case of loops with floating-point indexes. See example usage in "osmanip" in progress bars "update" method.
T | The type of the iterating variable of the loop. |
iterating_var | The iterating variable of the loop. |
|
inline |
Function to round a floating point to n-th decimal place after comma.
T | The Type of the variable to be rounded. |
value | The variable to be rounded |
prec | Precision of the rounding. |
std::vector< std::string > agr::split_string | ( | const std::string & | input, |
const std::string & | regex | ||
) |
Function used to split a string based on a certain reges.
input | The input string. |
regex | The regex. |
std::conditional_t<std::is_same_v<CharT, char>, const std::basic_string<CharT>&, std::basic_string<CharT> > agr::StringConverter | ( | const std::string & | input_str | ) |
Function used to convert an std::string into other string types (std::wstring etc...). If the argument is an std::string it will be returned without any modification.
CharT | The char type (char, wchar_t...) to which the string is converted.. |
input_str | The input std::string object. |
|
inline |
The string used to represent the empty space.
|
inline |
The string used to represent the null value.