DecimalFormatter class new in Git master
#include <Magnum/Ui/Formatter.h>
Formatter for decimal integer values.
Public types
- enum class Flag: UnsignedByte { ExplicitPlus = 1 << 0 }
- Flag.
-
using Flags = Containers::
EnumSet<Flag> new in Git master - Flags.
Public static functions
-
static auto parse(Containers::
StringView text, Int& value) -> ParseState - Parse text matching the formatter output.
-
static auto parse(Containers::
StringView text, UnsignedInt& value) -> ParseState -
static auto parse(Containers::
StringView text, Long& value) -> ParseState -
static auto parse(Containers::
StringView text, UnsignedLong& value) -> ParseState
Constructors, destructors, conversion operators
- DecimalFormatter(Flags flags = {}) explicit
- Constructor.
Public functions
- auto flags() const -> Flags
- Flags.
- auto setFlags(Flags flags) -> DecimalFormatter&
- Set flags.
- auto addFlags(Flags flags) -> DecimalFormatter&
- Add flags.
- auto clearFlags(Flags flags) -> DecimalFormatter&
- Clear flags.
- auto minWidth() const -> Int
- Minimal number width.
- auto setMinWidth(Int width) -> DecimalFormatter&
- Set minimal number width.
- void operator()(TextLayer& layer, DataHandle data, Int value) const
- Format a value.
- void operator()(TextLayer& layer, DataHandle data, UnsignedInt value) const
- void operator()(TextLayer& layer, DataHandle data, Long value) const
- void operator()(TextLayer& layer, DataHandle data, UnsignedLong value) const
- void operator()(TextLayer& layer, LayerDataHandle data, Int value) const
- Format a value assuming it comes from given layer.
- void operator()(TextLayer& layer, LayerDataHandle data, UnsignedInt value) const
- void operator()(TextLayer& layer, LayerDataHandle data, Long value) const
- void operator()(TextLayer& layer, LayerDataHandle data, UnsignedLong value) const
Enum documentation
enum class Magnum:: Ui:: DecimalFormatter:: Flag: UnsignedByte
Flag.
| Enumerators | |
|---|---|
| ExplicitPlus |
Prefix positive values with an explicit + sign |
Typedef documentation
typedef Containers:: EnumSet<Flag> Magnum:: Ui:: DecimalFormatter:: Flags new in Git master
Flags.
Function documentation
static ParseState Magnum:: Ui:: DecimalFormatter:: parse(Containers:: StringView text,
Int& value)
Parse text matching the formatter output.
| Parameters | |
|---|---|
| text | Text to parse |
| value | Where to put the parsed value |
| Returns | Result of the parsing operation |
Expects that text is Containers::
If parsing succeeds, the function returns ParseState::value. If the text is empty or all whitespace, ParseState::value is filled with a corresponding min / max representable value and ParseState::
static ParseState Magnum:: Ui:: DecimalFormatter:: parse(Containers:: StringView text,
UnsignedInt& value)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
static ParseState Magnum:: Ui:: DecimalFormatter:: parse(Containers:: StringView text,
Long& value)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
static ParseState Magnum:: Ui:: DecimalFormatter:: parse(Containers:: StringView text,
UnsignedLong& value)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Magnum:: Ui:: DecimalFormatter:: DecimalFormatter(Flags flags = {}) explicit
Constructor.
| Parameters | |
|---|---|
| flags | Flags |
DecimalFormatter& Magnum:: Ui:: DecimalFormatter:: setFlags(Flags flags)
Set flags.
| Returns | Reference to self (for method chaining) |
|---|
DecimalFormatter& Magnum:: Ui:: DecimalFormatter:: addFlags(Flags flags)
Add flags.
| Returns | Reference to self (for method chaining) |
|---|
Calls setFlags() with the existing flags ORed with flags. Useful for preserving previously set flags.
DecimalFormatter& Magnum:: Ui:: DecimalFormatter:: clearFlags(Flags flags)
Clear flags.
| Returns | Reference to self (for method chaining) |
|---|
Calls setFlags() with the existing flags ANDed with the inverse of flags. Useful for removing a subset of previously set flags.
DecimalFormatter& Magnum:: Ui:: DecimalFormatter:: setMinWidth(Int width)
Set minimal number width.
If the formatted number has less digits than specified width, it's padded by leading zeros. Sign isn't counted into the width. Expects that width is at least 0 and at most 255. Default value is 1.
If width is 0, formatting a zero value results in an empty text, regardless of whether Flag::
void Magnum:: Ui:: DecimalFormatter:: operator()(TextLayer& layer,
DataHandle data,
Int value) const
Format a value.
Expects that data is valid in layer. Internally formats the value to a stack-allocated string and passes it to TextLayer::
void Magnum:: Ui:: DecimalFormatter:: operator()(TextLayer& layer,
DataHandle data,
UnsignedInt value) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Ui:: DecimalFormatter:: operator()(TextLayer& layer,
DataHandle data,
Long value) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Ui:: DecimalFormatter:: operator()(TextLayer& layer,
DataHandle data,
UnsignedLong value) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Ui:: DecimalFormatter:: operator()(TextLayer& layer,
LayerDataHandle data,
Int value) const
Format a value assuming it comes from given layer.
Like operator()(TextLayer&, DataHandle, Int) const but without checking that handle indeed belongs to layer. See its documentation for more information.
void Magnum:: Ui:: DecimalFormatter:: operator()(TextLayer& layer,
LayerDataHandle data,
UnsignedInt value) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Ui:: DecimalFormatter:: operator()(TextLayer& layer,
LayerDataHandle data,
Long value) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void Magnum:: Ui:: DecimalFormatter:: operator()(TextLayer& layer,
LayerDataHandle data,
UnsignedLong value) const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Debug& operator<<(Debug& debug,
DecimalFormatter:: Flag value) new in Git master
Debug output operator.
Debug& operator<<(Debug& debug,
DecimalFormatter:: Flags value) new in Git master
Debug output operator.