-
首页
-
C4D R23.110 C++ SDK
StringConversion Class Reference
#include <stringconversion.h>
详细描述
Class
that controls string to value conversion. There is no need to use this class directly, use
String
instead.
静态公共成员函数
|
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 const
MAXON_METHOD
String
&
|
GetLineEnd
()
|
static const
MAXON_METHOD
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)
|
成员函数文档编制
◆
MAXON_INTERFACE_NONVIRTUAL()
◆
FloatToString()
[1/2]
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
.
|
-
返回
-
String
object with the decimal text of the value.
◆
FloatToString()
[2/2]
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
.
|
-
返回
-
String
object with the decimal text of the value.
◆
AppendInt()
[1/2]
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
.
|
◆
AppendUInt()
[1/2]
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
.
|
◆
AppendInt()
[2/2]
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
.
|
◆
AppendUInt()
[2/2]
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
.
|
◆
MemorySizeToString()
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).
|
-
返回
-
String
that displays the memory size.
◆
HexToString()
[1/2]
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
.
|
-
返回
-
The converted string.
◆
HexToString()
[2/2]
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
.
|
-
返回
-
The converted string.
◆
ToFloat32()
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.
|
-
返回
-
Floating point value of string.
◆
ToFloat64()
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.
|
-
返回
-
Floating point value of string.
◆
ToInt64()
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.
|
-
返回
-
Integer value of the string.
◆
ToInt32()
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.
|
-
返回
-
Integer value of the string.
◆
ToUInt64()
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.
|
-
返回
-
Integer value of the string.
◆
ToUInt32()
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.
|
-
返回
-
Integer value of the string.
◆
StringToFloat()
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.
|
-
返回
-
Floating point value of string.
◆
StringToInteger()
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.
|
-
返回
-
Integer value of string. In signed mode the result must be cast to Int64.
◆
GetLineEnd()
Returns a string with the platform specific line ending.
-
返回
-
String
containing the line ending ("\r\n" or "\r").
◆
GetLineEndC()
Returns a string with the platform specific line ending.
-
返回
-
CString
containing the line ending ("\r\n" or "\r").
◆
FormatXArgs()
◆
ScanStringXArgs()
◆
ScanParameterBasic()