• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ qof_instance_get_slots函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中qof_instance_get_slots函数的典型用法代码示例。如果您正苦于以下问题:C++ qof_instance_get_slots函数的具体用法?C++ qof_instance_get_slots怎么用?C++ qof_instance_get_slots使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了qof_instance_get_slots函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: write_book_parts

gboolean
write_book_parts(FILE *out, QofBook *book)
{
    xmlNodePtr domnode;

    domnode = guid_to_dom_tree(book_id_string, qof_book_get_guid(book));
    xmlElemDump(out, NULL, domnode);
    xmlFreeNode (domnode);

    if (ferror(out) || fprintf(out, "\n") < 0)
        return FALSE;

    if (qof_instance_get_slots (QOF_INSTANCE (book)))
    {
        xmlNodePtr kvpnode = kvp_frame_to_dom_tree(book_slots_string,
                             qof_instance_get_slots (QOF_INSTANCE (book)));
        if (kvpnode)
        {
            xmlElemDump(out, NULL, kvpnode);
            xmlFreeNode(kvpnode);

            if (ferror(out) || fprintf(out, "\n") < 0)
                return FALSE;
        }
    }

    return TRUE;
}
开发者ID:814ckf0x,项目名称:gnucash,代码行数:28,代码来源:gnc-book-xml-v2.c


示例2: gnc_book_dom_tree_create

xmlNodePtr
gnc_book_dom_tree_create(QofBook *book)
{
    xmlNodePtr ret;
    G_GNUC_UNUSED gboolean allow_incompat = TRUE;

    ret = xmlNewNode(NULL, BAD_CAST gnc_book_string);
    xmlSetProp(ret, BAD_CAST "version", BAD_CAST gnc_v2_book_version_string);

    xmlAddChild(ret, guid_to_dom_tree(book_id_string,
                                      qof_book_get_guid(book)));

    if (qof_instance_get_slots (QOF_INSTANCE (book)))
    {
        xmlNodePtr kvpnode = kvp_frame_to_dom_tree(book_slots_string,
                             qof_instance_get_slots (QOF_INSTANCE (book)));
        if (kvpnode)
            xmlAddChild(ret, kvpnode);
    }

#ifdef IMPLEMENT_BOOK_DOM_TREES_LATER
    /* theoretically, we should be adding all the below to the book
     * but in fact, there's enough brain damage in the code already
     * that we are only going to hand-edit the file at a higher layer.
     * And that's OK, since its probably a performance boost anyway.
     */
    xmlAddChild(ret, gnc_commodity_dom_tree_create(
                    gnc_commodity_table_get_table(book)));
    xmlAddChild(ret, gnc_pricedb_dom_tree_create(gnc_pricedb_get_db(book)));
    if (allow_incompat)
    {
        accnode = gnc_account_dom_tree_create(account, FALSE);
        xmlAddChild (ret, rootAccNode);
    }
    append_account_tree (ret, gnc_book_get_root(book));

    xaccAccountTreeForEachTransaction (gnc_book_get_root_account(book),
                                       traverse_txns, ret);

    /* xxx FIXME hack alert how are we going to handle
     *  gnc_book_get_template_group handled ???   */
    xmlAddChild(ret, gnc_schedXaction_dom_tree_create(
                    gnc_book_get_schedxactions(book)));

#endif

    return ret;
}
开发者ID:814ckf0x,项目名称:gnucash,代码行数:48,代码来源:gnc-book-xml-v2.c


示例3: billterm_slots_handler

static gboolean
billterm_slots_handler (xmlNodePtr node, gpointer billterm_pdata)
{
    struct billterm_pdata *pdata = billterm_pdata;
    return dom_tree_to_kvp_frame_given (node,
                                        qof_instance_get_slots (QOF_INSTANCE(pdata->term)));
}
开发者ID:kleopatra999,项目名称:gnucash-2,代码行数:7,代码来源:gnc-bill-term-xml-v2.c


示例4: customer_slots_handler

static gboolean
customer_slots_handler (xmlNodePtr node, gpointer cust_pdata)
{
    struct customer_pdata *pdata = cust_pdata;
    return dom_tree_to_kvp_frame_given (node,
                                        qof_instance_get_slots (QOF_INSTANCE(pdata->customer)));
}
开发者ID:573,项目名称:gnucash,代码行数:7,代码来源:gnc-customer-xml-v2.c


示例5: load_slot_for_list_item

