Sokoban
Functions
MyTools Namespace Reference

Namespace which contains utility functions which are used from more classes in the project. More...

Functions

void split (const std::string &s, char separator, std::vector< std::string > &elems)
 Splits string according to the separator. More...
 
int str_to_int (const std::string &str)
 Converts string to integer. More...
 
void sec_to_string_stream (uint64_t sec, std::stringstream &ss)
 Converts seconds to hh:mm:ss format and writes it to a strigstream. More...
 

Detailed Description

Namespace which contains utility functions which are used from more classes in the project.

Function Documentation

◆ sec_to_string_stream()

void MyTools::sec_to_string_stream ( uint64_t  sec,
std::stringstream &  ss 
)
inline

Converts seconds to hh:mm:ss format and writes it to a strigstream.

Parameters
secSeconds.
ssReference to the stringstream which is function writes to.

◆ split()

void MyTools::split ( const std::string &  s,
char  separator,
std::vector< std::string > &  elems 
)
inline

Splits string according to the separator.

Parameters
sReference to the input string which is splitted.
separatorSeparator.
elemsReference to the list of string which represents parsed input.

◆ str_to_int()

int MyTools::str_to_int ( const std::string &  str)
inline

Converts string to integer.

If string is not convertible to int exception is thrown.

Parameters
strString which should be converted to int.
Exceptions
std::invalid_argumentNumber is out of range or string is not convertible to int.
Returns
integer value