class Core::FloatFormatter

Overview

Format float value. More…

#include <coreformatter.h>

class FloatFormatter: public Core::Formatter
{
public:
    // typedefs

    typedef char FormatString[kFormatSize];

    // fields

    static constexpr int kDefaultDigits = 2;
    static constexpr int kFormatSize = 16;

    // construction

    FloatFormatter (
        CStringPtr name = "float",
        int numDecimalDigits = kDefaultDigits,
        CStringPtr label = nullptr
    );

    // methods

    virtual void print (Data& d) const;
    virtual bool scan (Data& d) const;
    static const Formatter& instance ();

    static void makeFormatString (
        FormatString formatString,
        int numDecimalDigits,
        CStringPtr label = nullptr
    );

    static bool getFloatValue (float& value, CStringPtr string);
};

Inherited Members

public:
    // structs

    struct Data;
    struct Range;

    // methods

    CStringPtr getName () const;
    virtual void print (Data& d) const = 0;
    virtual bool scan (Data& d) const;

Detailed Documentation

Format float value.

Methods

virtual void print (Data& d) const

Print value to string.

virtual bool scan (Data& d) const

Scan value from string.

static bool getFloatValue (float& value, CStringPtr string)

Helper to scan float value with different decimal marks.