static void
load_slot_for_list_item( GncSqlBackend* be, GncSqlRow* row, QofCollection* coll )
{
    slot_info_t slot_info = { NULL, NULL, TRUE, NULL, 0, NULL, FRAME, NULL, NULL };
    const GncGUID* guid;
    QofInstance* inst;

    g_return_if_fail( be != NULL );
    g_return_if_fail( row != NULL );
    g_return_if_fail( coll != NULL );

    guid = load_obj_guid( be, row );
    g_assert( guid != NULL );
    inst = qof_collection_lookup_entity( coll, guid );

    slot_info.be = be;
    slot_info.pKvpFrame = qof_instance_get_slots( inst );
    slot_info.context = NONE;

    gnc_sql_load_object( be, row, TABLE_NAME, &slot_info, col_table );

    if ( slot_info.path != NULL )
    {
        (void)g_string_free( slot_info.path, TRUE );
    }
}
开发者ID:nishmu,项目名称:gnucash,代码行数:26,代码来源:gnc-slots-sql.c


示例6: qof_book_get_default_gains_policy

/** Returns pointer to default gain/loss policy for book, if one exists in the
  * KVP, or NULL; does not validate contents nor determine if there is a valid
  * book-currency, both of which are required, for the 'book-currency'
  * currency accounting method to apply. Use instead
  * 'gnc_book_get_default_gains_policy' which does these validations. */
const gchar *
qof_book_get_default_gains_policy (QofBook *book)
{
    KvpFrame *kvp;
    KvpValue *value;

    if (!book)
    {
        PWARN ("No book!!!");
        return NULL;
    }

    /* Get the KVP from the current book */
    kvp = qof_instance_get_slots (QOF_INSTANCE (book));

    if (!kvp)
    {
        PWARN ("Book has no KVP_Frame");
        return NULL;
    }

    /* See if there is a default gain/loss policy */
    value = kvp->get_slot({KVP_OPTION_PATH, OPTION_SECTION_ACCOUNTS,
                           OPTION_NAME_DEFAULT_GAINS_POLICY});
    if (!value)
    /* No default gain/loss policy, therefore not valid book-currency
       accounting method */
        return nullptr;

    return g_strdup(value->get<const char*>());
}
开发者ID:frenzypony,项目名称:gnucash,代码行数:36,代码来源:qofbook.cpp


示例7: gnc_address_to_dom_tree

xmlNodePtr
gnc_address_to_dom_tree (const char *tag, GncAddress *addr)
{
    xmlNodePtr ret;
    KvpFrame *kf;

    ret = xmlNewNode(NULL, BAD_CAST tag);
    xmlSetProp(ret, BAD_CAST "version", BAD_CAST address_version_string);

    maybe_add_string (ret, addr_name_string, gncAddressGetName (addr));

    maybe_add_string (ret, addr_addr1_string, gncAddressGetAddr1 (addr));
    maybe_add_string (ret, addr_addr2_string, gncAddressGetAddr2 (addr));
    maybe_add_string (ret, addr_addr3_string, gncAddressGetAddr3 (addr));
    maybe_add_string (ret, addr_addr4_string, gncAddressGetAddr4 (addr));

    maybe_add_string (ret, addr_phone_string, gncAddressGetPhone (addr));
    maybe_add_string (ret, addr_fax_string, gncAddressGetFax (addr));
    maybe_add_string (ret, addr_email_string, gncAddressGetEmail (addr));

    kf = qof_instance_get_slots (QOF_INSTANCE(addr));
    if (kf)
    {
        xmlNodePtr kvpnode = kvp_frame_to_dom_tree(addr_slots_string, kf);
        if (kvpnode)
        {
            xmlAddChild(ret, kvpnode);
        }
    }

    return ret;
}
开发者ID:814ckf0x,项目名称:gnucash,代码行数:32,代码来源:gnc-address-xml-v2.c


示例8: employee_slots_handler

static gboolean
employee_slots_handler (xmlNodePtr node, gpointer employee_pdata)
{
    struct employee_pdata *pdata = employee_pdata;
    return dom_tree_to_kvp_frame_given (
               node, qof_instance_get_slots (QOF_INSTANCE(pdata->employee)));
}
开发者ID:kleopatra999,项目名称:gnucash-2,代码行数:7,代码来源:gnc-employee-xml-v2.c


示例9: qof_book_get_book_currency

/** Returns pointer to book-currency name for book, if one exists in the
  * KVP, or NULL; does not validate contents nor determine if there is a valid
  * default gain/loss policy, both of which are required, for the
  * 'book-currency' currency accounting method to apply. Use instead
  * 'gnc_book_get_book_currency' which does these validations. */
