Пример #1
0
static void
set_numeric_val( gpointer pObject, gnc_numeric value )
{
    slot_info_t* pInfo = (slot_info_t*)pObject;
    KvpValue *pValue = NULL;

    g_return_if_fail( pObject != NULL );

    if ( pInfo->value_type != KvpValue::Type::NUMERIC ) return;
    set_slot_from_value(pInfo, new KvpValue{value});
}
Пример #2
0
static void
set_gdate_val( gpointer pObject, GDate* value )
{
    slot_info_t* pInfo = (slot_info_t*)pObject;
    KvpValue *pValue = NULL;

    g_return_if_fail( pObject != NULL );

    if ( pInfo->value_type != KvpValue::Type::GDATE ) return;
    set_slot_from_value(pInfo, new KvpValue{*value});
}
Пример #3
0
static void
set_gdate_val( gpointer pObject, GDate* value )
{
    slot_info_t* pInfo = (slot_info_t*)pObject;
    KvpValue *pValue = NULL;

    g_return_if_fail( pObject != NULL );

    if ( pInfo->value_type != KVP_TYPE_GDATE ) return;
    pValue = kvp_value_new_gdate( *value );
    set_slot_from_value( pInfo, pValue );
}
Пример #4
0
static void
set_numeric_val( gpointer pObject, gnc_numeric value )
{
    slot_info_t* pInfo = (slot_info_t*)pObject;
    KvpValue *pValue = NULL;

    g_return_if_fail( pObject != NULL );

    if ( pInfo->value_type != KVP_TYPE_NUMERIC ) return;
    pValue = kvp_value_new_numeric( value );
    set_slot_from_value( pInfo, pValue );
}
Пример #5
0
static void
set_timespec_val( gpointer pObject, Timespec ts )
{
    slot_info_t* pInfo = (slot_info_t*)pObject;
    KvpValue *value = NULL;

    g_return_if_fail( pObject != NULL );

    if ( pInfo->value_type != KVP_TYPE_TIMESPEC ) return;
    value = kvp_value_new_timespec( ts );
    set_slot_from_value( pInfo, value );
}
Пример #6
0
static void
set_double_val( gpointer pObject, /*@ null @*/ gpointer pValue )
{
    slot_info_t* pInfo = (slot_info_t*)pObject;
    KvpValue *value = NULL;

    g_return_if_fail( pObject != NULL );

    if ( pInfo->value_type != KVP_TYPE_DOUBLE || pValue == NULL ) return;
    value = kvp_value_new_double( *((double*)pValue) );
    set_slot_from_value( pInfo, value );
}
Пример #7
0
static void
set_string_val( gpointer pObject, /*@ null @*/ gpointer pValue )
{
    slot_info_t* pInfo = (slot_info_t*)pObject;
    KvpValue *value = NULL;

    g_return_if_fail( pObject != NULL );

    if ( pInfo->value_type != KVP_TYPE_STRING || pValue == NULL ) return;
    value = kvp_value_new_string( (gchar*)pValue );
    set_slot_from_value( pInfo, value );
}
Пример #8
0
static void
set_int64_val( gpointer pObject, gint64 value )
{
    slot_info_t* pInfo = (slot_info_t*)pObject;
    KvpValue *pValue = NULL;

    g_return_if_fail( pObject != NULL );

    if ( pInfo->value_type != KVP_TYPE_GINT64 ) return;
    pValue = kvp_value_new_gint64( value );
    set_slot_from_value( pInfo, pValue );
}
Пример #9
0
static void
set_timespec_val( gpointer pObject, Timespec ts )
{
    slot_info_t* pInfo = (slot_info_t*)pObject;
    KvpValue *value = NULL;

    g_return_if_fail( pObject != NULL );

    if ( pInfo->value_type != KvpValue::Type::TIMESPEC ) return;
    value = new KvpValue{ts};
    set_slot_from_value( pInfo, value );
}
Пример #10
0
static void
set_double_val( gpointer pObject, /*@ null @*/ gpointer pValue )
{
    slot_info_t* pInfo = (slot_info_t*)pObject;
    KvpValue *value = NULL;

    g_return_if_fail( pObject != NULL );

    if ( pInfo->value_type != KvpValue::Type::DOUBLE || pValue == NULL ) return;
    value = new KvpValue{*(static_cast<double*>(pValue))};
    set_slot_from_value( pInfo, value );
}
Пример #11
0
static void
set_string_val( gpointer pObject, /*@ null @*/ gpointer pValue )
{
    slot_info_t* pInfo = (slot_info_t*)pObject;
    g_return_if_fail( pObject != NULL );

    if (pInfo->value_type != KvpValue::Type::STRING || pValue == NULL)
        return;
    auto string = g_strdup(static_cast<const char*>(pValue));
    auto value = new KvpValue{string};
    set_slot_from_value( pInfo, value );
}
Пример #12
0
static void
set_int64_val( gpointer pObject, gint64 value )
{
    slot_info_t* pInfo = (slot_info_t*)pObject;
    KvpValue *pValue = NULL;

    g_return_if_fail( pObject != NULL );

    if ( pInfo->value_type != KvpValue::Type::INT64 ) return;
    pValue = new KvpValue{value};
    set_slot_from_value( pInfo, pValue );
}
Пример #13
0
static void
set_guid_val( gpointer pObject, /*@ null @*/ gpointer pValue )
{
    slot_info_t* pInfo = (slot_info_t*)pObject;

    g_return_if_fail( pObject != NULL );
    if ( pValue == NULL ) return;

    switch ( pInfo->value_type)
    {
    case KVP_TYPE_GUID:
    {
        KvpValue *value = kvp_value_new_guid( (GncGUID*)pValue );
        set_slot_from_value( pInfo, value );
        break;
    }
    case KVP_TYPE_GLIST:
    {
        slot_info_t *newInfo = slot_info_copy( pInfo, (GncGUID*)pValue );
        kvp_value *pValue = NULL;
        gchar *key = get_key_from_path( pInfo->path );

        newInfo->context = LIST;

        slots_load_info( newInfo );
        pValue = kvp_value_new_glist_nc( newInfo->pList );
        kvp_frame_set_slot_nc(pInfo->pKvpFrame, key, pValue);
        g_string_free( newInfo->path, TRUE );
        g_slice_free( slot_info_t, newInfo );
        g_free( key );
        break;
    }
    case KVP_TYPE_FRAME:
    {
        slot_info_t *newInfo = slot_info_copy( pInfo, (GncGUID*)pValue ) ;
        KvpFrame *newFrame = kvp_frame_new();
        newInfo->pKvpFrame = newFrame;

        switch ( pInfo->context )
        {
        case LIST:
        {
            KvpValue *value = kvp_value_new_frame_nc( newFrame );
            gchar *key = get_key_from_path( pInfo->path );
            newInfo->path = g_string_assign( newInfo->path, key );
            pInfo->pList = g_list_append( pInfo->pList, value );
            g_free( key );
            break;
        }
        case FRAME:
        default:
        {
            gchar *key = get_key_from_path( pInfo->path );
            kvp_frame_set_frame_nc( pInfo->pKvpFrame, key, newFrame );
            g_free( key );
            break;
        }
        }

        newInfo->context = FRAME;
        slots_load_info ( newInfo );
        g_string_free( newInfo->path, TRUE );
        g_slice_free( slot_info_t, newInfo );
        break;
    }
    default:
        break;
    }
}
Пример #14
0
static void
set_guid_val( gpointer pObject, /*@ null @*/ gpointer pValue )
{
    slot_info_t* pInfo = (slot_info_t*)pObject;

    g_return_if_fail( pObject != NULL );
    if ( pValue == NULL ) return;

    switch ( pInfo->value_type)
    {
    case KvpValue::Type::GUID:
    {
        auto new_guid = guid_copy(static_cast<GncGUID*>(pValue));
        set_slot_from_value(pInfo, new KvpValue{new_guid});
        break;
    }
    case KvpValue::Type::GLIST:
    {
        slot_info_t *newInfo = slot_info_copy( pInfo, (GncGUID*)pValue );
        KvpValue *pValue = NULL;
        gchar *key = get_key_from_path( pInfo->path );

        newInfo->context = LIST;

        slots_load_info( newInfo );
        pValue = new KvpValue{newInfo->pList};
        pInfo->pKvpFrame->set(key, pValue);
        g_string_free( newInfo->path, TRUE );
        g_slice_free( slot_info_t, newInfo );
        g_free( key );
        break;
    }
    case KvpValue::Type::FRAME:
    {
        slot_info_t *newInfo = slot_info_copy( pInfo, (GncGUID*)pValue ) ;
        auto newFrame = new KvpFrame;
        newInfo->pKvpFrame = newFrame;

        switch ( pInfo->context )
        {
        case LIST:
        {
            auto value = new KvpValue{newFrame};
            gchar *key = get_key_from_path( pInfo->path );
            newInfo->path = g_string_assign( newInfo->path, key );
            pInfo->pList = g_list_append( pInfo->pList, value );
            g_free( key );
            break;
        }
        case FRAME:
        default:
        {
            gchar *key = get_key_from_path( pInfo->path );
            pInfo->pKvpFrame->set(key, new KvpValue{newFrame});
            g_free( key );
            break;
        }
        }

        newInfo->context = FRAME;
        slots_load_info ( newInfo );
        g_string_free( newInfo->path, TRUE );
        g_slice_free( slot_info_t, newInfo );
        break;
    }
    default:
        break;
    }
}