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


C++ Searcher类代码示例

本文整理汇总了C++中Searcher的典型用法代码示例。如果您正苦于以下问题:C++ Searcher类的具体用法?C++ Searcher怎么用?C++ Searcher使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Searcher类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: guard

void SearchFilterByModuleList::Search(Searcher &searcher) {
  if (!m_target_sp)
    return;

  if (searcher.GetDepth() == lldb::eSearchDepthTarget) {
    SymbolContext empty_sc;
    empty_sc.target_sp = m_target_sp;
    searcher.SearchCallback(*this, empty_sc, nullptr, false);
  }

  // If the module file spec is a full path, then we can just find the one
  // filespec that passes.  Otherwise, we need to go through all modules and
  // find the ones that match the file name.

  const ModuleList &target_modules = m_target_sp->GetImages();
  std::lock_guard<std::recursive_mutex> guard(target_modules.GetMutex());

  const size_t num_modules = target_modules.GetSize();
  for (size_t i = 0; i < num_modules; i++) {
    Module *module = target_modules.GetModulePointerAtIndexUnlocked(i);
    if (m_module_spec_list.FindFileIndex(0, module->GetFileSpec(), false) !=
        UINT32_MAX) {
      SymbolContext matchingContext(m_target_sp, module->shared_from_this());
      Searcher::CallbackReturn shouldContinue;

      shouldContinue = DoModuleIteration(matchingContext, searcher);
      if (shouldContinue == Searcher::eCallbackReturnStop)
        return;
    }
  }
}
开发者ID:llvm-project,项目名称:lldb,代码行数:31,代码来源:SearchFilter.cpp

示例2: cu_sp

Searcher::CallbackReturn
SearchFilter::DoCUIteration(const ModuleSP &module_sp,
                            const SymbolContext &context, Searcher &searcher) {
  Searcher::CallbackReturn shouldContinue;
  if (context.comp_unit == nullptr) {
    const size_t num_comp_units = module_sp->GetNumCompileUnits();
    for (size_t i = 0; i < num_comp_units; i++) {
      CompUnitSP cu_sp(module_sp->GetCompileUnitAtIndex(i));
      if (cu_sp) {
        if (!CompUnitPasses(*(cu_sp.get())))
          continue;

        if (searcher.GetDepth() == Searcher::eDepthCompUnit) {
          SymbolContext matchingContext(m_target_sp, module_sp, cu_sp.get());

          shouldContinue =
              searcher.SearchCallback(*this, matchingContext, nullptr, false);

          if (shouldContinue == Searcher::eCallbackReturnPop)
            return Searcher::eCallbackReturnContinue;
          else if (shouldContinue == Searcher::eCallbackReturnStop)
            return shouldContinue;
        } else {
          // FIXME Descend to block.
        }
      }
    }
  } else {
    if (CompUnitPasses(*context.comp_unit)) {
      SymbolContext matchingContext(m_target_sp, module_sp, context.comp_unit);
      return searcher.SearchCallback(*this, matchingContext, nullptr, false);
    }
  }
  return Searcher::eCallbackReturnContinue;
}
开发者ID:2trill2spill,项目名称:freebsd,代码行数:35,代码来源:SearchFilter.cpp

示例3: clear_reserve_contragent

void CustomTabWidget::clear_reserve_contragent(){
    Searcher *s;
    for(int i = 0; i < this->count(); i++){
        s = static_cast<Searcher*>(this->widget(i));
        s->clear_reserve_contragent();
    }
}
开发者ID:qks1,项目名称:erk,代码行数:7,代码来源:customtabwidget.cpp

示例4: refresh_white_searcher

void CustomTabWidget::refresh_white_searcher(){
    Searcher *s;
    for(int i = 0; i < this->count(); i++){
        s = static_cast<Searcher*>(this->widget(i));
        s->refresh_white_table();
    }
}
开发者ID:qks1,项目名称:erk,代码行数:7,代码来源:customtabwidget.cpp

示例5: switch_hidden

