本文整理汇总了C++中Query::count方法的典型用法代码示例。如果您正苦于以下问题:C++ Query::count方法的具体用法?C++ Query::count怎么用?C++ Query::count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Query
的用法示例。
在下文中一共展示了Query::count方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Q
JNIEXPORT jlong JNICALL Java_io_realm_internal_TableQuery_nativeCount(
JNIEnv* env, jobject, jlong nativeQueryPtr, jlong start, jlong end, jlong limit)
{
Query* pQuery = Q(nativeQueryPtr);
Table* pTable = Ref2Ptr(pQuery->get_table());
if (!QUERY_VALID(env, pQuery) ||
!ROW_INDEXES_VALID(env, pTable, start, end, limit))
return 0;
try {
return pQuery->count(S(start), S(end), S(limit));
} CATCH_STD()
return 0;
}
示例2:
TriStateTree::TriStateTree(const Query& query)
{
m_state = Unknown;
m_nodeCount = query.count();
m_nodes = new Node[m_nodeCount];
m_leafCount = 0;
m_leafs = new Node*[m_nodeCount];
Node** nodeStack = new Node*[m_nodeCount];
int stackTop = -1;
for (int element = 0; element < m_nodeCount; element++) {
if (query.isElementSearch(element)) {
/* search == leaf node, add to stack & add to list of leaf nodes */
m_nodes[element].m_state = Unknown;
m_nodes[element].m_operator = Search::NullOperator;
m_nodes[element].m_parent = 0;
m_nodes[element].m_leftChild = m_nodes[element].m_rightChild = 0;
nodeStack[++stackTop] = &m_nodes[element];
m_leafs[m_leafCount++] = &m_nodes[element];
} else {
/* operator == branch node, pop children off stack & add to stack */
m_nodes[element].m_state = Unknown;
m_nodes[element].m_operator = query.searchOperator(element);
m_nodes[element].m_parent = 0;
if (m_nodes[element].m_operator == Search::Not) {
m_nodes[element].m_rightChild = 0;
} else {
m_nodes[element].m_rightChild = nodeStack[stackTop--];
m_nodes[element].m_rightChild->m_parent = &m_nodes[element];
}
m_nodes[element].m_leftChild = nodeStack[stackTop--];
m_nodes[element].m_leftChild->m_parent = &m_nodes[element];
nodeStack[++stackTop] = &m_nodes[element];
}
}
delete[] nodeStack;
//stack should now be empty
Q_ASSERT(stackTop == 0);
}