sources/modules/aux_sys.cpp file

implements File class, i/o functions and string operations

Functions

void conditional_append(const std::string& filename, const std::string& line)
append line to the text file filename, unless this line already exists in the file
auto file_to_string(const std::string& fname) -> std::string
reads in a file as a string
auto fill_front(const std::string& s, const std::string& max) -> std::string
adds whitespace to the front of a string s such that its length becomes equal to max
auto html_header(const File& file) -> std::string
defines header of html files
auto html_navigation_title(const File& file) -> std::string
main heading of the html pages allowing to navigate in the file structure
void html_summary(const File& file)
recompiles all html files linking to the file file
auto my_alpha_num(const std::string& s) -> bool
true if all characters are alphanumeric or _ or -
void replace_all(std::string& input, const std::string& s_old, const std::string& s_new)
replaces all occurences of s_old in input as s_new.
auto spin(const size_t& counter) -> std::string
status indicator (working)
auto stringL(const std::list<unsigned int>& LList) -> template std::string
template specialization of stringL() for unsigned int STL lists
auto stringL(const std::vector<bool>& LList) -> template std::string
template specialization of stringL() for bool STL vectors
auto stringL(const std::vector<int>& LList) -> template std::string
template specialization of stringL() for int STL vectors
auto stringL(const std::vector<long>& LList) -> template std::string
template specialization of stringL() for long STL vectors
auto stringL(const std::vector<unsigned int>& LList) -> template std::string
template specialization of stringL() for unsigned int STL vectors
auto stringL(const std::vector<unsigned long>& LList) -> template std::string
template specialization of stringL() for unsigned long STL vectors
template<typename T>
auto stringL(const T& List) -> std::string
string representative of a list of elements
auto stringLL(const std::vector<std::vector<bool>>& LList) -> template std::string
template specialization of stringLL() for bool STL vectors
auto stringLL(const std::vector<std::vector<unsigned int>>& LList) -> template std::string
template specialization of stringLL() for unsigned int STL vectors
template<typename T>
auto stringLL(const T& LList) -> std::string
string representative of a list of list of elements
auto time_to_string(const std::chrono::milliseconds& duration) -> std::string
convert time to a string indicating ms, s, min, h, as appropriate
void to_html(const File& file)
compiles a html file of all information that has ever been computed for the file file
auto to_percentage(const size_t& p, const size_t& q) -> std::string
converts fraction p/q with $0\leq p<q$ to percentage
auto to_string(const bool& b) -> std::string
converts boolean value into string
auto version_compare(const std::string& s1, const std::string& s2) -> bool
comparison operator that interprets substrings of consecutive digits as integers before doing the comparison;
auto yes_no_dialogue(const std::string& message) -> bool
prints message in terminal and accepts a yes/no no answer from the user

Function documentation

bool version_compare(const std::string& s1, const std::string& s2)

comparison operator that interprets substrings of consecutive digits as integers before doing the comparison;

Inspired by the command line tool sort --version-sort.