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


C++ Search类代码示例

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


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

示例1: setSearchText

void Searches::tabSelected(QWidget* searchwidget) {
	if (mSearchTabWidget->currentIndex() <= 1)
		return;
	Search * uw = dynamic_cast<Search*>(searchwidget);
	if (uw)
        setSearchText(uw->query());
}
开发者ID:TiBeN,项目名称:museek-plus,代码行数:7,代码来源:searches.cpp

示例2: access

void TokenDatabase::findNext(Database::Search *rSearch,
	CssmDbRecordAttributeData *inAttributes, mach_msg_type_number_t inAttributesLength,
	CssmData *data, RefPointer<Key> &key, RefPointer<Database::Record> &rRecord,
	CssmDbRecordAttributeData * &outAttributes, mach_msg_type_number_t &outAttributesLength)
{
	Access access(token());
	RefPointer<Record> record = new Record(*this);
	Search *search = safe_cast<Search *>(rSearch);
	TRY
	KeyHandle hKey = noKey;
	validate(CSSM_ACL_AUTHORIZATION_DB_READ, openCreds());
	GUARD
	record->tokenHandle() = access().Tokend::ClientSession::findNext(
		search->tokenHandle(), inAttributes, inAttributesLength,
		NULL, hKey, outAttributes, outAttributesLength);
	if (!record->tokenHandle()) {	// no more matches
		releaseSearch(*search);		// release search handle (consumed by EOD)
		rRecord = NULL;				// return null record
		return;
	}
	if (data) {
		if (!hKey)
			record->validate(CSSM_ACL_AUTHORIZATION_DB_READ, openCreds());
		CssmDbRecordAttributeData *noAttributes;
		mach_msg_type_number_t noAttributesLength;
		access().Tokend::ClientSession::findRecordHandle(record->tokenHandle(),
			NULL, 0, data, hKey, noAttributes, noAttributesLength);
		if (hKey) {		// tokend returned a key reference & data
			CssmKey &keyForm = *data->interpretedAs<CssmKey>(CSSMERR_CSP_INVALID_KEY);
			key = new TokenKey(*this, hKey, keyForm.header());
		}
	}
	rRecord = record->commit();
	DONE
}
开发者ID:Apple-FOSS-Mirror,项目名称:securityd,代码行数:35,代码来源:tokendatabase.cpp

示例3: Search

void Searches::setToken(const QString& query, uint token) {
    int i;
	for(i = 2; i < mSearchTabWidget->count(); ++i) {
		Search* search = dynamic_cast<Search*>(mSearchTabWidget->widget(i));
		if(search && search->query() == QString(query)) {
			search->setToken(token);
			return;
		}
	}

    // Create the tab if it's a wishlist result
	if ((i == mSearchTabWidget->count()) && museeq->isInWishlist(query)) {
		Search* s = new Search(query, mSearchTabWidget, false);
		mSearchTabWidget->addTab(s, query);

        // Highlight the search icon so that the user know that there are some new search results
		connect(s, SIGNAL(highlight(int, QWidget*)), SIGNAL(highlight(int)));

        // Highlight the tab where we have received new search results
		connect(s, SIGNAL(highlight(int, QWidget*)), mSearchTabWidget, SLOT(setHighlight(int, QWidget*)));

		mSearchTabWidget->setCurrentWidget(s);
		s->setToken(token);
	}
}
开发者ID:TiBeN,项目名称:museek-plus,代码行数:25,代码来源:searches.cpp

示例4: DoFoundChecks

    void DoFoundChecks(Search& s, COORD& coordStartExpected, SHORT lineDelta)
    {
        COORD coordEndExpected = coordStartExpected;
        coordEndExpected.X += 1;

        VERIFY_IS_TRUE(s.FindNext());
        VERIFY_ARE_EQUAL(coordStartExpected, s._coordSelStart);
        VERIFY_ARE_EQUAL(coordEndExpected, s._coordSelEnd);

        coordStartExpected.Y += lineDelta;
        coordEndExpected.Y += lineDelta;
        VERIFY_IS_TRUE(s.FindNext());
        VERIFY_ARE_EQUAL(coordStartExpected, s._coordSelStart);
        VERIFY_ARE_EQUAL(coordEndExpected, s._coordSelEnd);

        coordStartExpected.Y += lineDelta;
        coordEndExpected.Y += lineDelta;
        VERIFY_IS_TRUE(s.FindNext());
        VERIFY_ARE_EQUAL(coordStartExpected, s._coordSelStart);
        VERIFY_ARE_EQUAL(coordEndExpected, s._coordSelEnd);

        coordStartExpected.Y += lineDelta;
        coordEndExpected.Y += lineDelta;
        VERIFY_IS_TRUE(s.FindNext());
        VERIFY_ARE_EQUAL(coordStartExpected, s._coordSelStart);
        VERIFY_ARE_EQUAL(coordEndExpected, s._coordSelEnd);

        VERIFY_IS_FALSE(s.FindNext());
    }
