#include <stringconversion.h>
Class that controls string to value conversion. There is no need to use this class directly, use String instead.
Static Public Member Functions | |
static MAXON_METHOD String | FloatToString (Float32 value, Int charsBeforeComma, Int digitsAfterComma, Bool exponent, Utf32Char fillChar, const FormatStatement *formatStatement) |
static MAXON_METHOD String | FloatToString (Float64 value, Int charsBeforeComma, Int digitsAfterComma, Bool exponent, Utf32Char fillChar, const FormatStatement *formatStatement) |
static MAXON_METHOD void | AppendInt (StringInterface *str, Int64 value, Int datatypeSize, const FormatStatement *formatStatement) |
static MAXON_METHOD void | AppendUInt (StringInterface *str, UInt64 value, Int datatypeSize, const FormatStatement *formatStatement) |
static MAXON_METHOD void | AppendInt (CStringInterface *str, Int64 value, Int datatypeSize, const FormatStatement *formatStatement) |
static MAXON_METHOD void | AppendUInt (CStringInterface *str, UInt64 value, Int datatypeSize, const FormatStatement *formatStatement) |
static MAXON_METHOD String | MemorySizeToString (Int64 mem, Bool mebibytes) |
static MAXON_METHOD String | HexToString (UInt32 value, Bool prefix0x, Bool leadingZeros, const FormatStatement *formatStatement) |
static MAXON_METHOD String | HexToString (UInt64 value, Bool prefix0x, Bool leadingZeros, const FormatStatement *formatStatement) |
static MAXON_METHOD Result< Float32 > | ToFloat32 (const Block< const Utf32Char > &str, STRINGCONVERSION flags) |
static MAXON_METHOD Result< Float64 > | ToFloat64 (const Block< const Utf32Char > &str, STRINGCONVERSION flags) |
static MAXON_METHOD Result< Int64 > | ToInt64 (const Block< const Utf32Char > &str, STRINGCONVERSION flags) |
static MAXON_METHOD Result< Int32 > | ToInt32 (const Block< const Utf32Char > &str, STRINGCONVERSION flags) |
static MAXON_METHOD Result< UInt64 > | ToUInt64 (const Block< const Utf32Char > &str, STRINGCONVERSION flags) |
static MAXON_METHOD Result< UInt32 > | ToUInt32 (const Block< const Utf32Char > &str, STRINGCONVERSION flags) |
static MAXON_METHOD Result< Float64 > | StringToFloat (const Block< const Utf32Char > &str, Int &processedChars) |
static MAXON_METHOD Result< UInt64 > | StringToInteger (const Block< const Utf32Char > &str, Int base, Bool autodetect0x, Bool signedMode, Int &processedChars) |
static MAXON_METHOD const String & | GetLineEnd () |
static MAXON_METHOD const CString & | GetLineEndC () |
static MAXON_METHOD StringProxy * | FormatXArgs (const String &formatString, Int argsCnt, const void **args, const TOSTR *argFuncs) |
static MAXON_METHOD Bool | ScanStringXArgs (const String &str, const String &format, Int *parsedCharacters, Int argsCnt, void **args, FROMSTR *argFuncs) |
static MAXON_METHOD Int64 | ScanParameterBasic (const Block< const Utf32Char > &str, Bool signedMode, Int &processed, const String &formatStatement, Bool &error) |
Private Member Functions | |
MAXON_INTERFACE_NONVIRTUAL (StringConversion, MAXON_REFERENCE_STATIC, "net.maxon.interface.stringconversion", MAXON_IMPLEMENTATION_MODULE("net.maxon.kernel")) | |
|
private |
|
static |
Converts a floating point value into formatted text.
[in] | value | Floating point value to convert into text. |
[in] | charsBeforeComma | Characters before the decimal point. If -1 is passed or 'charsBeforeComma' is too low to represent 'value' it is automatically increased/adjusted. If 'charsBeforeComma' is positive and exponent is false fill characters will be added to the beginning. |
[in] | digitsAfterComma | Digits after the decimal point. If a negative number is passed the number of digits is automatically chosen and up to (-digitsAfterComma). |
[in] | exponent | Force exponential-style output (e.g. 1.0e+10). |
[in] | fillChar | Fill character for digits before the decimal point. E.g. if you specify 4 for charsBeforeComma, '*' for fillChar and your value is 1.5 you'll get ***1.5 as a result. This value has no impact if exponent is true. |
[in] | formatStatement | Nullptr or additional formatting instruction. See also Formatting Floating point values. |
|
static |
Converts a floating point value into formatted text.
[in] | value | Floating point value to convert into text. |
[in] | charsBeforeComma | Characters before the decimal point. If -1 is passed or 'charsBeforeComma' is too low to represent 'value' it is automatically increased/adjusted. If 'charsBeforeComma' is positive and exponent is false fill characters will be added to the beginning. |
[in] | digitsAfterComma | Digits after the decimal point. If a negative number is passed the number of digits is automatically chosen and up to (-digitsAfterComma). |
[in] | exponent | Force exponential-style output (e.g. 1.0e+10). |
[in] | fillChar | Fill character for digits before the decimal point. E.g. if you specify 4 for charsBeforeComma, '*' for fillChar and your value is 1.5 you'll get ***1.5 as a result. This value has no impact if exponent is true. |
[in] | formatStatement | Nullptr or additional formatting instruction. See also Formatting Floating point values. |
|
static |
Appends an integer value to an existing string.
[in] | str | The existing string. |
[in] | value | The value that will be appended as a string. |
[in] | datatypeSize | Size in bytes of the passed value, as this routine can be used for Char, Int16, Int32 and Int64 values. This becomes only relevant if formatStatement forces hexadecimal output. |
[in] | formatStatement | Nullptr or additional formatting instruction. See also Formatting Integer values. |
|
static |
Appends an unsigned integer value to an existing string.
[in] | str | The existing string. |
[in] | value | The value that will be appended as a string. |
[in] | datatypeSize | Size in bytes of the passed value, as this routine can be used for UChar, UInt16, UInt32 and UInt64 values. This becomes only relevant if formatStatement forces hexadecimal output. |
[in] | formatStatement | Nullptr or additional formatting instruction. See also Formatting Integer values. |
|
static |
Appends an integer value to an existing string.
[in] | str | The existing string. |
[in] | value | The value that will be appended as a string. |
[in] | datatypeSize | Size in bytes of the passed value, as this routine can be used for Char, Int16, Int32 and Int64 values. This becomes only relevant if formatStatement forces hexadecimal output. |
[in] | formatStatement | Nullptr or additional formatting instruction. See also Formatting Integer values. |
|
static |
Appends an unsigned integer value to an existing string.
[in] | str | The existing string. |
[in] | value | The value that will be appended as a string. |
[in] | datatypeSize | Size in bytes of the passed value, as this routine can be used for UChar, UInt16, UInt32 and UInt64 values. This becomes only relevant if formatStatement forces hexadecimal output. |
[in] | formatStatement | Nullptr or additional formatting instruction. See also Formatting Integer values. |
|
static |
Creates a readable string from a memory size.
[in] | mem | The memory size. |
[in] | mebibytes | Defines if a value of 1343443 is either output as "1.28 MiB" (mebibytes) or "1.34 MB" (megabytes). |
|
static |
Converts a value into a hexadecimal string.
[in] | value | The value. |
[in] | prefix0x | If true, the output string will have a '0x' prefix. |
[in] | leadingZeros | If false, the output string will have no leading zeros, so a value of 100 e.g. will be output as 64 (and not 00000064). |
[in] | formatStatement | Nullptr or additional formatting instruction. See also Formatting Pointer values. |
|
static |
Converts a value into a hexadecimal string.
[in] | value | The value. |
[in] | prefix0x | If true, the output string will have a '0x' prefix. |
[in] | leadingZeros | If false, the output string will have no leading zeros, so a value of 100 e.g. will be output as 64 (and not 0000000000000064). |
[in] | formatStatement | Nullptr or additional formatting instruction. See also Formatting Pointer values. |
|
static |
Converts a Utf32Char character sequence to a 32-bit floating point value. This routine does no formula parsing. While leading whitespaces are allowed by default no trailing characters of any kind are allowed.
[in] | str | The input string. |
[in] | flags | Optional flags for the conversion. |
|
static |
Converts a Utf32Char character sequence to a 64-bit floating point value. This routine does no formula parsing. While leading whitespaces are allowed by default no trailing characters of any kind are allowed.
[in] | str | The input string. |
[in] | flags | Optional flags for the conversion. |
|
static |
Converts a Utf32Char character sequence to a 64 bit integer value. This routine does no formula parsing and does not support any suffixes/prefixes except for 0x (hexadecimal numbers). While leading whitespaces are allowed by default no trailing characters of any kind are allowed.
[in] | str | The input string. |
[in] | flags | Optional flags for the conversion. |
|
static |
Converts a Utf32Char character sequence to a 32 bit integer value. This routine does no formula parsing and does not support any suffixes/prefixes except for 0x (hexadecimal numbers). While leading whitespaces are allowed by default no trailing characters of any kind are allowed.
[in] | str | The input string. |
[in] | flags | Optional flags for the conversion. |
|
static |
Converts a Utf32Char character sequence to a 64 bit unsigned integer value. This routine does no formula parsing and does not support any suffixes/prefixes except for 0x (hexadecimal numbers). While leading whitespaces are allowed by default no trailing characters of any kind are allowed.
[in] | str | The input string. |
[in] | flags | Optional flags for the conversion. |
|
static |
Converts a Utf32Char character sequence to a 32 bit unsigned integer value. This routine does no formula parsing and does not support any suffixes/prefixes except for 0x (hexadecimal numbers). While leading whitespaces are allowed by default no trailing characters of any kind are allowed.
[in] | str | The input string. |
[in] | flags | Optional flags for the conversion. |
|
static |
Converts a Utf32Char character sequence to a floating point value. This routine does no formula parsing. No leading whitespaces or characters that do not belong to the floating point value are allowed.
[in] | str | The character sequence. |
[out] | processedChars | The actual number of characters that were read. This can be shorter than maxChars. The algorithm stops as soon as it finds a character that does not belong to the floating point value. |
|
static |
Converts a Utf32Char character sequence to an integer value. This routine does no formula parsing. No leading whitespaces or characters that do not belong to the integer value are allowed.
[in] | str | The character sequence. |
[in] | base | Numerical base that is in the range of [2..36]. For regular decimal conversion pass 10, for hexadecimal conversion 16. NOTOK is valid. |
[in] | autodetect0x | If true the string is scanned for a '0x' prefix. If that is detected the base is automatically set to 16. |
[in] | signedMode | If false, negative numbers will result in an error. In signedMode numbers need to be within Int64 limits, otherwise UInt64. |
[out] | processedChars | The actual number of characters that were read. This can be shorter than maxChars. The algorithm stops as soon as it finds a character that does not belong to the integer value. |
|
static |
Returns a string with the platform specific line ending.
|
static |
Returns a string with the platform specific line ending.
|
static |
|
static |