okular/core/textpage_p.h
Pino Toscano 192c0a0880 refactor a bit the string matching in text search, using a intermediate comparer function
this way, we can choose the comparing strategy before starting the search
also, make the comparer function use stringref, so we avoid copying data from the original strings (meaning less memory used, and slightly faster)
provide two comparing strategies, case sensitive and case insensitive, to continue doing the same job done so far

svn path=/trunk/KDE/kdegraphics/okular/; revision=1066591
2009-12-27 14:22:13 +00:00

54 lines
2.2 KiB
C++

/***************************************************************************
* Copyright (C) 2006 by Tobias Koenig <tokoe@kde.org> *
* Copyright (C) 2007 by Pino Toscano <pino@kde.org> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
#ifndef _OKULAR_TEXTPAGE_P_H_
#define _OKULAR_TEXTPAGE_P_H_
#include <QtCore/QList>
#include <QtCore/QMap>
#include <QtGui/QMatrix>
class SearchPoint;
class TinyTextEntity;
namespace Okular
{
class PagePrivate;
typedef QList< TinyTextEntity* > TextList;
typedef bool ( *TextComparisonFunction )( const QStringRef & from, const QStringRef & to,
int *fromLength, int *toLength );
class TextPagePrivate
{
public:
TextPagePrivate();
~TextPagePrivate();
RegularAreaRect * findTextInternalForward( int searchID, const QString &query,
Qt::CaseSensitivity caseSensitivity,
TextComparisonFunction comparer,
const TextList::ConstIterator &start,
const TextList::ConstIterator &end );
RegularAreaRect * findTextInternalBackward( int searchID, const QString &query,
Qt::CaseSensitivity caseSensitivity,
TextComparisonFunction comparer,
const TextList::ConstIterator &start,
const TextList::ConstIterator &end );
TextList m_words;
QMap< int, SearchPoint* > m_searchPoints;
PagePrivate *m_page;
};
}
#endif