void CustomTabWidget::switch_hidden(){
    Searcher *s;
    for(int i = 0; i < this->count(); i++){
        s = static_cast<Searcher*>(this->widget(i));
        s->switch_hidden();
    }
}
开发者ID:qks1,项目名称:erk,代码行数:7,代码来源:customtabwidget.cpp

示例6: set_reserve_contragent

void CustomTabWidget::set_reserve_contragent(int id, QString name){
    Searcher *s;
    for(int i = 0; i < this->count(); i++){
        s = static_cast<Searcher*>(this->widget(i));
        s->set_reserve_contragent(id, name);
    }
}
开发者ID:qks1,项目名称:erk,代码行数:7,代码来源:customtabwidget.cpp

示例7: search

int search(int argc, char *argv[])
{
	Searcher searcher;

	if (searcher.load(argv[2]) == false)
	{
		cout << "Unable to load index file - file does not exist or is corrupt.\n";
		return -1;
	}

	cout << "Successfully loaded index file.\n";
	std::string query;

	for (;;)
	{
		cout << "Enter your search terms: ";
		getline(cin, query);
		if (query.empty())
			break;

		auto results = searcher.search(query);
		if (results.size() == 0)
			cout << "No results found\n";
		else
		{
			cout << "\n" << results.size() << " matches found:\n";
			for (size_t i = 0; i<results.size(); i++)
				cout << results[i] << endl;
		}
		cout << endl;
	}

	return 0;
}
开发者ID:nehcney,项目名称:Search-Engine,代码行数:34,代码来源:main.cpp

示例8: matchingContext

void
SearchFilterByModule::Search (Searcher &searcher)
{
    if (!m_target_sp)
        return;

    if (searcher.GetDepth() == Searcher::eDepthTarget)
    {
        SymbolContext empty_sc;
        empty_sc.target_sp = m_target_sp;
        searcher.SearchCallback (*this, empty_sc, NULL, false);
    }

    // If the module file spec is a full path, then we can just find the one
    // filespec that passes.  Otherwise, we need to go through all modules and
    // find the ones that match the file name.

    ModuleList matching_modules;
    const size_t num_modules = m_target_sp->GetImages().GetSize ();
    for (size_t i = 0; i < num_modules; i++)
    {
        Module* module = m_target_sp->GetImages().GetModulePointerAtIndex(i);
        if (FileSpec::Compare (m_module_spec, module->GetFileSpec(), false) == 0)
        {
            SymbolContext matchingContext(m_target_sp, module->GetSP());
            Searcher::CallbackReturn shouldContinue;

            shouldContinue = DoModuleIteration(matchingContext, searcher);
            if (shouldContinue == Searcher::eCallbackReturnStop)
                return;
        }
    }
}
开发者ID:eightcien,项目名称:lldb,代码行数:33,代码来源:SearchFilter.cpp

示例9: module_sp

void
SearchFilter::SearchInModuleList (Searcher &searcher, ModuleList &modules)
{
    SymbolContext empty_sc;

    if (m_target_sp == NULL)
        return;
    empty_sc.target_sp = m_target_sp;

    if (searcher.GetDepth() == Searcher::eDepthTarget)
        searcher.SearchCallback (*this, empty_sc, NULL, false);
    else
    {
        const size_t numModules = modules.GetSize();

        for (size_t i = 0; i < numModules; i++)
        {
            ModuleSP module_sp(modules.GetModuleAtIndex(i));
            if (ModulePasses(module_sp))
            {
                if (DoModuleIteration(module_sp, searcher) == Searcher::eCallbackReturnStop)
                    return;
            }
        }
    }
}
开发者ID:eightcien,项目名称:lldb,代码行数:26,代码来源:SearchFilter.cpp

示例10: nn_search

