## MgQfValue

MgQfValue — Represents a single value (or a parameter)

## Synopsis

    struct      MgQfValue;
    guint       mg_qf_value_get_type            (void);
    GObject*    mg_qf_value_new                 (MgQuery *query,
                                                 MgServerDataType *type);
    void        mg_qf_value_set_value           (MgQfValue *field,
                                                 const GdaValue *val);
    const GdaValue* mg_qf_value_get_value       (MgQfValue *field);
    void        mg_qf_value_set_default_value   (MgQfValue *field,
                                                 const GdaValue *default_val);
    const GdaValue* mg_qf_value_get_default_value
                                                (MgQfValue *field);
    GdaValueType mg_qf_value_get_value_type     (MgQfValue *field);
    MgServerDataType* mg_qf_value_get_server_data_type
                                                (MgQfValue *field);
    void        mg_qf_value_set_is_parameter    (MgQfValue *field,
                                                 gboolean is_param);
    gboolean    mg_qf_value_is_parameter        (MgQfValue *field);
    void        mg_qf_value_set_not_null        (MgQfValue *field,
                                                 gboolean not_null);
    gboolean    mg_qf_value_get_not_null        (MgQfValue *field);
    gboolean    mg_qf_value_is_value_null       (MgQfValue *field,
                                                 MgContext *context);

## Object Hierarchy

      GObject
       +----MgBase
             +----MgQfield
                   +----MgQfValue

## Implemented Interfaces

MgQfValue implements MgXmlStorage, MgRenderer, MgReferer and MgField.

## Properties

      "handler-plugin"       gchararray           : Read / Write
      "query"                gpointer             : Read / Write
      "value-provider"       gpointer             : Read / Write
      "value-provider-xml-id" gchararray           : Read / Write

## Signal Prototypes

    "templ-signal"
                void        user_function      (MgQfValue *mgqfvalue,
                                                gpointer user_data);

## Description

The value held in this object can be of any type (a MgServerDataType object must be provided when creating the object). If the value can be considered as a parameter, then the possible values for this parameter can be limited by the result of the execution of a sub query (use the "value_provider*" properties to tell from which query field the values will be taken).

## Details

### struct MgQfValue

    struct MgQfValue;

### mg_qf_value_get_type ()

    guint       mg_qf_value_get_type            (void);

Returns : |

### mg_qf_value_new ()

    GObject*    mg_qf_value_new                 (MgQuery *query,
                                                 MgServerDataType *type);

Creates a new MgQfValue object which represents a value or a parameter.

`query` : | a MgQuery in which the new object will be
`type` : | the requested type for the value
Returns : | the new object

### mg_qf_value_set_value ()

    void        mg_qf_value_set_value           (MgQfValue *field,
                                                 const GdaValue *val);

Sets the value of `field`, or removes it (if `val` is `NULL`)

`field` : | a MgQfValue object
`val` : | the value to be set, or `NULL`

### mg_qf_value_get_value ()

    const GdaValue* mg_qf_value_get_value       (MgQfValue *field);

Get the value stored by `field`. If there is no value, but a default value exists, then the default value is returned.n it's up to the caller to test if there is a default value for `field`. The default value can be of a different type than the one expected by `field`.

`field` : | a MgQfValue object
Returns : | the value or NULL

### mg_qf_value_set_default_value ()

    void        mg_qf_value_set_default_value   (MgQfValue *field,
                                                 const GdaValue *default_val);

Sets the default value of `field`, or removes it (if `default_val` is `NULL`)

`field` : | a MgQfValue object
`default_val` : | the default value to be set, or `NULL`

### mg_qf_value_get_default_value ()

    const GdaValue* mg_qf_value_get_default_value
                                                (MgQfValue *field);

Get the default value stored by `field`.

`field` : | a MgQfValue object
Returns : | the value or NULL

### mg_qf_value_get_value_type ()

    GdaValueType mg_qf_value_get_value_type     (MgQfValue *field);

Get the GDA type of value stored within `field`

`field` : | a MgQfValue object
Returns : | the type

### mg_qf_value_get_server_data_type ()

    MgServerDataType* mg_qf_value_get_server_data_type
                                                (MgQfValue *field);

Get the MgserverDataType type of `field`

`field` : | a MgQfValue object
Returns : | the MgserverDataType type

### mg_qf_value_set_is_parameter ()

    void        mg_qf_value_set_is_parameter    (MgQfValue *field,
                                                 gboolean is_param);

Sets wether `field` can be considered as a parameter

`field` : | a MgQfValue object
`is_param` : |

### mg_qf_value_is_parameter ()

    gboolean    mg_qf_value_is_parameter        (MgQfValue *field);

Tells if `field` can be considered as a parameter

`field` : | a MgQfValue object
Returns : | TRUE if `field` can be considered as a parameter

### mg_qf_value_set_not_null ()

    void        mg_qf_value_set_not_null        (MgQfValue *field,
                                                 gboolean not_null);

Sets if a NULL value is acceptable for `field`. If `not_null` is TRUE, then `field` can't have a NULL value.

`field` : | a MgQfValue object
`not_null` : |

### mg_qf_value_get_not_null ()

    gboolean    mg_qf_value_get_not_null        (MgQfValue *field);

Tells if `field` can receive a NULL value.

`field` : | a MgQfValue object
Returns : | TRUE if `field` can't have a NULL value

### mg_qf_value_is_value_null ()

    gboolean    mg_qf_value_is_value_null       (MgQfValue *field,
                                                 MgContext *context);

Tells if `field` represents a NULL value.

`field` : | a MgQfValue object
`context` : | a MgContext object
Returns : |

## Properties

"`handler-plugin`" (gchararray : Read / Write) |
"`query`" (gpointer : Read / Write) |
"`value-provider`" (gpointer : Read / Write) |
"`value-provider-xml-id`" (gchararray : Read / Write) |

## Signals

### The "templ-signal" signal

    void        user_function                  (MgQfValue *mgqfvalue,
                                                gpointer user_data);

`mgqfvalue` : | the object which received the signal.
`user_data` : | user data set when the signal handler was connected.