# ConversionUtils.hpp
This File On Github
Ask A Question
API: latest
module: oatpp
#include "oatpp/core/utils/ConversionUtils.hpp"
# strToInt32
Namespace: oatpp::utils::conversion
- String to 32-bit integer.
- @param str - string as
const char*
. - @return - 32-bit integer value.
v_int32 strToInt32(const char* str)
- @param str - string as
- String to 32-bit integer.
- @param str - string as
oatpp::String
. - @param success - out parameter.
true
if operation was successful.false
otherwise. - @return - 32-bit integer value.
v_int32 strToInt32(const oatpp::String& str, bool& success)
- @param str - string as
# strToInt32
Namespace: oatpp::utils::conversion
- String to 32-bit integer.
- @param str - string as
const char*
. - @return - 32-bit integer value.
v_int32 strToInt32(const char* str)
- @param str - string as
- String to 32-bit integer.
- @param str - string as
oatpp::String
. - @param success - out parameter.
true
if operation was successful.false
otherwise. - @return - 32-bit integer value.
v_int32 strToInt32(const oatpp::String& str, bool& success)
- @param str - string as
# strToUInt32
Namespace: oatpp::utils::conversion
- String to 32-bit unsigned integer.
- @param str - string as
const char*
. - @return - 32-bit unsigned integer value.
v_uint32 strToUInt32(const char* str)
- @param str - string as
- String to 32-bit unsigned integer.
- @param str - string as
oatpp::String
. - @param success - out parameter.
true
if operation was successful.false
otherwise. - @return - 32-bit unsigned integer value.
v_uint32 strToUInt32(const oatpp::String& str, bool& success)
- @param str - string as
# strToUInt32
Namespace: oatpp::utils::conversion
- String to 32-bit unsigned integer.
- @param str - string as
const char*
. - @return - 32-bit unsigned integer value.
v_uint32 strToUInt32(const char* str)
- @param str - string as
- String to 32-bit unsigned integer.
- @param str - string as
oatpp::String
. - @param success - out parameter.
true
if operation was successful.false
otherwise. - @return - 32-bit unsigned integer value.
v_uint32 strToUInt32(const oatpp::String& str, bool& success)
- @param str - string as
# strToInt64
Namespace: oatpp::utils::conversion
- String to 64-bit integer.
- @param str - string as
const char*
. - @return - 64-bit integer value.
v_int64 strToInt64(const char* str)
- @param str - string as
- String to 64-bit integer.
- @param str - string as
oatpp::String
. - @param success - out parameter.
true
if operation was successful.false
otherwise. - @return - 64-bit integer value.
v_int64 strToInt64(const oatpp::String& str, bool& success)
- @param str - string as
# strToInt64
Namespace: oatpp::utils::conversion
- String to 64-bit integer.
- @param str - string as
const char*
. - @return - 64-bit integer value.
v_int64 strToInt64(const char* str)
- @param str - string as
- String to 64-bit integer.
- @param str - string as
oatpp::String
. - @param success - out parameter.
true
if operation was successful.false
otherwise. - @return - 64-bit integer value.
v_int64 strToInt64(const oatpp::String& str, bool& success)
- @param str - string as
# strToUInt64
Namespace: oatpp::utils::conversion
- String to 64-bit unsigned integer.
- @param str - string as
const char*
. - @return - 64-bit unsigned integer value.
v_uint64 strToUInt64(const char* str)
- @param str - string as
- String to 64-bit unsigned integer.
- @param str - string as
oatpp::String
. - @param success - out parameter.
true
if operation was successful.false
otherwise. - @return - 64-bit unsigned integer value.
v_uint64 strToUInt64(const oatpp::String& str, bool& success)
- @param str - string as
# strToUInt64
Namespace: oatpp::utils::conversion
- String to 64-bit unsigned integer.
- @param str - string as
const char*
. - @return - 64-bit unsigned integer value.
v_uint64 strToUInt64(const char* str)
- @param str - string as
- String to 64-bit unsigned integer.
- @param str - string as
oatpp::String
. - @param success - out parameter.
true
if operation was successful.false
otherwise. - @return - 64-bit unsigned integer value.
v_uint64 strToUInt64(const oatpp::String& str, bool& success)
- @param str - string as
# int32ToCharSequence
Namespace: oatpp::utils::conversion
Convert 32-bit integer to it's string representation.
- @param value - 32-bit integer value.
- @param data - buffer to write data to.
- @param n - buffer size.
- @return - length of the resultant string.
v_buff_size int32ToCharSequence(v_int32 value, p_char8 data, v_buff_size n)
# uint32ToCharSequence
Namespace: oatpp::utils::conversion
Convert 32-bit unsigned integer to it's string representation.
- @param value - 32-bit unsigned integer value.
- @param data - buffer to write data to.
- @param n - buffer size.
- @return - length of the resultant string.
v_buff_size uint32ToCharSequence(v_uint32 value, p_char8 data, v_buff_size n)
# int64ToCharSequence
Namespace: oatpp::utils::conversion
Convert 64-bit integer to it's string representation.
- @param value - 64-bit integer value.
- @param data - buffer to write data to.
- @param n - buffer size.
- @return - length of the resultant string.
v_buff_size int64ToCharSequence(v_int64 value, p_char8 data, v_buff_size n)
# uint64ToCharSequence
Namespace: oatpp::utils::conversion
Convert 64-bit unsigned integer to it's string representation.
- @param value - 64-bit unsigned integer value.
- @param data - buffer to write data to.
- @param n - buffer size.
- @return - length of the resultant string.
v_buff_size uint64ToCharSequence(v_uint64 value, p_char8 data, v_buff_size n)
# int32ToStr
Namespace: oatpp::utils::conversion
Convert 32-bit integer to it's string representation.
- @param value - 32-bit integer value.
- @return - value as
oatpp::String
oatpp::String int32ToStr(v_int32 value)
# uint32ToStr
Namespace: oatpp::utils::conversion
Convert 32-bit unsigned integer to it's string representation.
- @param value - 32-bit unsigned integer value.
- @return - value as
oatpp::String
oatpp::String uint32ToStr(v_uint32 value)
# int64ToStr
Namespace: oatpp::utils::conversion
Convert 64-bit integer to it's string representation.
- @param value - 64-bit integer value.
- @return - value as
oatpp::String
oatpp::String int64ToStr(v_int64 value)
# uint64ToStr
Namespace: oatpp::utils::conversion
Convert 64-bit unsigned integer to it's string representation.
- @param value - 64-bit unsigned integer value.
- @return - value as
oatpp::String
oatpp::String uint64ToStr(v_uint64 value)
# int32ToStdStr
Namespace: oatpp::utils::conversion
Convert 32-bit integer to it's string representation.
- @param value - 32-bit integer value.
- @return - value as
std::string
std::string int32ToStdStr(v_int32 value)
# uint32ToStdStr
Namespace: oatpp::utils::conversion
Convert 32-bit unsigned integer to it's string representation.
- @param value - 32-bit unsigned integer value.
- @return - value as
std::string
std::string uint32ToStdStr(v_uint32 value)
# int64ToStdStr
Namespace: oatpp::utils::conversion
Convert 64-bit integer to it's string representation.
- @param value - 64-bit integer value.
- @return - value as
std::string
std::string int64ToStdStr(v_int64 value)
# uint64ToStdStr
Namespace: oatpp::utils::conversion
Convert 64-bit unsigned integer to it's string representation.
- @param value - 64-bit unsigned integer value.
- @return - value as
std::string
std::string uint64ToStdStr(v_uint64 value)
# primitiveToCharSequence
Namespace: oatpp::utils::conversion
Write value of primitive type (int, float, etc.) as it's string representation with pattern.
- @tparam T - primitive value type (int, float, etc.).
- @param value - actual value.
- @param data - buffer to write data to.
- @param n - buffer size.
- @param pattern - pattern as for
snprintf
. - @return - length of the resultant string.
template<typename T>
v_buff_size primitiveToCharSequence(T value, p_char8 data, v_buff_size n, const char *pattern)
# primitiveToStr
Namespace: oatpp::utils::conversion
Write value of primitive type (int, float, etc.) as it's string representation with pattern.
- @tparam T - primitive value type (int, float, etc.).
- @param value - actual value.
- @param pattern - pattern as for
sprintf
. - @return - length of the resultant string.
template<typename T>
oatpp::String primitiveToStr(T value, const char* pattern)
# strToFloat32
Namespace: oatpp::utils::conversion
- String to 32-bit float.
- @param str - string as
const char*
. - @return - 32-bit float value.
v_float32 strToFloat32(const char* str)
- @param str - string as
- String to 32-bit float.
- @param str - string as
oatpp::String
. - @param success - out parameter.
true
if operation was successful.false
otherwise. - @return - 32-bit float value.
v_float32 strToFloat32(const oatpp::String& str, bool& success)
- @param str - string as
# strToFloat32
Namespace: oatpp::utils::conversion
- String to 32-bit float.
- @param str - string as
const char*
. - @return - 32-bit float value.
v_float32 strToFloat32(const char* str)
- @param str - string as
- String to 32-bit float.
- @param str - string as
oatpp::String
. - @param success - out parameter.
true
if operation was successful.false
otherwise. - @return - 32-bit float value.
v_float32 strToFloat32(const oatpp::String& str, bool& success)
- @param str - string as
# strToFloat64
Namespace: oatpp::utils::conversion
- String to 64-bit float.
- @param str - string as
const char*
. - @return - 64-bit float value.
v_float64 strToFloat64(const char* str)
- @param str - string as
- String to 64-bit float.
- @param str - string as
oatpp::String
. - @param success - out parameter.
true
if operation was successful.false
otherwise. - @return - 64-bit float value.
v_float64 strToFloat64(const oatpp::String& str, bool& success)
- @param str - string as
# strToFloat64
Namespace: oatpp::utils::conversion
- String to 64-bit float.
- @param str - string as
const char*
. - @return - 64-bit float value.
v_float64 strToFloat64(const char* str)
- @param str - string as
- String to 64-bit float.
- @param str - string as
oatpp::String
. - @param success - out parameter.
true
if operation was successful.false
otherwise. - @return - 64-bit float value.
v_float64 strToFloat64(const oatpp::String& str, bool& success)
- @param str - string as
# float32ToCharSequence
Namespace: oatpp::utils::conversion
Convert 32-bit float to it's string representation.
- @param value - 32-bit float value.
- @param data - buffer to write data to.
- @param n - buffer size.
- @return - length of the resultant string.
v_buff_size float32ToCharSequence(v_float32 value, p_char8 data, v_buff_size n, const char* format = OATPP_FLOAT_STRING_FORMAT)
# float64ToCharSequence
Namespace: oatpp::utils::conversion
Convert 64-bit float to it's string representation.
- @param value - 64-bit float value.
- @param data - buffer to write data to.
- @param n - buffer size.
- @return - length of the resultant string.
v_buff_size float64ToCharSequence(v_float64 value, p_char8 data, v_buff_size n, const char* format = OATPP_FLOAT_STRING_FORMAT)
# float32ToStr
Namespace: oatpp::utils::conversion
Convert 32-bit float to it's string representation.
- @param value - 32-bit float value.
- @return - value as
oatpp::String
oatpp::String float32ToStr(v_float32 value, const char* format = OATPP_FLOAT_STRING_FORMAT)
# float64ToStr
Namespace: oatpp::utils::conversion
Convert 64-bit float to it's string representation.
- @param value - 64-bit float value.
- @return - value as
oatpp::String
oatpp::String float64ToStr(v_float64 value, const char* format = OATPP_FLOAT_STRING_FORMAT)
# boolToStr
Namespace: oatpp::utils::conversion
Convert boolean to it's string representation.
- @param value - boolean value.
- @return - value as
oatpp::String
;
oatpp::String boolToStr(bool value)
# strToBool
Namespace: oatpp::utils::conversion
parse string to boolean value.
- @param str - string to parse.
- @param success - out parameter.
true
if operation was successful.false
otherwise. - @return - boolean value.
bool strToBool(const oatpp::String& str, bool& success)