void nn_search(Searcher& searcher, double* const nn, double* const dists, const long R, const long N,
				const long dim, const double* p, const double* ref, const long NNR, const mmatrix& past, const double epsilon,
				const int ref_or_direct)
{	
	if (searcher.geterr()) {
		mexErrMsgTxt("Error preparing searcher, maybe wrong preprocessing data were given or the point set has changed");
	}	 
	
	double*	const coord = (double*) malloc(dim * sizeof(double)); 	
	
	for (long n=0; n < R; n++) { /* iterate over all reference points */ 
		vector<neighbor> v;
		
		if (ref_or_direct) {
			const long actual = int(ref[n])-1;		// Matlab to C means indices change from 1 to 0, 2 to 1, 3 to 2
			for (long k=0; k < dim; k++) 
				coord[k] = p[actual+k*N];

			searcher.search_k_neighbors(v, NNR, coord, (long) past(n+1,1)-1, (long) past(n+1,2)-1, epsilon);
		} else {
			for (long k=0; k < dim; k++) 
				coord[k] = ref[n+k*R];

			searcher.search_k_neighbors(v, NNR, coord, (long) past(n+1,1)-1, (long) past(n+1,2)-1, epsilon);
		}	
		
		for (long k = 0; k < v.size(); k++) { 	// v is the sorted vector of neighbors
				nn[n+k*R] = v[k].index() +1;	// convert indices back to Matlab (1..N) style 
				dists[n+k*R] = v[k].dist();
		}
	}
	
	free(coord);
}
开发者ID:Claycau,项目名称:hqn229,代码行数:34,代码来源:nn_search.cpp

示例11: testLocationToNodeReturnsCorrectNode

void SearcherTest::testLocationToNodeReturnsCorrectNode(Searcher searcher) {
	int* location = new int[2];
	location[0] = 0; location[1] = 0;  assert(searcher.locationToNode(location) == 0);
	location[0] = 2; location[1] = 12; assert(searcher.locationToNode(location) == 38);
	location[0] = 3; location[1] = 0;  assert(searcher.locationToNode(location) == 39);
	location[0] = 4; location[1] = 7;  assert(searcher.locationToNode(location) == 59);
	location[0] = 7; location[1] = 12; assert(searcher.locationToNode(location) == 103);
}
开发者ID:kimmosuo,项目名称:TiRaLab,代码行数:8,代码来源:SearcherTest.cpp

示例12: modules_locker

void
SearchFilterByModuleListAndCU::Search (Searcher &searcher)
{
    if (!m_target_sp)
        return;

    if (searcher.GetDepth() == Searcher::eDepthTarget)
    {
        SymbolContext empty_sc;
        empty_sc.target_sp = m_target_sp;
        searcher.SearchCallback (*this, empty_sc, NULL, false);
    }

    // If the module file spec is a full path, then we can just find the one
    // filespec that passes.  Otherwise, we need to go through all modules and
    // find the ones that match the file name.

    ModuleList matching_modules;
    ModuleList &target_images = m_target_sp->GetImages();
    Mutex::Locker modules_locker(target_images.GetMutex());
    
    const size_t num_modules = target_images.GetSize ();
    bool no_modules_in_filter = m_module_spec_list.GetSize() == 0;
    for (size_t i = 0; i < num_modules; i++)
    {
        lldb::ModuleSP module_sp = target_images.GetModuleAtIndexUnlocked(i);
        if (no_modules_in_filter || m_module_spec_list.FindFileIndex(0, module_sp->GetFileSpec(), false) != UINT32_MAX)
        {
            SymbolContext matchingContext(m_target_sp, module_sp);
            Searcher::CallbackReturn shouldContinue;

            if (searcher.GetDepth() == Searcher::eDepthModule)
            {
                shouldContinue = DoModuleIteration(matchingContext, searcher);
                if (shouldContinue == Searcher::eCallbackReturnStop)
                    return;
            }
            else
            {
                const size_t num_cu = module_sp->GetNumCompileUnits();
                for (size_t cu_idx = 0; cu_idx < num_cu; cu_idx++)
                {
                    CompUnitSP cu_sp = module_sp->GetCompileUnitAtIndex(cu_idx);
                    matchingContext.comp_unit = cu_sp.get();
                    if (matchingContext.comp_unit)
                    {
                        if (m_cu_spec_list.FindFileIndex(0, *matchingContext.comp_unit, false) != UINT32_MAX)
                        {
                            shouldContinue = DoCUIteration(module_sp, matchingContext, searcher);
                            if (shouldContinue == Searcher::eCallbackReturnStop)
                                return;
                        }
                    }
                }
            }
        }
    }
}
开发者ID:ztianjin,项目名称:lldb,代码行数:58,代码来源:SearchFilter.cpp