const gchar *
qof_book_get_book_currency (QofBook *book)
{
    KvpFrame *kvp;
    KvpValue *value;

    if (!book)
    {
        PWARN ("No book!!!");
        return NULL;
    }

    /* Get the KVP from the current book */
    kvp = qof_instance_get_slots (QOF_INSTANCE (book));

    if (!kvp)
    {
        PWARN ("Book has no KVP_Frame");
        return NULL;
    }

    /* See if there is a book currency. */
    value = kvp->get_slot({KVP_OPTION_PATH, OPTION_SECTION_ACCOUNTS,
                           OPTION_NAME_BOOK_CURRENCY});
    if (!value) /* No book-currency */
        return nullptr;

    return value->get<const char*>();
}
开发者ID:frenzypony,项目名称:gnucash,代码行数:34,代码来源:qofbook.cpp


示例10: TEST_F

TEST_F(ImapBayesTest, FindAccountBayes)
{
    auto root = qof_instance_get_slots(QOF_INSTANCE(t_bank_account));
    auto acct1_guid = guid_to_string (xaccAccountGetGUID(t_expense_account1));
    auto acct2_guid = guid_to_string (xaccAccountGetGUID(t_expense_account2));
    auto value = new KvpValue(INT64_C(42));

    root->set_path({IMAP_FRAME_BAYES, foo, acct1_guid}, value);
    root->set_path({IMAP_FRAME_BAYES, bar, acct1_guid}, value);
    root->set_path({IMAP_FRAME_BAYES, baz, acct2_guid}, value);
    root->set_path({IMAP_FRAME_BAYES, waldo, acct2_guid}, value);
    root->set_path({IMAP_FRAME_BAYES, pepper, acct1_guid}, value);
    root->set_path({IMAP_FRAME_BAYES, salt, acct2_guid}, value);

    auto account = gnc_account_imap_find_account_bayes(t_imap, t_list1);
    EXPECT_EQ(t_expense_account1, account);
    account = gnc_account_imap_find_account_bayes(t_imap, t_list2);
    EXPECT_EQ(t_expense_account2, account);
    account = gnc_account_imap_find_account_bayes(t_imap, t_list3);
    EXPECT_EQ(t_expense_account1, account);
    account = gnc_account_imap_find_account_bayes(t_imap, t_list4);
    EXPECT_EQ(t_expense_account2, account);
    account = gnc_account_imap_find_account_bayes(t_imap, t_list5);
    EXPECT_EQ(nullptr, account);
}
开发者ID:TumbleweedPretzel,项目名称:gnucash,代码行数:25,代码来源:gtest-import-map.cpp


示例11: load_slot_for_book_object

static void
load_slot_for_book_object( GncSqlBackend* be, GncSqlRow* row, BookLookupFn lookup_fn )
{
    slot_info_t slot_info = { NULL, NULL, TRUE, NULL, 0, NULL, FRAME, NULL, NULL };
    const GncGUID* guid;
    QofInstance* inst;

    g_return_if_fail( be != NULL );
    g_return_if_fail( row != NULL );
    g_return_if_fail( lookup_fn != NULL );

    guid = load_obj_guid( be, row );
    g_return_if_fail( guid != NULL );
    inst = lookup_fn( guid, be->book );
    g_return_if_fail( inst != NULL );

    slot_info.be = be;
    slot_info.pKvpFrame = qof_instance_get_slots( inst );
    slot_info.path = NULL;

    gnc_sql_load_object( be, row, TABLE_NAME, &slot_info, col_table );

    if ( slot_info.path != NULL )
    {
        (void)g_string_free( slot_info.path, TRUE );
    }
}
开发者ID:nishmu,项目名称:gnucash,代码行数:27,代码来源:gnc-slots-sql.c


示例12: address_slots_handler

static gboolean
address_slots_handler (xmlNodePtr node, gpointer addr_pdata)
{
    struct address_pdata *pdata = addr_pdata;

    return dom_tree_to_kvp_frame_given
        (node, qof_instance_get_slots (QOF_INSTANCE (pdata->address)));
}
开发者ID:814ckf0x,项目名称:gnucash,代码行数:8,代码来源:gnc-address-xml-v2.c


示例13: job_slots_handler

static gboolean
job_slots_handler (xmlNodePtr node, gpointer job_pdata)
{
    struct job_pdata *pdata = job_pdata;

    return dom_tree_to_kvp_frame_given
        (node, qof_instance_get_slots (QOF_INSTANCE (pdata->job)));
}
开发者ID:Danvil,项目名称:gnucash,代码行数:8,代码来源:gnc-job-xml-v2.c


示例14: qof_book_get_string_option

