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