201 lines
6.9 KiB
C++
201 lines
6.9 KiB
C++
// =====================================================================================================================
|
|
// fennec, a free and open source game engine
|
|
// Copyright © 2025 - 2026 Medusa Slockbower
|
|
//
|
|
// This program is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// This program is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
// =====================================================================================================================
|
|
|
|
///
|
|
/// \file fennec/format/charconv.h
|
|
/// \brief
|
|
///
|
|
///
|
|
/// \details
|
|
/// \author Medusa Slockbower
|
|
///
|
|
/// \copyright Copyright © 2025 - 2026 Medusa Slockbower ([GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html))
|
|
///
|
|
///
|
|
|
|
#ifndef FENNEC_FORMAT_CHARCONV_H
|
|
#define FENNEC_FORMAT_CHARCONV_H
|
|
|
|
namespace fennec
|
|
{
|
|
|
|
///
|
|
/// \param first the start of the buffer
|
|
/// \param last the end of the buffer
|
|
/// \param x the value to write
|
|
/// \param base the base to interpret the integer as
|
|
/// \returns a pointer to one past the last written character
|
|
char* to_chars(char* first, char* last, char x, int base);
|
|
|
|
///
|
|
/// \param first the start of the buffer
|
|
/// \param last the end of the buffer
|
|
/// \param x the value to write
|
|
/// \param base the base to interpret the integer as
|
|
/// \returns a pointer to one past the last written character
|
|
char* to_chars(char* first, char* last, signed char x, int base);
|
|
|
|
///
|
|
/// \param first the start of the buffer
|
|
/// \param last the end of the buffer
|
|
/// \param x the value to write
|
|
/// \param base the base to interpret the integer as
|
|
/// \returns a pointer to one past the last written character
|
|
char* to_chars(char* first, char* last, unsigned char x, int base);
|
|
|
|
///
|
|
/// \param first the start of the buffer
|
|
/// \param last the end of the buffer
|
|
/// \param x the value to write
|
|
/// \param base the base to interpret the integer as
|
|
/// \returns a pointer to one past the last written character
|
|
char* to_chars(char* first, char* last, signed short x, int base);
|
|
|
|
///
|
|
/// \param first the start of the buffer
|
|
/// \param last the end of the buffer
|
|
/// \param x the value to write
|
|
/// \param base the base to interpret the integer as
|
|
/// \returns a pointer to one past the last written character
|
|
char* to_chars(char* first, char* last, unsigned short x, int base);
|
|
|
|
|
|
///
|
|
/// \param first the start of the buffer
|
|
/// \param last the end of the buffer
|
|
/// \param x the value to write
|
|
/// \param base the base to interpret the integer as
|
|
/// \returns a pointer to one past the last written character
|
|
char* to_chars(char* first, char* last, signed int x, int base);
|
|
|
|
///
|
|
/// \param first the start of the buffer
|
|
/// \param last the end of the buffer
|
|
/// \param x the value to write
|
|
/// \param base the base to interpret the integer as
|
|
/// \returns a pointer to one past the last written character
|
|
char* to_chars(char* first, char* last, unsigned int x, int base);
|
|
|
|
|
|
///
|
|
/// \param first the start of the buffer
|
|
/// \param last the end of the buffer
|
|
/// \param x the value to write
|
|
/// \param base the base to interpret the integer as
|
|
/// \returns a pointer to one past the last written character
|
|
char* to_chars(char* first, char* last, signed long x, int base);
|
|
|
|
///
|
|
/// \param first the start of the buffer
|
|
/// \param last the end of the buffer
|
|
/// \param x the value to write
|
|
/// \param base the base to interpret the integer as
|
|
/// \returns a pointer to one past the last written character
|
|
char* to_chars(char* first, char* last, unsigned long x, int base);
|
|
|
|
|
|
///
|
|
/// \param first the start of the buffer
|
|
/// \param last the end of the buffer
|
|
/// \param x the value to write
|
|
/// \param base the base to interpret the integer as
|
|
/// \returns a pointer to one past the last written character
|
|
char* to_chars(char* first, char* last, signed long long x, int base);
|
|
|
|
///
|
|
/// \param first the start of the buffer
|
|
/// \param last the end of the buffer
|
|
/// \param x the value to write
|
|
/// \param base the base to interpret the integer as
|
|
/// \returns a pointer to one past the last written character
|
|
char* to_chars(char* first, char* last, unsigned long long x, int base);
|
|
|
|
|
|
///
|
|
/// \param first the start of the buffer
|
|
/// \param last the end of the buffer
|
|
/// \param x the value to write
|
|
/// \param base the base to interpret the integer as
|
|
/// \returns a pointer to one past the last written character
|
|
char* to_chars(char* first, char* last, signed long long x, int base);
|
|
|
|
///
|
|
/// \brief integer to ascii
|
|
/// \param first the start of the buffer
|
|
/// \param last the end of the buffer
|
|
/// \param x the value to write
|
|
/// \param base the base to interpret the integer as
|
|
/// \returns a pointer to one past the last written character
|
|
char* to_chars(char* first, char* last, unsigned long long x, int base);
|
|
|
|
|
|
///
|
|
/// \param first the start of the buffer
|
|
/// \param last the end of the buffer
|
|
/// \param x the value to write
|
|
/// \returns a pointer to one past the last written character
|
|
char* to_chars(char* first, char* last, float x);
|
|
|
|
///
|
|
/// \param first the start of the buffer
|
|
/// \param last the end of the buffer
|
|
/// \param x the value to write
|
|
/// \param fmt the float string format to use
|
|
/// \returns a pointer to one past the last written character
|
|
char* to_chars(char* first, char* last, float x, char fmt);
|
|
|
|
///
|
|
/// \brief float to ascii
|
|
/// \param first the start of the buffer
|
|
/// \param last the end of the buffer
|
|
/// \param x the value to write
|
|
/// \param fmt the float string format to use
|
|
/// \param precision the number of decimal places to write
|
|
/// \returns a pointer to one past the last written character
|
|
char* to_chars(char* first, char* last, float x, char fmt, int precision);
|
|
|
|
|
|
///
|
|
/// \param first the start of the buffer
|
|
/// \param last the end of the buffer
|
|
/// \param x the value to write
|
|
/// \returns a pointer to one past the last written character
|
|
char* to_chars(char* first, char* last, double x);
|
|
|
|
///
|
|
/// \param first the start of the buffer
|
|
/// \param last the end of the buffer
|
|
/// \param x the value to write
|
|
/// \param fmt the float string format to use
|
|
/// \returns a pointer to one past the last written character
|
|
char* to_chars(char* first, char* last, double x, char fmt);
|
|
|
|
///
|
|
/// \brief float to ascii
|
|
/// \param first the start of the buffer
|
|
/// \param last the end of the buffer
|
|
/// \param x the value to write
|
|
/// \param fmt the float string format to use
|
|
/// \param precision the number of decimal places to write
|
|
/// \returns a pointer to one past the last written character
|
|
char* to_chars(char* first, char* last, double x, char fmt, int precision);
|
|
|
|
|
|
}
|
|
|
|
#endif // FENNEC_FORMAT_CHARCONV_H
|