Beispiel #1
0
Word Filter::nextWord() const
{
    QChar currentChar = skipToLetter( m_currentPosition );

    if ( m_currentPosition >= m_buffer.length() ) {
        return Filter::end();
    }

    bool allUppercase = currentChar.category() & QChar::Letter_Uppercase;
    bool runTogether = false;

    QString foundWord;
    int start = m_currentPosition;
    while ( currentChar.isLetter() ) {
        if ( currentChar.category() & QChar::Letter_Lowercase )
            allUppercase = false;

	/* FIXME: this does not work for Hebrew for example
        //we consider run-together words as mixed-case words
        if ( !allUppercase &&
             currentChar.category() & QChar::Letter_Uppercase )
            runTogether = true;
	*/

        foundWord += currentChar;
        ++m_currentPosition;
        currentChar = m_buffer[ m_currentPosition ];
    }

    if ( shouldBeSkipped( allUppercase, runTogether, foundWord ) )
        return nextWord();

    return Word( foundWord, start );
}
Beispiel #2
0
Word Filter::nextWord() const
{
    QString foundWord;
    int start;
    bool allUppercase = false;
    bool runTogether = false;

    if (!finderNextWord(m_finder, foundWord, start))
        return Filter::end();

    allUppercase = ( foundWord == foundWord.toUpper() );

    //TODO implement runtogether correctly.
    //We must ask to sonnet plugins to do it and not directly here.

    if ( shouldBeSkipped( allUppercase, runTogether, foundWord ) )
        return nextWord();
    return Word( foundWord, start );
}