Babel  1
The voip software that only works on your local network
Loading...
Searching...
No Matches
Recoded Namespace Reference

Functions

const std::string myToString (bool value)
 Converts a boolean value to its string representation.
 
template<typename T >
const std::string myToString (const T &value)
 Converts a numeric value to its string representation.
 
template<typename T1 , typename T2 >
const std::string myToString (const std::pair< T1, T2 > &value)
 Converts a std::pair to its string representation.
 
template<typename Key , typename Value >
std::string myToString (const std::map< Key, Value > &map)
 Converts a std::map to a string representation.
 
template<typename T >
std::string myToString (const std::set< T > &set)
 Converts a std::set to a string representation.
 
template<typename T >
const std::string myToString (const std::vector< T > &set)
 Converts a std::vector to a string representation.
 
template<typename Key , typename Value >
std::string myToString (const std::unordered_map< Key, Value > &map)
 Converts a std::unordered_map to a string representation.
 
template<typename T >
const std::string myToString (const std::unordered_set< T > &set)
 Converts a std::unordered_set to a string representation.
 

Function Documentation

◆ myToString() [1/8]

const std::string Recoded::myToString ( bool value)

Converts a boolean value to its string representation.

Unlike std::to_string, which converts true to "1" and false to "0", this function returns "true" for true and "false" for false.

Parameters
valueThe boolean value to convert.
Returns
A string representation of the boolean ("true" or "false").
Note
Uses Recoded::myToString to convert elements to strings.
Parameters
valueThe boolean value to convert.
Returns
"true" if the value is true, otherwise "false".

Definition at line 22 of file ToString.cpp.

◆ myToString() [2/8]

template<typename Key , typename Value >
std::string Recoded::myToString ( const std::map< Key, Value > & map)

Converts a std::map to a string representation.

This function iterates over the key-value pairs of a std::map and generates a string in the format: ‘{ 'key1’ : 'value1', 'key2' : 'value2', ... }`.

Template Parameters
KeyThe type of the keys in the map.
ValueThe type of the values in the map.
Parameters
mapThe map to be converted to a string.
Returns
A string representing the map.
Note
Uses Recoded::myToString to convert keys and values to strings.

Definition at line 109 of file ToString.hpp.

◆ myToString() [3/8]

template<typename T1 , typename T2 >
const std::string Recoded::myToString ( const std::pair< T1, T2 > & value)

Converts a std::pair to its string representation.

This function formats the std::pair as ( x: <first>, y: <second> ), where <first> and <second> are the string representations of the pair's elements. The elements' string representations are generated using myToString.

Example:

std::pair<int, int> p = {1, 2};
std::cout << myToString(p); // Output: ( x: 1, y: 2 )
const std::string myToString(bool value)
Converts a boolean value to its string representation.
Definition ToString.cpp:22
Template Parameters
T1The type of the first element in the pair.
T2The type of the second element in the pair.
Parameters
valueThe pair to convert.
Returns
A string representation of the pair in the format ( x: <first>, y: <second> ).
Note
Uses Recoded::myToString to convert elements to strings.

Definition at line 87 of file ToString.hpp.

◆ myToString() [4/8]

template<typename T >
std::string Recoded::myToString ( const std::set< T > & set)

Converts a std::set to a string representation.

This function iterates over the elements of a std::set and generates a string in the format: ‘{ 'element1’, 'element2', ... }`.

Template Parameters
TThe type of the elements in the set.
Parameters
setThe set to be converted to a string.
Returns
A string representing the set.
Note
Uses Recoded::myToString to convert elements to strings.

Definition at line 137 of file ToString.hpp.

◆ myToString() [5/8]

template<typename Key , typename Value >
std::string Recoded::myToString ( const std::unordered_map< Key, Value > & map)

Converts a std::unordered_map to a string representation.

This function iterates over the key-value pairs of a std::unordered_map and generates a string in the format: ‘{ 'key1’ : 'value1', 'key2' : 'value2', ... }`.

Template Parameters
KeyThe type of the keys in the unordered map.
ValueThe type of the values in the unordered map.
Parameters
mapThe unordered map to be converted to a string.
Returns
A string representing the unordered map.
Note
Uses Recoded::myToString to convert keys and values to strings.

Definition at line 193 of file ToString.hpp.

◆ myToString() [6/8]

template<typename T >
const std::string Recoded::myToString ( const std::unordered_set< T > & set)

Converts a std::unordered_set to a string representation.

This function iterates over the elements of a std::unordered_set and generates a string in the format: ‘{ 'element1’, 'element2', ... }`.

Template Parameters
TThe type of the elements in the unordered set.
Parameters
setThe unordered set to be converted to a string.
Returns
A string representing the unordered set.
Note
Uses Recoded::myToString to convert elements to strings.

Definition at line 221 of file ToString.hpp.

◆ myToString() [7/8]

template<typename T >
const std::string Recoded::myToString ( const std::vector< T > & set)

Converts a std::vector to a string representation.

This function iterates over the elements of a std::vector and generates a string in the format: ‘[ 'element1’, 'element2', ... ]`.

Template Parameters
TThe type of the elements in the vector.
Parameters
vecThe vector to be converted to a string.
Returns
A string representing the vector.
Note
Uses Recoded::myToString to convert elements to strings.

Definition at line 164 of file ToString.hpp.

◆ myToString() [8/8]

template<typename T >
const std::string Recoded::myToString ( const T & value)

Converts a numeric value to its string representation.

This function is a wrapper around std::to_string and supports all types for which std::to_string is valid. It is intended for general use with numeric types like int, float, double, etc.

Template Parameters
TThe type of the value to convert. Must be a numeric type.
Parameters
valueThe value to convert.
Returns
A string representation of the numeric value.
Note
Uses Recoded::myToString to convert elements to strings.

Definition at line 59 of file ToString.hpp.