## cr-num

cr-num

## Functions

CRNum * | cr_num_new ()
CRNum * | cr_num_new_with_val ()
CRNum * | cr_num_dup ()
guchar * | cr_num_to_string ()
enum CRStatus | cr_num_copy ()
enum CRStatus | cr_num_set ()
gboolean | cr_num_is_fixed_length ()
void | cr_num_destroy ()

## Types and Values

struct | CRNum

## Description

## Functions

### cr_num_new ()

    CRNum *
    cr_num_new (void);

CRNum.

Returns the newly built instance of CRNum.

### cr_num_new_with_val ()

    CRNum *
    cr_num_new_with_val (gdouble a_val,
                         enum CRNumType a_type);

A constructor of CRNum.

Returns the newly built instance of CRNum or NULL if an error arises.

#### Parameters

a_val | the numerical value of the number. |
a_type | the type of number. |

### cr_num_dup ()

    CRNum *
    cr_num_dup (CRNum const *a_this);

Duplicates an instance of CRNum

Returns the newly created (duplicated) instance of CRNum. Must be freed by `cr_num_destroy()`.

#### Parameters

a_this | the instance of CRNum to duplicate. |

### cr_num_to_string ()

    guchar *
    cr_num_to_string (CRNum const *a_this);

Returns the newly built string representation of the current instance of CRNum. The returned string is NULL terminated. The caller *must* free the returned string.

#### Parameters

a_this | the current instance of CRNum. |

### cr_num_copy ()

    enum CRStatus
    cr_num_copy (CRNum *a_dest,
                 CRNum const *a_src);

Copies an instance of CRNum.

Returns CR_OK upon successful completion, an error code otherwise.

#### Parameters

a_src | the instance of CRNum to copy. Must be non NULL. |
a_dest | the destination of the copy. Must be non NULL |

### cr_num_set ()

    enum CRStatus
    cr_num_set (CRNum *a_this,
                gdouble a_val,
                enum CRNumType a_type);

Returns CR_OK upon succesful completion, an error code otherwise.

#### Parameters

a_this | the current instance of CRNum to be set. |
a_val | the new numerical value to be hold by the current instance of CRNum |
a_type | the new type of CRNum. |

### cr_num_is_fixed_length ()

    gboolean
    cr_num_is_fixed_length (CRNum const *a_this);

Tests if the current instance of CRNum is a fixed length value or not. Typically a fixed length value is anything from NUM_LENGTH_EM to NUM_LENGTH_PC. See the definition of CRNumType to see what we mean.

Returns TRUE if the instance of CRNum is a fixed length number, FALSE otherwise.

#### Parameters

a_this | the current instance of CRNum . |

### cr_num_destroy ()

    void
    cr_num_destroy (CRNum *a_this);

The destructor of CRNum.

#### Parameters

a_this | the this pointer of the current instance of CRNum. |

## Types and Values

### struct CRNum

    struct CRNum {
            enum CRNumType type ;
            gdouble val ;
            CRParsingLocation location ;
    };