osmanip
Library with useful output stream tools like: color and style manipulators, progress bars and terminal graphics.
Namespaces | Macros | Enumerations | Functions | Variables
generic.hpp File Reference
#include <cmath>
#include <cstdlib>
#include <sstream>
#include <stdexcept>
#include <string>
#include <string_view>
#include <type_traits>
#include <vector>
Include dependency graph for generic.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 osm
 

Macros

#define OSMANIP_UTILITY_GENERIC_HPP
 

Enumerations

enum class  osm::ANSI_SEARCH { osm::first , osm::generic }
 

Functions

std::vector< std::string > osm::split_string (const std::string &input, const std::string &regex)
 Function used to split a string based on a certain reges. More...
 
std::string osm::getCommandOut (const char *command)
 Function used to get the output of a shell command. More...
 
template<typename T_err = std::runtime_error>
T_err osm::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 osm::is_escape (const T &str, const ANSI_SEARCH &flag)
 This method is used to check if an input variable is an ANSI escape sequency or not. More...
 
template<typename T >
osm::roundoff (T value, unsigned char prec)
 Function to round a floating point to n-th decimal place after comma. More...
 
template<typename T >
bool osm::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 >
osm::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 progress bars "update" method. More...
 
std::string operator* (const std::string &generic_string, unsigned int integer)
 Function to multiply a string by an integer. More...
 

Variables

template<typename T >
const T osm::null_str = ""
 
template<typename T >
const T osm::empty_space = " "
 

Detailed Description

Author
Gianluca Bianco (bianc.nosp@m.ogia.nosp@m.nluca.nosp@m.9@gm.nosp@m.ail.c.nosp@m.om)
Date
2023-07-25

Macro Definition Documentation

◆ OSMANIP_UTILITY_GENERIC_HPP

#define OSMANIP_UTILITY_GENERIC_HPP

Function Documentation

◆ operator*()

std::string operator* ( const std::string &  generic_string,
unsigned int  integer 
)
inline

Function to multiply a string by an integer.

Parameters
generic_stringThe string to be multiplied.
integerThe integer to be multiplied.
Returns
std::string The multiplied string.