## GoUnit GoUnit |

## Functions

double | go_unit_convert ()
GoUnit const * | go_unit_define ()
GoUnit const * | go_unit_get ()
GoUnit const * | go_unit_get_from_symbol ()
GoUnitId | go_unit_get_id ()
char const * | go_unit_get_symbol ()
GType | go_unit_get_type ()

## Types and Values

| GoUnit
enum | GoUnitId

## Object Hierarchy

        GBoxed
        ╰── GoUnit

## Description

## Functions

### go_unit_convert ()

    double
    go_unit_convert (GoUnit const *from,
                     GoUnit const *to,
                     double value);

Converts `value` from `from` units to `to` units.

#### Parameters

from | source GoUnit |
to | target GoUnit |
value | value to convert |

#### Returns

the converted value or NAN if the units are not compatible.

### go_unit_define ()

    GoUnit const *
    go_unit_define (char const *symbol,
                    char const *dim,
                    double factor_to_SI);

Defines a new unit. If a GoUnit of that name already exists, the existing is returned. Otherwise a new one is created.

#### Parameters

symbol | symbol name for unit. |
dim | dimension measured by unit. |
factor_to_SI | factor to convert to SI unit. |

#### Returns

the named GoUnit.

[transfer none]

### go_unit_get ()

    GoUnit const *
    go_unit_get (GoUnitId id);

Gets the unit corresponding to `id` .

#### Parameters

id | GoUnitId for unit to query |

#### Returns

the GoUnit corresponding to `id` .

[transfer none][nullable]

### go_unit_get_from_symbol ()

    GoUnit const *
    go_unit_get_from_symbol (char const *symbol);

#### Parameters

symbol | symbol name |

#### Returns

the GoUnit corresponding to `symbol` .

[transfer none][nullable]

### go_unit_get_id ()

    GoUnitId
    go_unit_get_id (GoUnit const *unit);

#### Parameters

unit | GoUnit |

#### Returns

the GoUnitId for `unit` .

### go_unit_get_symbol ()

    char const *
    go_unit_get_symbol (GoUnit const *unit);

#### Parameters

unit | GoUnit |

#### Returns

the symbol name for `unit` .

[transfer none]

### go_unit_get_type ()

    GType
    go_unit_get_type (void);

#### Returns

the GType for GoUnit.

## Types and Values

### GoUnit

    typedef struct _GoUnit GoUnit;

### enum GoUnitId

#### Members

GO_UNIT_UNKNOWN | unknown unit. |
GO_UNIT_METER | meter. |
GO_UNIT_CENTIMETER | centimeter. |
GO_UNIT_INCH | inch. |
GO_UNIT_POINT | point. |
GO_UNIT_MAX | first unregistered unit. |