开发者ID:ShipRekt101,项目名称:terminal,代码行数:29,代码来源:SearchTests.cpp

示例5: main

int main (int argc, const char * argv[])
{
	srand(0);
	Megaminx * target = new Megaminx;
	target->setTarget(target);
	unsigned int maxInst = target->getPossibleInstructions();
	Puzzle const * test = target;
	for (int i = 0; i < 14; ++i)
	{
		int inst = rand() % maxInst;
		cout << instToCStr(inst) << endl;
		test = test->getPuzzleRotatedBy(inst);
	}
	Search * search = new Search;
	cout << "******\n";
	stack<int> * solution = search->aStarSearch(test);
	cout << search->getCreatedNodes() << " " << search->getElapsedTime() << endl;
	delete search;
	while (!solution->empty())
	{
		cout << instToCStr(solution->top()) << endl;
		solution->pop();
	}
	return 0;
}
开发者ID:tblyons,项目名称:Backend,代码行数:25,代码来源:main.cpp

示例6: set

bool Query::set(int index, const Search& search)
{
	if (!isValidIndex(index))
		return false;
	int subindex = m_searchMap.indexOf(index);
	if (subindex >= 0) {
		delete m_search.at(subindex);
		m_search.replace(subindex, search.clone());
		return true;
	} else {
		subindex = m_operatorMap.indexOf(index);
		if (subindex >= 0) {
			// Here the given index is a operator, so we have to remove the operator,
			// and add a search at that position
			m_operatorMap.removeAt(m_operatorMap.at(subindex));
			m_operator.removeAt(m_operator.at(subindex));
			m_search.append(search.clone());
			m_searchMap.append(index);
			m_elementType[index] = SearchElement;
			return true;
		} else {
			// The index could not be found in the operator or search lists
			return false;
		}
	}
}
开发者ID:niklasf,项目名称:chessx,代码行数:26,代码来源:query.cpp

示例7: RAGS2

class RAGS2{
  public:
    RAGS2(){
      //make graph
      //search graph
      //totalCost = 0;
      //totalCost = RAGS2(searchGraph, SGPaths[0]->GetVertex(), GSPaths[0]->GetVertex());
      //allCosts.push_back(totalCost);
    };
  private:

}


double RAGS2::Search(Graph * graph, Vertex * source, Vertex * goal){
  // Initialize search
  double cost = 0.0;
  Search * testSearch = new Search(graph, curLoc, goal);
  pathOut pType = RAGS2;
  testSearch.PathSearch(pType);

  // To modify this into D* style search add loop...search after each step 

  delete testSearch;
  return cost;
}
开发者ID:osurdml,项目名称:RAGS2,代码行数:26,代码来源:RAGS2.hpp

示例8: main

