当前位置: 首页>>代码示例>>C++>>正文


C++ QueryResult函数代码示例

本文整理汇总了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 > >() );
}
开发者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


注:本文中的QueryResult函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。