From a119e6ca70ffab14f0a70908fa3eeb83b41bb5ab Mon Sep 17 00:00:00 2001 From: HampusM Date: Mon, 14 Mar 2022 10:24:36 +0100 Subject: refactor: rename std to common --- src/common/conversion.hpp | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/common/conversion.hpp (limited to 'src/common/conversion.hpp') 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 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 intToStr(int num); + +/** + * Converts a unsigned integer to a string. + * + * @param num A number + * @returns The number as a string. + */ +common::UniquePtr uintToStr(unsigned int num); + +} // namespace common -- cgit v1.2.3-18-g5258