本文整理汇总了C++中QueryResult函数的典型用法代码示例。如果您正苦于以下问题:C++ QueryResult函数的具体用法?C++ QueryResult怎么用?C++ QueryResult使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了QueryResult函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: QueryResult
QueryResult TextQuery::query( const std::string& ac_sWord ) const {
auto xCount = mc_Results.find( ac_sWord );
if ( xCount != mc_Results.end() )
return QueryResult(ac_sWord, mc_xLines, xCount->second);
else
return QueryResult(ac_sWord, mc_xLines, std::make_shared< std::set< mt_uLineNum > >() );
}
开发者ID:Liu-Lixin,项目名称:CppPrimer-exes,代码行数:7,代码来源:TextQuery.cpp
示例2: rebuild_boundary_cache
QueryResult Query::raycast_faces(Ray ray, QueryType queryType) {
if (!boundary_faces){
rebuild_boundary_cache();
}
FaceKey firstIntersection((unsigned int) -1);
double dist = std::numeric_limits<double>::max();
for (auto faceIter : *boundary_faces){
Face & face = mesh->get(faceIter);
auto nodePos = mesh->get_pos(face.node_keys());
double newDist;
if (ray.intersect_triangle(nodePos[0], nodePos[1], nodePos[2], newDist)){
bool isFirstFoundTriangle = dist == std::numeric_limits<double>::max();
if (isFirstFoundTriangle){
firstIntersection = faceIter;
dist = newDist;
} else {
if (newDist < dist){
firstIntersection = faceIter;
dist = newDist;
}
break;
}
}
}
if ((unsigned int)firstIntersection == (unsigned int)-1){
return QueryResult();
}
return QueryResult(firstIntersection, dist, ray, queryType, mesh);
}
开发者ID:multiphase,项目名称:DSC,代码行数:31,代码来源:query.cpp
示例3: nodata
QueryResult TextQuery::query(const std::string &sought) const {
static std::shared_ptr<std::set<line_no>> nodata(new std::set<line_no>);
auto loc = wm.find(sought);
if (loc == wm.end())
return QueryResult(sought, nodata, file);
else
return QueryResult(sought, loc->second, file);
}
开发者ID:GitHCoRradO,项目名称:myCppPrimerExercises,代码行数:8,代码来源:TextQuery.cpp
示例4: nodate
QueryResult TextQuery::query(const string& str) const
{
// use static just allocate once.
static shared_ptr<std::set<StrBlob::size_type>> nodate(new std::set<StrBlob::size_type>);
auto found = result.find(str);
if (found == result.end()) return QueryResult(str, nodate, input);
else return QueryResult(str, found->second, input);
}
开发者ID:GlennPallad,项目名称:Cpp-Primer,代码行数:8,代码来源:ex12_32.cpp
示例5: nodata
QueryResult TextQuery::query(const string &s) const
{
static shared_ptr<set<string::size_type>> nodata(new set<string::size_type>);
auto pos = wm.find(s);
if(pos == wm.end())
return QueryResult(s,nodata,file);
else
return QueryResult(s,pos->second,file);
}
开发者ID:jsntxzx,项目名称:cpp_primer5,代码行数:9,代码来源:TextQuery.cpp
示例6: nodata
QueryResult TextQuery::query(std::string s)
{
auto iter = wm.find(s);
static std::shared_ptr<std::set<line_no>> nodata(new std::set<line_no>);
if(iter != wm.end())
return QueryResult(s, file, iter->second);
else
return QueryResult(s, file, nodata);
}
开发者ID:zhuanggengzhen,项目名称:cpp-primer,代码行数:9,代码来源:ex12_27.cpp
示例7: nodata
const QueryResult
TextQuery::query(const string &word) const
{
static shared_ptr<set<int>> nodata(new set<int>);
auto loc = wm.find(word);
if (loc != wm.end())
return QueryResult(word, loc->second, file);
else
return QueryResult(word, nodata, file);
}
开发者ID:MANHI,项目名称:Cplusplus,代码行数:10,代码来源:TextQuery.cpp
示例8: nodata
QueryResult TextQuery::query(const std::string& word) const {
static std::shared_ptr<std::set<line_no>> nodata(new std::set<line_no>);
auto loc = lines_record.find(word);
if (loc == lines_record.end()) {
return QueryResult(word, nodata, text);
}
else {
return QueryResult(word, loc->second, text);
}
}
开发者ID:Mlieou,项目名称:cpp_primer,代码行数:10,代码来源:TextQuery.cpp
示例9: nodata
QueryResult TextQuery::query(const std::string& sought) const
{
// we'll return a pointer to this std::set if we don't find sought
static std::shared_ptr<std::set<line_no>> nodata(new std::set<line_no>);
//use find and not a subscript to avoid adding words to wm!
auto loc = wm.find(sought);
if(loc == wm.end())
return QueryResult(sought, nodata, file); // not found
else
return QueryResult(sought, loc->second, file);
}
开发者ID:chihyang,项目名称:CPP_Primer,代码行数:11,代码来源:Exer15_39_TextQuery.cpp
示例10: QueryResult
QueryResult SQLQueryHolder::GetResult(size_t index) {
// Don't call to this function if the index is of an ad-hoc statement
if (index < m_queries.size()) {
ResultSet* result = m_queries[index].second.qresult;
if (!result || !result->GetRowCount())
return QueryResult(NULL);
result->NextRow();
return QueryResult(result);
} else
return QueryResult(NULL);
}
开发者ID:Bootz,项目名称:DeepshjirRepack,代码行数:12,代码来源:QueryHolder.cpp
示例11: nodata
QueryResult TextQuery::query(const std::string &s) const
{
std::shared_ptr<std::set<line_no>> nodata(new std::set<line_no>);
auto it = word_map.find(s);
if(it == word_map.end())
{
return QueryResult(s, nodata, file);
}
else
{
return QueryResult(s, it->second, file);
}
}
开发者ID:Ilikecoding,项目名称:cpp_primer,代码行数:13,代码来源:TextQuery.cpp
示例12: noData
/**
* @brief do a query opertion and return QueryResult object.
*/
QueryResult
TextQuery::query(const std::string &sought) const
{
//! dynamicaly allocated set used for the word does not appear.
static std::shared_ptr<std::set<index_Tp>> noData(new std::set<index_Tp>);
//! fetch the iterator to the matching element in the map<word, lines>.
//std::map<std::string, std::shared_ptr<std::set<index_Tp>>>::const_iterator
auto iter = wm.find(sought);
if(iter == wm.end())
return QueryResult(sought, noData, file);
else
return QueryResult(sought, iter->second, file);
}
开发者ID:Blocry,项目名称:Cpp-Primer,代码行数:17,代码来源:textquery.cpp
示例13: query
QueryResult query(const std::string &word) const
{
// *TN* How to handle the case when not found? Use empty set rather
// then nullptr since print() do not have to handle a special case.
static auto notfound = std::make_shared<std::set<lineno>>();
// *TN* should not use [] since it can add a new one
auto pos = word_map_.find(word);
if (pos != word_map_.end())
return QueryResult(word, input_file_, pos->second);
else
return QueryResult(word, input_file_, notfound);
}
开发者ID:keitee,项目名称:kb,代码行数:14,代码来源:t_ex_query_extend.cpp
示例14: get_driver_instance
/**
*
* Connects to the database
*
* Note that this expects that the database driver has setup all the things in
* the connection.
*
* @return A QueryResult. error.isError will be false on success.
*/
QueryResult DatabaseConnection::connect()
{
QueryResult result;
if (driver == nullptr) {
// Get driver instance
driver = get_driver_instance();
// Init SQL thread
driver->threadInit();
}
if (connection == nullptr) {
try {
connection = driver->connect(hostname, username,
password);
} catch (SQLException &e) {
result.error.isError = true;
result.error.code = e.getErrorCode();
result.error.string = e.getSQLState() + ": " + e.what();
return result;
}
// Reset result
result = QueryResult();
// Get connection id
result = this->execute(VariantVector() << "SELECT CONNECTION_ID()");
if (result.rows.size() == 0 || result.error.isError) {
// No row returned
return result;
}
connection_id = result.rows.front().front().toUInt();
// Reset result
result = QueryResult();
return result;
}
// Successful connection?
return result;
}
开发者ID:curquhart,项目名称:rsql-backend,代码行数:58,代码来源:databaseconnection.cpp
示例15: GetFreeConnection
QueryResult DatabaseWorkerPool<T>::Query(const char* sql, T* connection /*= nullptr*/)
{
if (!connection)
connection = GetFreeConnection();
ResultSet* result = connection->Query(sql);
connection->Unlock();
if (!result || !result->GetRowCount() || !result->NextRow())
{
delete result;
return QueryResult(NULL);
}
return QueryResult(result);
}
开发者ID:boom8866,项目名称:MaddieCore,代码行数:15,代码来源:DatabaseWorkerPool.cpp
示例16: get_document_index
int
Dictionary::dict_find (ustring dictionaryname, ustring query)
{
int dindex = get_document_index (dictionaryname);
if (dindex < 0)
return dindex;
ASSERT (dindex >= 0 && dindex < (int)m_documents.size());
Query q (dindex, 0, query);
QueryMap::iterator qfound = m_cache.find (q);
if (qfound != m_cache.end()) {
return qfound->second.valueoffset;
}
pugi::xml_document *doc = m_documents[dindex];
// Query was not found. Do the expensive lookup and cache it
pugi::xpath_node_set matches;
try {
matches = doc->select_nodes (query.c_str());
}
catch (const pugi::xpath_exception& e) {
m_context->error ("Invalid dict_find query '%s': %s",
query.c_str(), e.what());
return 0;
}
if (matches.empty()) {
m_cache[q] = QueryResult (false); // mark invalid
return 0; // Not found
}
int firstmatch = (int) m_nodes.size();
int last = -1;
for (int i = 0, e = (int)matches.size(); i < e; ++i) {
m_nodes.push_back (Node (dindex, matches[i].node()));
int nodeid = (int) m_nodes.size()-1;
if (last < 0) {
// If this is the first match, add a cache entry for it
m_cache[q] = QueryResult (true /* it's a node */, nodeid);
} else {
// If this is a subsequent match, set the last match's 'next'
m_nodes[last].next = nodeid;
}
last = nodeid;
}
return firstmatch;
}
开发者ID:jamesvecore,项目名称:OpenShadingLanguage,代码行数:48,代码来源:dictionary.cpp
示例17: set_intersection
QueryResult AndQuery::eval(const TextQuery& text) const
{
auto left=lhs.eval(text), right=rhs.eval(text);
auto ret_lines=std::make_shared<std::set<line_no>>();
set_intersection(left.begin(),left.end(),right.begin(),right.end(),inserter(*ret_lines,ret_lines->begin()));
return QueryResult(rep(),ret_lines,left.get_file());
}
开发者ID:shen9175,项目名称:QueryParser,代码行数:7,代码来源:AndQuery.cpp
示例18: if
// returns the lines not in its operand's result set
QueryResult
NotQuery::eval(const TextQuery& text) const
{
// virtual call to eval through the Query operand
auto result = query.eval(text);
// start out with an empty result set
auto ret_lines = std::make_shared<std::set<line_no>>();
// we have to iterate through the lines on which our operand appears
auto beg = result.begin(), end = result.end();
// for each line in the input file, if that line is not in result,
// add that line number to ret_lines
auto sz = result.get_file()->size();
for (size_t n = 0; n != sz; ++n) {
// if we haven't processed all the lines in result
// check whether this line is present
if (beg == end || *beg != n)
ret_lines->insert(n); // if not in result, add this line
else if (beg != end)
++beg; // otherwise get next line number in result if there is one
}
return QueryResult(rep(), ret_lines, result.get_file());
}
开发者ID:Mugurell,项目名称:Learning,代码行数:28,代码来源:NotQuery.cpp
示例19: Execute
bool BasicStatementTask::Execute()
{
if(m_has_result)
{
ResultSet* result = m_conn->Query(m_sql);
if(!result || !result->GetRowCount())
{
m_result.set(QueryResult(NULL));
return false;
}
result->NextRow();
m_result.set(QueryResult(result));
return true;
}
return m_conn->Execute(m_sql);
}
开发者ID:GlassFace,项目名称:MythCore,代码行数:17,代码来源:AdhocStatement.cpp
示例20: Execute
bool BasicStatementTask::Execute()
{
if (m_has_result)
{
ResultSet* result = m_conn->Query(m_sql);
if (!result || !result->GetRowCount() || !result->NextRow())
{
delete result;
m_result->set_value(QueryResult(nullptr));
return false;
}
m_result->set_value(QueryResult(result));
return true;
}
return m_conn->Execute(m_sql);
}
开发者ID:SuetyPoet,项目名称:pgcompcore,代码行数:18,代码来源:AdhocStatement.cpp
注:本文中的QueryResult函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论