本文整理汇总了C++中QOF_INSTANCE函数的典型用法代码示例。如果您正苦于以下问题:C++ QOF_INSTANCE函数的具体用法?C++ QOF_INSTANCE怎么用?C++ QOF_INSTANCE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了QOF_INSTANCE函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: qof_instance_list_foreach
static void
qof_instance_list_foreach(gpointer data, gpointer user_data)
{
QofInstanceCopyData *qecd;
QofInstance *original;
QofInstance *inst;
QofBook *book;
const GncGUID *g;
g_return_if_fail(data != NULL);
original = QOF_INSTANCE(data);
g_return_if_fail(user_data != NULL);
qecd = (QofInstanceCopyData*)user_data;
if (qof_instance_guid_match(qecd->new_session, original))
{
return;
}
qecd->from = original;
if (!qof_object_compliance(original->e_type, FALSE))
{
qecd->error = TRUE;
return;
}
book = qof_session_get_book(qecd->new_session);
inst = (QofInstance*)qof_object_new_instance(original->e_type, book);
if (!inst)
{
PERR (" failed to create new entity type=%s.", original->e_type);
qecd->error = TRUE;
return;
}
qecd->to = inst;
g = qof_instance_get_guid(original);
qof_instance_set_guid(qecd->to, g);
if (qecd->param_list != NULL)
{
g_slist_free(qecd->param_list);
qecd->param_list = NULL;
}
qof_class_param_foreach(original->e_type, qof_instance_param_cb, qecd);
qof_begin_edit(inst);
g_slist_foreach(qecd->param_list, qof_instance_foreach_copy, qecd);
qof_commit_edit(inst);
}
开发者ID:cstim,项目名称:gnucash-svn,代码行数:44,代码来源:qofsession.c
示例2: gnc_book_get_schedxactions
bool
GncSqlBackend::write_schedXactions()
{
GList* schedXactions;
SchedXaction* tmpSX;
bool is_ok = true;
schedXactions = gnc_book_get_schedxactions (m_book)->sx_list;
auto obe = m_backend_registry.get_object_backend(GNC_ID_SCHEDXACTION);
for (; schedXactions != NULL && is_ok; schedXactions = schedXactions->next)
{
tmpSX = static_cast<decltype (tmpSX)> (schedXactions->data);
is_ok = obe->commit (this, QOF_INSTANCE (tmpSX));
}
update_progress();
return is_ok;
}
开发者ID:codesmythe,项目名称:gnucash,代码行数:19,代码来源:gnc-sql-backend.cpp
示例3: load_single_vendor
static GncVendor*
load_single_vendor (GncSqlBackend* sql_be, GncSqlRow& row)
{
const GncGUID* guid;
GncVendor* pVendor;
g_return_val_if_fail (sql_be != NULL, NULL);
guid = gnc_sql_load_guid (sql_be, row);
pVendor = gncVendorLookup (sql_be->book(), guid);
if (pVendor == NULL)
{
pVendor = gncVendorCreate (sql_be->book());
}
gnc_sql_load_object (sql_be, row, GNC_ID_VENDOR, pVendor, col_table);
qof_instance_mark_clean (QOF_INSTANCE (pVendor));
return pVendor;
}
开发者ID:Mechtilde,项目名称:gnucash,代码行数:19,代码来源:gnc-vendor-sql.cpp
示例4: qof_instance_set_guid
void
qof_instance_set_guid (gpointer ptr, const GncGUID *guid)
{
QofInstancePrivate *priv;
QofInstance *inst;
QofCollection *col;
g_return_if_fail(QOF_IS_INSTANCE(ptr));
inst = QOF_INSTANCE(ptr);
priv = GET_PRIVATE(inst);
if (guid_equal (guid, &priv->guid))
return;
col = priv->collection;
qof_collection_remove_entity(inst);
priv->guid = *guid;
qof_collection_insert_entity(col, inst);
}
开发者ID:kleopatra999,项目名称:gnucash-2,代码行数:19,代码来源:qofinstance.c
示例5: load_single_employee
static GncEmployee*
load_single_employee (GncSqlBackend* sql_be, GncSqlRow& row)
{
const GncGUID* guid;
GncEmployee* pEmployee;
g_return_val_if_fail (sql_be != NULL, NULL);
guid = gnc_sql_load_guid (sql_be, row);
pEmployee = gncEmployeeLookup (sql_be->book(), guid);
if (pEmployee == NULL)
{
pEmployee = gncEmployeeCreate (sql_be->book());
}
gnc_sql_load_object (sql_be, row, GNC_ID_EMPLOYEE, pEmployee, col_table);
qof_instance_mark_clean (QOF_INSTANCE (pEmployee));
return pEmployee;
}
开发者ID:jralls,项目名称:gnucash,代码行数:19,代码来源:gnc-employee-sql.cpp
示例6: load_single_order
static GncOrder*
load_single_order (GncSqlBackend* be, GncSqlRow& row)
{
const GncGUID* guid;
GncOrder* pOrder;
g_return_val_if_fail (be != NULL, NULL);
guid = gnc_sql_load_guid (be, row);
pOrder = gncOrderLookup (be->book(), guid);
if (pOrder == NULL)
{
pOrder = gncOrderCreate (be->book());
}
gnc_sql_load_object (be, row, GNC_ID_ORDER, pOrder, col_table);
qof_instance_mark_clean (QOF_INSTANCE (pOrder));
return pOrder;
}
开发者ID:tmertens,项目名称:gnucash,代码行数:19,代码来源:gnc-order-sql.cpp
示例7: load_single_invoice
static GncInvoice*
load_single_invoice (GncSqlBackend* be, GncSqlRow& row)
{
const GncGUID* guid;
GncInvoice* pInvoice;
g_return_val_if_fail (be != NULL, NULL);
guid = gnc_sql_load_guid (be, row);
pInvoice = gncInvoiceLookup (be->book(), guid);
if (pInvoice == NULL)
{
pInvoice = gncInvoiceCreate (be->book());
}
gnc_sql_load_object (be, row, GNC_ID_INVOICE, pInvoice, col_table);
qof_instance_mark_clean (QOF_INSTANCE (pInvoice));
return pInvoice;
}
开发者ID:tmertens,项目名称:gnucash,代码行数:19,代码来源:gnc-invoice-sql.cpp
示例8: gnc_template_register_save_shares_cell
static void
gnc_template_register_save_shares_cell (BasicCell * cell,
gpointer save_data,
gpointer user_data)
{
SRSaveData *sd = save_data;
char *sharesStr = "(x + y)/42";
g_return_if_fail (gnc_basic_cell_has_name (cell, SHRS_CELL));
/* FIXME: shares cells are numeric by definition. */
qof_instance_set (QOF_INSTANCE (sd->split),
"sx-shares", sharesStr,
NULL);
/* set the shares to an innocuous value */
/* Note that this marks the split dirty */
xaccSplitSetSharePriceAndAmount (sd->split,
gnc_numeric_create (0, 1),
gnc_numeric_create (0, 1));
}
开发者ID:CAARNICL,项目名称:gnucash,代码行数:20,代码来源:split-register-model-save.c
示例9: gnc_ofx_kvp_set_assoc_account
void gnc_ofx_kvp_set_assoc_account(Account* investment_account,
const Account *income_account)
{
kvp_frame * acc_frame;
kvp_value * kvp_val;
const GncGUID * income_acc_guid;
g_assert(investment_account);
g_assert(income_account);
acc_frame = xaccAccountGetSlots(investment_account);
g_assert(acc_frame); // Must not be NULL, but the QofInstance doc is unclear about this
income_acc_guid = xaccAccountGetGUID(income_account);
kvp_val = kvp_value_new_guid(income_acc_guid);
xaccAccountBeginEdit(investment_account);
kvp_frame_set_slot_nc(acc_frame, KEY_ASSOC_INCOME_ACCOUNT,
kvp_val);
qof_instance_set_dirty(QOF_INSTANCE (investment_account));
xaccAccountCommitEdit(investment_account);
}
开发者ID:573,项目名称:gnucash,代码行数:20,代码来源:gnc-ofx-kvp.c
示例10: load_single_job
static GncJob*
load_single_job( GncSqlBackend* be, GncSqlRow* row )
{
const GncGUID* guid;
GncJob* pJob;
g_return_val_if_fail( be != NULL, NULL );
g_return_val_if_fail( row != NULL, NULL );
guid = gnc_sql_load_guid( be, row );
pJob = gncJobLookup( be->book, guid );
if ( pJob == NULL )
{
pJob = gncJobCreate( be->book );
}
gnc_sql_load_object( be, row, GNC_ID_JOB, pJob, col_table );
qof_instance_mark_clean( QOF_INSTANCE(pJob) );
return pJob;
}
开发者ID:573,项目名称:gnucash,代码行数:20,代码来源:gnc-job-sql.c
示例11: load_single_customer
static GncCustomer*
load_single_customer( GncSqlBackend* be, GncSqlRow* row )
{
const GncGUID* guid;
GncCustomer* pCustomer;
g_return_val_if_fail( be != NULL, NULL );
g_return_val_if_fail( row != NULL, NULL );
guid = gnc_sql_load_guid( be, row );
pCustomer = gncCustomerLookup( be->book, guid );
if ( pCustomer == NULL )
{
pCustomer = gncCustomerCreate( be->book );
}
gnc_sql_load_object( be, row, GNC_ID_CUSTOMER, pCustomer, col_table );
qof_instance_mark_clean( QOF_INSTANCE(pCustomer) );
return pCustomer;
}
开发者ID:Isendir,项目名称:gnucash,代码行数:20,代码来源:gnc-customer-sql.cpp
示例12: g_return_if_fail
void
GncSqlBudgetBackend::load_all (GncSqlBackend* sql_be)
{
InstanceVec instances;
g_return_if_fail (sql_be != NULL);
std::stringstream sql;
sql << "SELECT * FROM " << BUDGET_TABLE;
auto stmt = sql_be->create_statement_from_sql(sql.str());
auto result = sql_be->execute_select_statement(stmt);
for (auto row : *result)
{
auto b = load_single_budget (sql_be, row);
if (b != nullptr)
instances.push_back(QOF_INSTANCE(b));
}
if (!instances.empty())
gnc_sql_slots_load_for_instancevec (sql_be, instances);
}
开发者ID:Bob-IT,项目名称:gnucash,代码行数:20,代码来源:gnc-budget-sql.cpp
示例13: grand_getDescend
static QofCollection*
grand_getDescend(mygrand *g)
{
QofCollection *col;
QofInstance *ent;
GList *list;
g_return_val_if_fail(g, NULL);
col = qof_collection_new(CHILD_MODULE_NAME);
for (list = g_list_copy(g->descend); list; list = list->next)
{
ent = QOF_INSTANCE(list->data);
if (!ent)
{
break;
}
do_test(0 == safe_strcmp(ent->e_type, CHILD_MODULE_NAME), "wrong entity");
qof_collection_add_entity(col, ent);
}
return col;
}
开发者ID:nizarklai,项目名称:gnucash-1,代码行数:21,代码来源:test-recursive.c
示例14: g_return_if_fail
void
GncSqlOrderBackend::load_all (GncSqlBackend* be)
{
g_return_if_fail (be != NULL);
std::stringstream sql;
sql << "SELECT * FROM " << TABLE_NAME;
auto stmt = be->create_statement_from_sql(sql.str());
auto result = be->execute_select_statement(stmt);
InstanceVec instances;
for (auto row : *result)
{
GncOrder* pOrder = load_single_order (be, row);
if (pOrder != nullptr)
instances.push_back(QOF_INSTANCE(pOrder));
}
if (!instances.empty())
gnc_sql_slots_load_for_instancevec (be, instances);
}
开发者ID:tmertens,项目名称:gnucash,代码行数:21,代码来源:gnc-order-sql.cpp
示例15: gnc_tree_util_split_reg_template_get_transfer_entry
/* Return the string entry for transfer column when template */
const char *
gnc_tree_util_split_reg_template_get_transfer_entry (Split *split)
{
static char *name = NULL;
Account *account;
GncGUID *guid = NULL;
/* Callers either g_strdup the return or use it as a temp for comparison,
so we keep our static ref and free it on every call. */
g_free (name);
if (!split)
return NULL;
qof_instance_get (QOF_INSTANCE (split),
"sx-account", &guid,
NULL);
account = xaccAccountLookup (guid, gnc_get_current_book ());
name = account ? gnc_get_account_name_for_register (account) : NULL;
return name;
}
开发者ID:Mechtilde,项目名称:gnucash,代码行数:22,代码来源:gnc-tree-util-split-reg.c
示例16: load_taxtable_entries
static void
load_taxtable_entries (GncSqlBackend* sql_be, GncTaxTable* tt)
{
gchar guid_buf[GUID_ENCODING_LENGTH + 1];
GValue value;
gchar* buf;
g_return_if_fail (sql_be != NULL);
g_return_if_fail (tt != NULL);
guid_to_string_buff (qof_instance_get_guid (QOF_INSTANCE (tt)), guid_buf);
memset (&value, 0, sizeof (GValue));
g_value_init (&value, G_TYPE_STRING);
g_value_set_string (&value, guid_buf);
buf = g_strdup_printf ("SELECT * FROM %s WHERE taxtable='%s'",
TTENTRIES_TABLE_NAME, guid_buf);
auto stmt = sql_be->create_statement_from_sql (buf);
g_free (buf);
auto result = sql_be->execute_select_statement(stmt);
for (auto row : *result)
load_single_ttentry (sql_be, row, tt);
}
开发者ID:Bob-IT,项目名称:gnucash,代码行数:22,代码来源:gnc-tax-table-sql.cpp
示例17: qof_book_get_counter
gint64
qof_book_get_counter (QofBook *book, const char *counter_name)
{
KvpFrame *kvp;
KvpValue *value;
if (!book)
{
PWARN ("No book!!!");
return -1;
}
if (!counter_name || *counter_name == '\0')
{
PWARN ("Invalid counter name.");
return -1;
}
/* Use the KVP in the book */
kvp = qof_instance_get_slots (QOF_INSTANCE (book));
if (!kvp)
{
PWARN ("Book has no KVP_Frame");
return -1;
}
value = kvp->get_slot({"counters", counter_name});
if (value)
{
/* found it */
return value->get<int64_t>();
}
else
{
/* New counter */
return 0;
}
}
开发者ID:frenzypony,项目名称:gnucash,代码行数:39,代码来源:qofbook.cpp
示例18: set_parent
static void
set_parent (gpointer pObject, gpointer pValue)
{
Account* pAccount;
QofBook* pBook;
GncGUID* guid = (GncGUID*)pValue;
Account* pParent;
g_return_if_fail (pObject != NULL);
g_return_if_fail (GNC_IS_ACCOUNT (pObject));
pAccount = GNC_ACCOUNT (pObject);
pBook = qof_instance_get_book (QOF_INSTANCE (pAccount));
if (guid != NULL)
{
pParent = xaccAccountLookup (guid, pBook);
if (pParent != NULL)
{
gnc_account_append_child (pParent, pAccount);
}
}
}
开发者ID:Bob-IT,项目名称:gnucash,代码行数:22,代码来源:gnc-account-sql.cpp
示例19: set_root_template_guid
static void
set_root_template_guid( gpointer pObject, /*@ null @*/ gpointer pValue )
{
QofBook* book = QOF_BOOK(pObject);
GncGUID* guid = (GncGUID*)pValue;
Account* root;
g_return_if_fail( pObject != NULL );
g_return_if_fail( QOF_IS_BOOK(pObject) );
g_return_if_fail( pValue != NULL );
root = gnc_book_get_template_root( book );
if ( root == NULL )
{
root = xaccMallocAccount( book );
xaccAccountBeginEdit( root );
xaccAccountSetType( root, ACCT_TYPE_ROOT );
xaccAccountCommitEdit( root );
gnc_book_set_template_root( book, root );
}
qof_instance_set_guid( QOF_INSTANCE(root), guid );
}
开发者ID:nishmu,项目名称:gnucash,代码行数:22,代码来源:gnc-book-sql.c
示例20: balance_cell_edited
static void
balance_cell_edited (GtkCellRendererText *cell,
gchar *path,
gchar *new_text,
gpointer user_data)
{
Account *account;
char *error_loc;
gnc_numeric amount;
hierarchy_data *data = (hierarchy_data *)user_data;
g_return_if_fail(data != NULL);
account = gnc_tree_view_account_get_selected_account(data->final_account_tree);
if (account == NULL)
{
g_critical("account is null");
return;
}
error_loc = NULL;
if (!gnc_exp_parser_parse (new_text, &amount, &error_loc))
{
amount = gnc_numeric_zero();
g_object_set (G_OBJECT(cell), "text", "", NULL);
}
/* Bug#348364: Emulating price-cell, we need to ensure the denominator of
* the amount is in the SCU of the account's commodity (so
* gnc-ui-util.c:is_decimal_fraction() on the remainder denom for
* fractional values will be a "decimal").
*/
{
int account_cmdty_fraction = xaccAccountGetCommoditySCU(account);
amount = gnc_numeric_convert(amount, account_cmdty_fraction, GNC_HOW_RND_ROUND_HALF_UP);
}
set_final_balance (data->balance_hash, account, amount);
qof_event_gen (QOF_INSTANCE(account), QOF_EVENT_MODIFY, NULL);
}
开发者ID:EisEkTonProgrammatiston,项目名称:gnucash,代码行数:38,代码来源:assistant-hierarchy.c
注:本文中的QOF_INSTANCE函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论