int main(int argc, char** argv) {




    Node node("input.txt");


    Search search;
    stringstream sstream;
    Node goal;
    bool success = search.bfs(&node, &goal);
    if (success) {
        sstream << goal.getLevel() << endl;
        sstream << goal.getPath() << endl;
    } else {
        sstream << -1 << endl << endl;
    }

    success = search.ucs(&node, &goal);
    if (success) {
        sstream << goal.getCost() << endl;
        sstream << goal.getPath() << endl;
    } else {
        sstream << -1 << endl;
    }

    IO io;

    io.stringToFile("output.txt", sstream.str());


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

示例9: main

int main()
{
	Parser p;
	IndexReader in;
    in.genIndexFromFile();
    Search s;
    string query;
	while (getline(cin,query)) {
        Query* q=p.parse(query);
        //cout<<"------"<<endl;
        //cout<<q->sign<<" "<<q->token<<endl;
        /*for(int i=0;i<q->size();i++)
        {
        	Query* s=q->get(i);
        	//cout<<s->sign<<" "<<s->token<<endl;
        	for(int j=0;j<s->size();j++)
        	{
        		Query* p=s->get(j);
        	//	cout<<p->sign<<" "<<p->token<<endl;
        	}
        }*/
        vector<vector<string> > l;
    	s.search(q,in,l);
    	s.show(q,in,l);
		delete q;
    }
}
开发者ID:Louffy,项目名称:IRS,代码行数:27,代码来源:searchmain.cpp

示例10:

std::vector<std::string> TextFinder::GetResults()
{
    Search searchService;

    std::vector<std::string> results = searchService.StartTextSearch(_searchKeywords, _searchPath, _searchAll);
	
    return results;

}
开发者ID:yufangong,项目名称:text-finder,代码行数:9,代码来源:TextFinder.cpp

示例11: selected

void SearchTabWidget::selected(QWidget* searchwidget) {
	if (currentIndex() <= 1)
		return;
	Search * uw = dynamic_cast<Search*>(searchwidget);
	if(uw && uw->highlighted() != 0) {
		uw->setHighlighted(0);
		setHighlight(uw->highlighted(), uw );
	}
}
开发者ID:TiBeN,项目名称:museek-plus,代码行数:9,代码来源:searches.cpp

示例12: qDebug

void Searches::append(uint token, const QString& user, bool free, uint speed, uint files, const NFolder& r) {
    qDebug() << "Search results from " << user;
	for(int i = 2; i < mSearchTabWidget->count(); ++i) {
		Search* search = dynamic_cast<Search*>(mSearchTabWidget->widget(i));
		if(search && search->hasToken(token)) {
			search->append(user, free, speed, files, r);
			return;
		}
	}
}
开发者ID:TiBeN,项目名称:museek-plus,代码行数:10,代码来源:searches.cpp

示例13: QProgressDialog

void SearchDialog::newSearch() {
  QString phrase = QInputDialog::getText(pgView, "Search in notebook",
                                         "Search phrase:",
                                         QLineEdit::Normal,
                                         lastPhrase);
  lastPhrase = phrase;

  if (phrase.isEmpty())
    return;

  QProgressDialog *progress = new QProgressDialog(pgView);
  progress->setLabelText("Searching...");
  progress->setCancelButton(0);
  progress->setMinimumDuration(500);
  progress->setValue(0);
  Search *search = new Search(pgView->notebook());
  QList<SearchResult> res = search->immediatelyFindPhrase(phrase);

  if (res.isEmpty()) {
    delete progress;
    QMessageBox::information(pgView, "Search - eln",
                             QString::fromUtf8("Search phrase “%1” not found")
                             .arg(phrase));
    return;
  }
  
  SearchResultScene *scene
    = new SearchResultScene(phrase,
			    QString::fromUtf8("Search results for “%1”")
			    .arg(phrase),
			    res,
			    pgView->notebook()->bookData());
  scene->populate();
  connect(scene,
	  SIGNAL(pageNumberClicked(int, Qt::KeyboardModifiers,
				   QString, QString)),
	  this,
	  SLOT(gotoPage(int, Qt::KeyboardModifiers, QString, QString)));
  SearchView *view = new SearchView(scene);
  view->setAttribute(Qt::WA_DeleteOnClose, true);
  connect(parent(), SIGNAL(destroyed()), view, SLOT(close()));
  delete progress;
  
  view->resize(pgView->size()*.9);
  QString ttl = pgView->notebook()->bookData()->title();
  view->setWindowTitle("Search in: "
		       + ttl.replace(QRegExp("\\s\\s*"), " ") + " - eln");
  view->show();
}
开发者ID:wagenadl,项目名称:eln,代码行数:49,代码来源:SearchDialog.cpp

示例14: switch

bool Query::internalCheck()
{
	int i;
	Search::Operator op;
	Search *s = NULL;
	ElementTypeList::iterator elementIter;

	if (count() != (countOperands() + countOperators())) {
		return false;
	}

	for (elementIter = m_elementType.begin(), i = 0; elementIter != m_elementType.end(); ++elementIter, ++i) {
		switch (*elementIter) {
			case SearchElement :
				s = search(i);
				if (s == NULL) {
					return false;
				}
				switch (s->type()) {
					case Search::NullSearch :
					case Search::PositionSearch :
					case Search::EloSearch :
						break;
					default :
						// undefined search
						return false;
				}
				break;
			case OperatorElement :
				op = searchOperator(i);
				switch (op) {
					case Search::And :
					case Search::Or :
					case Search::Remove :
					case Search::Not :
					case Search::NullOperator :
						break;
					default :
						// Undefined operator
						return false;
				}
				break;
			default :
				// Undefined element
				return false;
		}
	}
	return true;
}
开发者ID:niklasf,项目名称:chessx,代码行数:49,代码来源:query.cpp

示例15: setupSearch

bool setupSearch(const Game *g, const int *needList, Search &search, SearchMap &searchData) {
	for (const int *entry = needList; *entry != -1; ++entry) {
		ExtractEntryList providers = getProvidersForId(*entry);

		if (providers.empty()) {
			fprintf(stderr, "ERROR: No provider for id %d/%s\n", *entry, getIdString(*entry));
			return false;
		} else {
			for (ExtractEntryList::const_iterator i = providers.begin(); i != providers.end(); ++i) {
				// Only add generic or partly matching providers here.
#ifndef DEBUG_EXTRACTION_TABLES
				if ((i->lang == UNK_LANG || i->lang == g->lang[0] || i->lang == g->lang[1] || i->lang == g->lang[2]) &&
				    (i->platform == kPlatformUnknown || (i->platform == g->platform))) {
#endif
					search.addData(i->hint);
					searchData.insert(SearchMapEntry(*entry, *i));
#ifndef DEBUG_EXTRACTION_TABLES
				}
#endif
			}
		}
	}

	return true;
}
开发者ID:peres,项目名称:scummvm,代码行数:25,代码来源:create_kyradat.cpp


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