本文整理汇总了C++中KvpFrame::get_slot方法的典型用法代码示例。如果您正苦于以下问题:C++ KvpFrame::get_slot方法的具体用法?C++ KvpFrame::get_slot怎么用?C++ KvpFrame::get_slot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KvpFrame
的用法示例。
在下文中一共展示了KvpFrame::get_slot方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PWARN
/** 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*>();
}
示例2: g_strdup
/** 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*>());
}
示例3:
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);
}