xmlNodePtr
qof_instance_slots_to_dom_tree(const char *tag, const QofInstance* inst)
{
    xmlNodePtr ret;
    const char ** keys;
    unsigned int i;
    KvpFrame *frame = qof_instance_get_slots(inst);
    if (!frame)
        return nullptr;

    ret = xmlNewNode(nullptr, BAD_CAST tag);
    frame->for_each_slot(add_kvp_slot, static_cast<void*>(ret));
    return ret;
}
Example #2
0
GHashTable *
qof_book_get_features (QofBook *book)
{
    KvpFrame *frame = qof_instance_get_slots (QOF_INSTANCE (book));
    GHashTable *features = g_hash_table_new_full (g_str_hash, g_str_equal,
                                                  NULL, g_free);

    auto slot = frame->get_slot(GNC_FEATURES);
    if (slot != nullptr)
    {
	frame = slot->get<KvpFrame*>();
	frame->for_each_slot(&add_feature_to_hash, &features);
    }
    return features;
}
Example #3
0
gboolean
gnc_sql_slots_save( GncSqlBackend* be, const GncGUID* guid, gboolean is_infant,
                    QofInstance *inst)
{
     slot_info_t slot_info = { NULL, NULL, TRUE, NULL, KvpValue::Type::INVALID, NULL, FRAME, NULL, g_string_new(NULL) };
     KvpFrame *pFrame = qof_instance_get_slots (inst);

    g_return_val_if_fail( be != NULL, FALSE );
    g_return_val_if_fail( guid != NULL, FALSE );
    g_return_val_if_fail( pFrame != NULL, FALSE );

    // If this is not saving into a new db, clear out the old saved slots first
    if ( !be->is_pristine_db && !is_infant )
    {
        (void)gnc_sql_slots_delete( be, guid );
    }

    slot_info.be = be;
    slot_info.guid = guid;
    pFrame->for_each_slot(save_slot, &slot_info);
    (void)g_string_free( slot_info.path, TRUE );

    return slot_info.is_ok;
}