Tools Methods

A set of useful tools in constructing the framework. To use the class, include the following header in your project.

#include <tools/tools.h>
class tools
tools()
~tools()
void create_path(std::string path)

Creates a new folder path.

void delete_path(std::string path)

Deletes the specifies file directory.

bool is_file(std::string path)

Checks if the given path is a file.

std::string absolute_path(std::string path)

Returns the absolute path.

std::vector<std::string> ls(std::string path, std::string ext = "")

Returns the directory of the given input path, or only returns files with the specified extension.

std::string to_string(double val)

Converts the value as a string.

std::string to_string(double val, int prec)

Converts the value as a string with given precision.

void replace(std::string *in, std::string repl_str, std::string repl_with)
bool has_string(std::string *inpt, std::string trg)
bool ends_with(std::string *inpt, std::string val)
bool has_value(std::vector<std::string> *data, std::string trg)
std::vector<std::string> split(std::string in, std::string delim)
std::vector<std::string> split(std::string in, int n)
std::string hash(std::string input, int len = 18)
std::string lower(std::string*)
std::string encode64(unsigned char const*, unsigned int len)
std::string decode64(std::string *inpt)
std::string decode64(std::string const &s)
template<typename G>
std::vector<std::vector<G>> discretize(std::vector<G> *v, int N)
template<typename g>
g max(std::vector<g> *inpt)
template<typename g>
g min(std::vector<g> *inpt)
template<typename g>
g sum(std::vector<g> *inpt)