示例13: cu_sp

Searcher::CallbackReturn
SearchFilter::DoCUIteration(const ModuleSP &module_sp,
                            const SymbolContext &context, Searcher &searcher) {
  Searcher::CallbackReturn shouldContinue;
  if (context.comp_unit == nullptr) {
    const size_t num_comp_units = module_sp->GetNumCompileUnits();
    for (size_t i = 0; i < num_comp_units; i++) {
      CompUnitSP cu_sp(module_sp->GetCompileUnitAtIndex(i));
      if (cu_sp) {
        if (!CompUnitPasses(*(cu_sp.get())))
          continue;

        if (searcher.GetDepth() == lldb::eSearchDepthCompUnit) {
          SymbolContext matchingContext(m_target_sp, module_sp, cu_sp.get());

          shouldContinue =
              searcher.SearchCallback(*this, matchingContext, nullptr, false);

          if (shouldContinue == Searcher::eCallbackReturnPop)
            return Searcher::eCallbackReturnContinue;
          else if (shouldContinue == Searcher::eCallbackReturnStop)
            return shouldContinue;
        } else {
          // First make sure this compile unit's functions are parsed
          // since CompUnit::ForeachFunction only iterates over already
          // parsed functions.
          SymbolVendor *sym_vendor = module_sp->GetSymbolVendor();
          if (!sym_vendor)
            continue;
          if (!sym_vendor->ParseFunctions(*cu_sp))
            continue;
          // If we got any functions, use ForeachFunction to do the iteration.
          cu_sp->ForeachFunction([&](const FunctionSP &func_sp) {
            if (!FunctionPasses(*func_sp.get()))
              return false; // Didn't pass the filter, just keep going.
            if (searcher.GetDepth() == lldb::eSearchDepthFunction) {
              SymbolContext matchingContext(m_target_sp, module_sp, 
                                            cu_sp.get(), func_sp.get());
              shouldContinue = searcher.SearchCallback(*this, 
                                                       matchingContext, 
                                                       nullptr, false);
            } else {
              shouldContinue = DoFunctionIteration(func_sp.get(), context, 
                                                   searcher);
            }
            return shouldContinue != Searcher::eCallbackReturnContinue;
          });
        }
      }
    }
  } else {
    if (CompUnitPasses(*context.comp_unit)) {
      SymbolContext matchingContext(m_target_sp, module_sp, context.comp_unit);
      return searcher.SearchCallback(*this, matchingContext, nullptr, false);
    }
  }
  return Searcher::eCallbackReturnContinue;
}
开发者ID:llvm-project,项目名称:lldb,代码行数:58,代码来源:SearchFilter.cpp

示例14: save_searcher_order

void CustomTabWidget::save_searcher_order(int mode, int logical, int newvisual){
    Searcher *s;
    for(int i = 0; i < this->count(); i++){
        s = static_cast<Searcher*>(this->widget(i));
        if(mode == 0) s->restore_white_order(logical, newvisual);
        else if(mode == 1) s->restore_grey_order(logical, newvisual);
        else if(mode == 2) s->restore_manager_reserve_order(logical, newvisual);
    }
}
开发者ID:qks1,项目名称:erk,代码行数:9,代码来源:customtabwidget.cpp

示例15: save_searcher_width

void CustomTabWidget::save_searcher_width(int mode, int index, int width){
    Searcher *s;
    for(int i = 0; i < this->count(); i++){
        s = static_cast<Searcher*>(this->widget(i));
        if(mode == 0) s->restore_white_width(index, width);
        else if(mode == 1) s->restore_grey_width(index, width);
        else if(mode == 2) s->restore_manager_reserve_width(index, width);
    }
}
开发者ID:qks1,项目名称:erk,代码行数:9,代码来源:customtabwidget.cpp


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