diff options
Diffstat (limited to 'src/common/conversion.hpp')
-rw-r--r-- | src/common/conversion.hpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/common/conversion.hpp b/src/common/conversion.hpp new file mode 100644 index 0000000..81a4a52 --- /dev/null +++ b/src/common/conversion.hpp @@ -0,0 +1,36 @@ +#pragma once + +#include "common/memory.hpp" +#include "common/string.hpp" + +namespace common +{ + +/** + * Converts a double number to a string. + * + * @param num A double number + * @param width The desired double width + * @param precision The desired double precision + * @returns The double as a string. + */ +common::UniquePtr<common::String> doubleToStr(double num, unsigned int width = 3, + unsigned int precision = 2); + +/** + * Converts a integer to a string. + * + * @param num A number + * @returns The number as a string. + */ +common::UniquePtr<common::String> intToStr(int num); + +/** + * Converts a unsigned integer to a string. + * + * @param num A number + * @returns The number as a string. + */ +common::UniquePtr<common::String> uintToStr(unsigned int num); + +} // namespace common |