const char*
qof_book_get_string_option(const QofBook* book, const char* opt_name)
{
    auto slot = qof_instance_get_slots(QOF_INSTANCE (book))->get_slot(opt_name);
    if (slot == nullptr)
        return nullptr;
    return slot->get<const char*>();
}
开发者ID:frenzypony,项目名称:gnucash,代码行数:8,代码来源:qofbook.cpp


示例15: create_session

static QofSession*
create_session(void)
{
    QofSession* session = qof_session_new();
    QofBook* book = qof_session_get_book( session );
    Account* root = gnc_book_get_root_account( book );
    Account* acct1;
    Account* acct2;
    KvpFrame* frame;
    Transaction* tx;
    Split* spl1;
    Split* spl2;
    Timespec ts;
    struct timeval tv;
    gnc_commodity_table* table;
    gnc_commodity* currency;

    table = gnc_commodity_table_get_table( book );
    currency = gnc_commodity_table_lookup( table, GNC_COMMODITY_NS_CURRENCY, "CAD" );

    acct1 = xaccMallocAccount( book );
    xaccAccountSetType( acct1, ACCT_TYPE_BANK );
    xaccAccountSetName( acct1, "Bank 1" );
    xaccAccountSetCommodity( acct1, currency );

    frame = qof_instance_get_slots( QOF_INSTANCE(acct1) );
    kvp_frame_set_gint64( frame, "int64-val", 100 );
    kvp_frame_set_double( frame, "double-val", 3.14159 );
    kvp_frame_set_numeric( frame, "numeric-val", gnc_numeric_zero() );

    time( &(tv.tv_sec) );
    tv.tv_usec = 0;
    ts.tv_sec = tv.tv_sec;
    ts.tv_nsec = 1000 * tv.tv_usec;
    kvp_frame_set_timespec( frame, "timespec-val", ts );

    kvp_frame_set_string( frame, "string-val", "abcdefghijklmnop" );
    kvp_frame_set_guid( frame, "guid-val", qof_instance_get_guid( QOF_INSTANCE(acct1) ) );

    gnc_account_append_child( root, acct1 );

    acct2 = xaccMallocAccount( book );
    xaccAccountSetType( acct2, ACCT_TYPE_BANK );
    xaccAccountSetName( acct2, "Bank 1" );

    tx = xaccMallocTransaction( book );
    xaccTransBeginEdit( tx );
    xaccTransSetCurrency( tx, currency );
    spl1 = xaccMallocSplit( book );
    xaccTransAppendSplit( tx, spl1 );
    spl2 = xaccMallocSplit( book );
    xaccTransAppendSplit( tx, spl2 );
    xaccTransCommitEdit( tx );


    return session;
}
开发者ID:kleopatra999,项目名称:gnucash-2,代码行数:57,代码来源:test-dbi-basic.c


示例16: qof_book_get_option

KvpValue*
qof_book_get_option (QofBook *book, GSList *path)
{
    KvpFrame *root = qof_instance_get_slots(QOF_INSTANCE (book));
    Path path_v {KVP_OPTION_PATH};
    for (auto item = path; item != nullptr; item = g_slist_next(item))
        path_v.push_back(static_cast<const char*>(item->data));
    return root->get_slot(path_v);
}
开发者ID:frenzypony,项目名称:gnucash,代码行数:9,代码来源:qofbook.cpp


示例17: qof_book_set_feature

void
qof_book_set_feature (QofBook *book, const gchar *key, const gchar *descr)
{
    KvpFrame *frame = qof_instance_get_slots (QOF_INSTANCE (book));
    qof_book_begin_edit (book);
    delete frame->set_path({GNC_FEATURES, key}, new KvpValue(descr));
    qof_instance_set_dirty (QOF_INSTANCE (book));
    qof_book_commit_edit (book);
}
开发者ID:frenzypony,项目名称:gnucash,代码行数:9,代码来源:qofbook.cpp


示例18: qof_book_set_string_option

void
qof_book_set_string_option(QofBook* book, const char* opt_name, const char* opt_val)
{
    qof_book_begin_edit(book);
    auto frame = qof_instance_get_slots(QOF_INSTANCE(book));
    delete frame->set(opt_name, new KvpValue(opt_val));
    qof_instance_set_dirty (QOF_INSTANCE (book));
    qof_book_commit_edit(book);
}
开发者ID:frenzypony,项目名称:gnucash,代码行数:9,代码来源:qofbook.cpp


示例19: billterm_dom_tree_create

