class String

Defined at line 20 of file ../../zircon/system/ulib/ffl/include/ffl/string.h

String builds and stores a null-terminated string representation of a fixed-

point value. A constant-size string buffer is maintained internally in each

instance to permit temporaries in calls to printing/logging functions.

Public Methods

void String ()

Defined at line 22 of file ../../zircon/system/ulib/ffl/include/ffl/string.h

void String (const String & )

Defined at line 23 of file ../../zircon/system/ulib/ffl/include/ffl/string.h

String & operator= (const String & )

Defined at line 24 of file ../../zircon/system/ulib/ffl/include/ffl/string.h

template <typename Integer, size_t FractionalBits>
void String (Fixed<Integer, FractionalBits> value, Mode mode, size_t max_fractional_digits)

Constructs a String containing a string representation of the given fixed-

point value. See Mode for a description of the available modes.

Defined at line 53 of file ../../zircon/system/ulib/ffl/include/ffl/string.h

const char * c_str ()

Returns a pointer to the internal string. The string is guaranteed to be

null-terminated.

Defined at line 68 of file ../../zircon/system/ulib/ffl/include/ffl/string.h

const char * data ()

Returns a pointer to the first element of the internal string buffer.

Defined at line 71 of file ../../zircon/system/ulib/ffl/include/ffl/string.h

size_t size ()

Returns the length of the string.

Defined at line 74 of file ../../zircon/system/ulib/ffl/include/ffl/string.h

Enumerations

enum Mode
Name Value Comments
Dec 0

The value is rendered as an ordinary decimal number. The fraction is
limited to max_fractional_digits (which is capped internally so that
the resulting string is never longer than 31 characters).

Hex 1

The value is rendered as two unsigned hexidecimal numbers separated by a
decimal point, with FractionalBits after the decimal point. For example,
Fixed
<int8
_t,2>::FromRaw(0x0f) is rendered as "3.C".

DecRational 2

The value is rendered as an rational expression of the form:

[optional sign][integer][sign][numerator]/[denominator]

Each number is rendered in base 10. The fraction is not reduced, meaning
the denominator is always 2^FractionalBits. Examples:

Fixed
<int8
_t,2>::FromRaw(0x0f) => "3+3/4"
Fixed
<int8
_t,2>::FromRaw(0xee) => "-4-2/4"

Defined at line 26 of file ../../zircon/system/ulib/ffl/include/ffl/string.h