Open Search
    UnitScaleData Class Reference

    #include <customgui_unitscale.h>

    Inheritance diagram for UnitScaleData:

    Detailed Description

    Unit scale custom data type (CUSTOMDATATYPE_UNITSCALE) for UnitScaleCustomGui.

    Note
    Has to be created with Alloc() and destroyed with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.

    Private Member Functions

     UnitScaleData ()
     
     ~UnitScaleData ()
     

    Alloc/Free

    static UnitScaleDataAlloc ()
     
    static void Free (UnitScaleData *&data)
     

    Unit/Scale

    Bool SetUnitScale (Float scale, DOCUMENT_UNIT unit)
     
    Bool GetUnitScale (Float &scale, DOCUMENT_UNIT &unit) const
     
    String ToUnitString () const
     

    Operators

    Bool operator== (const UnitScaleData &b) const
     
    Bool operator!= (const UnitScaleData &b) const
     

    Additional Inherited Members

    - Static Public Attributes inherited from CustomDataTypeT< 200000275 >
    static constexpr Int32 DATATYPEID
     

    Constructor & Destructor Documentation

    ◆ UnitScaleData()

    UnitScaleData ( )
    private

    ◆ ~UnitScaleData()

    ~UnitScaleData ( )
    private

    Member Function Documentation

    ◆ Alloc()

    static UnitScaleData* Alloc ( )
    static

    Allocates a unit scale data. Destroy the allocated unit scale data with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.

    Returns
    The allocated unit scale data, or nullptr if the allocation failed.

    ◆ Free()

    static void Free ( UnitScaleData *&  data)
    static

    Destructs unit scale data allocated with Alloc(). Use AutoAlloc to automate the allocation and destruction based on scope.

    Parameters
    [in,out]dataThe unit scale data to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.

    ◆ SetUnitScale()

    Bool SetUnitScale ( Float  scale,
    DOCUMENT_UNIT  unit 
    )

    Sets the values for the unit scale data.

    Parameters
    [in]scaleThe unit scale.
    [in]unitThe unit.
    Returns
    true if successful, otherwise false.

    ◆ GetUnitScale()

    Bool GetUnitScale ( Float scale,
    DOCUMENT_UNIT unit 
    ) const

    Gets the values of the unit scale data.

    Parameters
    [out]scaleAssigned the unit scale.
    [out]unitAssigned the unit.
    Returns
    true if successful, otherwise false.

    ◆ ToUnitString()

    String ToUnitString ( ) const

    Returns the suffix shown in the UI for the set unit as a string.

    Returns
    returns the string of the unit, empty string if failing.

    ◆ operator==()

    Bool operator== ( const UnitScaleData b) const

    Equality operator. Checks if the unit scale data are equal.

    Parameters
    [in]bA unit scale data.
    Returns
    true if the unit scale data are equal, otherwise false.

    ◆ operator!=()

    Bool operator!= ( const UnitScaleData b) const

    Inequality operator. Checks if the unit scale data are different.

    Parameters
    [in]bA unit scale data.
    Returns
    true if the unit scale data are different, otherwise false.