Audacity  3.0.3
ToChars.h
Go to the documentation of this file.
1 /*!********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  @file ToChars.h
6  @brief Declare functions to convert numeric types to string representation.
7 
8  Dmitry Vedenko
9  **********************************************************************/
10 
11 #pragma once
12 
13 #include <system_error>
14 
16 struct STRING_UTILS_API ToCharsResult final
17 {
18  char* ptr;
19  std::errc ec;
20 };
21 
23 STRING_UTILS_API ToCharsResult ToChars(
24  char* buffer, char* last, float value,
25  int digitsAfterDecimalPoint = -1) noexcept;
26 
28 STRING_UTILS_API ToCharsResult ToChars(
29  char* buffer, char* last, double value,
30  int digitsAfterDecimalPoint = -1) noexcept;
31 
33 STRING_UTILS_API ToCharsResult ToChars(char* buffer, char* last, long long value) noexcept;
35 STRING_UTILS_API ToCharsResult ToChars(char* buffer, char* last, unsigned long long value) noexcept;
ToCharsResult::ptr
char * ptr
Definition: ToChars.h:18
ToCharsResult
Result of the conversion, similar to std::to_chars_result.
Definition: ToChars.h:17
ToCharsResult::ec
std::errc ec
A pointer to the last updated character, or last on failure.
Definition: ToChars.h:19
ToChars
STRING_UTILS_API ToCharsResult ToChars(char *buffer, char *last, float value, int digitsAfterDecimalPoint=-1) noexcept
Convert a single precision floating point number to a string, always uses the dot as decimal.
Definition: ToChars.cpp:1225