diff options
author | HampusM <hampus@hampusmat.com> | 2022-03-14 10:24:36 +0100 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-03-14 10:24:36 +0100 |
commit | a119e6ca70ffab14f0a70908fa3eeb83b41bb5ab (patch) | |
tree | 51b72774694f5e1aac0bb17fc1a5e528dbad9b44 /src/common/conversion.hpp | |
parent | 6b5754655f78a7f93b756ff902ce9fd80d9dc4ec (diff) |
refactor: rename std to common
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 |