static xmlNodePtr
billterm_dom_tree_create (GncBillTerm *term)
{
    xmlNodePtr ret, data, kvpnode;

    ret = xmlNewNode(NULL, BAD_CAST gnc_billterm_string);
    xmlSetProp(ret, BAD_CAST "version", BAD_CAST billterm_version_string);

    maybe_add_guid(ret, billterm_guid_string, QOF_INSTANCE(term));
    xmlAddChild(ret, text_to_dom_tree (billterm_name_string,
                                       gncBillTermGetName (term)));
    xmlAddChild(ret, text_to_dom_tree (billterm_desc_string,
                                       gncBillTermGetDescription (term)));

    xmlAddChild(ret, int_to_dom_tree (billterm_refcount_string,
                                      gncBillTermGetRefcount (term)));
    xmlAddChild(ret, int_to_dom_tree (billterm_invisible_string,
                                      gncBillTermGetInvisible (term)));

    kvpnode = kvp_frame_to_dom_tree (billterm_slots_string,
                                     qof_instance_get_slots (QOF_INSTANCE(term)));
    if (kvpnode) xmlAddChild (ret, kvpnode);


    /* We should not be our own child */
    if (gncBillTermGetChild(term) != term)
        maybe_add_guid(ret, billterm_child_string,
                       QOF_INSTANCE(gncBillTermGetChild (term)));

    maybe_add_guid(ret, billterm_parent_string,
                   QOF_INSTANCE(gncBillTermGetParent (term)));

    switch (gncBillTermGetType (term))
    {
    case GNC_TERM_TYPE_DAYS:
        data = xmlNewChild (ret, NULL, BAD_CAST gnc_daystype_string, NULL);
        maybe_add_int (data, days_duedays_string, gncBillTermGetDueDays (term));
        maybe_add_int (data, days_discdays_string,
                       gncBillTermGetDiscountDays (term));
        maybe_add_numeric (data, days_discount_string,
                           gncBillTermGetDiscount (term));
        break;

    case GNC_TERM_TYPE_PROXIMO:
        data = xmlNewChild (ret, NULL, BAD_CAST gnc_proximotype_string, NULL);
        maybe_add_int (data, prox_dueday_string, gncBillTermGetDueDays (term));
        maybe_add_int (data, prox_discday_string,
                       gncBillTermGetDiscountDays (term));
        maybe_add_numeric (data, prox_discount_string,
                           gncBillTermGetDiscount (term));
        maybe_add_int (data, prox_cutoff_string, gncBillTermGetCutoff (term));
        break;
    }

    return ret;
}
开发者ID:kleopatra999,项目名称:gnucash-2,代码行数:56,代码来源:gnc-bill-term-xml-v2.c


示例20: save_invoice

/* ================================================================= */
static gboolean
save_invoice( GncSqlBackend* be, QofInstance* inst )
{
    const GncGUID* guid;
    GncInvoice* invoice;
    gint op;
    gboolean is_infant;
    gboolean is_ok = TRUE;

    g_return_val_if_fail( inst != NULL, FALSE );
    g_return_val_if_fail( GNC_IS_INVOICE(inst), FALSE );
    g_return_val_if_fail( be != NULL, FALSE );

    invoice = GNC_INVOICE(inst);

    is_infant = qof_instance_get_infant( inst );
    if ( qof_instance_get_destroying( inst ) )
    {
        op = OP_DB_DELETE;
    }
    else if ( be->is_pristine_db || is_infant )
    {
        op = OP_DB_INSERT;
    }
    else
    {
        op = OP_DB_UPDATE;
    }
    if ( op != OP_DB_DELETE )
    {
        // Ensure the commodity is in the db
        is_ok = gnc_sql_save_commodity( be, gncInvoiceGetCurrency( invoice ) );
    }

    if ( is_ok )
    {
        is_ok = gnc_sql_do_db_operation( be, op, TABLE_NAME, GNC_ID_INVOICE, inst, col_table );
    }

    if ( is_ok )
    {
        // Now, commit or delete any slots
        guid = qof_instance_get_guid( inst );
        if ( !qof_instance_get_destroying(inst) )
        {
            is_ok = gnc_sql_slots_save( be, guid, is_infant, qof_instance_get_slots( inst ) );
        }
        else
        {
            is_ok = gnc_sql_slots_delete( be, guid );
        }
    }

    return is_ok;
}
开发者ID:nishmu,项目名称:gnucash,代码行数:56,代码来源:gnc-invoice-sql.c



注:本文中的qof_instance_get_slots函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ qof_session_get_book函数代码示例发布时间:2022-05-30
下一篇:
C++ qof_instance_get_guid函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap