Esempio n. 1
0
bool Prediction::operator== (const Prediction& right) const
{
    // same instance is obviously equal to itself
    if (&right == this) {
	return true;
    } else {
	if (size() != right.size()) {
	    return false;
	} else {
	    // need to compare each suggestion
	    bool result = true;
	    size_t i = 0;
	    while (i < size() && result) {
		if (getSuggestion(i) != right.getSuggestion(i)) {
		    result = false;
		}
		i++;
	    }
	    return result;
	}
    }
}
bool UnicodeTournamentTrieClient::GetPlaceSuggestions( const QString& input, int amount, QStringList* suggestions, QStringList* inputSuggestions )
{
	unsigned node = 0;
	QString prefix;
	QString name = input.toLower();

	if ( !find( trieData, &node, &prefix, name ) )
		return false;

	if ( prefix.length() == 0 ) {
		utt::Node element;
		element.Read( trieData + node );
		for ( std::vector< utt::Label >::const_iterator c = element.labelList.begin(), e = element.labelList.end(); c != e; ++c )
			inputSuggestions->push_back( input + c->string );
	}
	else {
		inputSuggestions->push_back( input + prefix );
	}
	getSuggestion( trieData, suggestions, node, amount, name + prefix );
	std::sort( inputSuggestions->begin(), inputSuggestions->end() );
	return true;
}
void AutofillPopupMenuClient::setTextFromItem(unsigned listIndex)
{
    m_textField->setValue(getSuggestion(listIndex));
}
String AutofillPopupMenuClient::itemText(unsigned listIndex) const
{
    return getSuggestion(listIndex);
}