aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/help/HelpIndex.h
diff options
context:
space:
mode:
authorGravatar Alexey Sokolov2016-04-29 23:57:30 +0100
committerGravatar Alexey Sokolov2016-04-29 23:57:48 +0100
commit690dd7a33ddc90678367d73adf313533536e10f2 (patch)
tree2276fe7c384ebbc222b40a19c536d5c3c5606ce8 /src/modules/help/HelpIndex.h
parentAdd config for clang-format. (diff)
downloadKVIrc-690dd7a33ddc90678367d73adf313533536e10f2.tar.gz
KVIrc-690dd7a33ddc90678367d73adf313533536e10f2.tar.bz2
KVIrc-690dd7a33ddc90678367d73adf313533536e10f2.zip
Apply clang-format
Diffstat (limited to 'src/modules/help/HelpIndex.h')
-rw-r--r--src/modules/help/HelpIndex.h144
1 files changed, 76 insertions, 68 deletions
diff --git a/src/modules/help/HelpIndex.h b/src/modules/help/HelpIndex.h
index effe15f8e..0a6b401f8 100644
--- a/src/modules/help/HelpIndex.h
+++ b/src/modules/help/HelpIndex.h
@@ -50,88 +50,96 @@ class QTimer;
QT_BEGIN_NAMESPACE
-struct Document {
- Document( int d, int f ) : docNumber( d ), frequency( f ) {}
- Document() : docNumber( -1 ), frequency( 0 ) {}
- bool operator==( const Document &doc ) const {
- return docNumber == doc.docNumber;
- }
- bool operator<( const Document &doc ) const {
- return frequency > doc.frequency;
- }
- bool operator<=( const Document &doc ) const {
- return frequency >= doc.frequency;
- }
- bool operator>( const Document &doc ) const {
- return frequency < doc.frequency;
- }
- qint16 docNumber;
- qint16 frequency;
+struct Document
+{
+ Document(int d, int f) : docNumber(d), frequency(f) {}
+ Document() : docNumber(-1), frequency(0) {}
+ bool operator==(const Document & doc) const
+ {
+ return docNumber == doc.docNumber;
+ }
+ bool operator<(const Document & doc) const
+ {
+ return frequency > doc.frequency;
+ }
+ bool operator<=(const Document & doc) const
+ {
+ return frequency >= doc.frequency;
+ }
+ bool operator>(const Document & doc) const
+ {
+ return frequency < doc.frequency;
+ }
+ qint16 docNumber;
+ qint16 frequency;
};
-QDataStream &operator>>( QDataStream &s, Document &l );
-QDataStream &operator<<( QDataStream &s, const Document &l );
+QDataStream & operator>>(QDataStream & s, Document & l);
+QDataStream & operator<<(QDataStream & s, const Document & l);
class HelpIndex : public QObject
{
- Q_OBJECT
+ Q_OBJECT
public:
- struct Entry {
- Entry( int d ) { documents.append( Document( d, 1 ) ); }
- Entry( QVector<Document> l ) : documents( l ) {}
- QVector<Document> documents;
- };
- struct PosEntry {
- PosEntry( int p ) { positions.append( p ); }
- QList<uint> positions;
- };
+ struct Entry
+ {
+ Entry(int d) { documents.append(Document(d, 1)); }
+ Entry(QVector<Document> l) : documents(l) {}
+ QVector<Document> documents;
+ };
+ struct PosEntry
+ {
+ PosEntry(int p) { positions.append(p); }
+ QList<uint> positions;
+ };
- HelpIndex( const QString &dp, const QString &hp );
- HelpIndex( const QStringList &dl, const QString &hp );
- void writeDict();
- void readDict();
- void makeIndex();
- QStringList query( const QStringList&, const QStringList&, const QStringList& );
- QString getDocumentTitle( const QString& );
- void setDictionaryFile( const QString& );
- void setDocListFile( const QString& );
- void setDocList( const QStringList & );
+ HelpIndex(const QString & dp, const QString & hp);
+ HelpIndex(const QStringList & dl, const QString & hp);
+ void writeDict();
+ void readDict();
+ void makeIndex();
+ QStringList query(const QStringList &, const QStringList &, const QStringList &);
+ QString getDocumentTitle(const QString &);
+ void setDictionaryFile(const QString &);
+ void setDocListFile(const QString &);
+ void setDocList(const QStringList &);
- const QStringList& documentList() { return docList; };
- const QStringList& titlesList() { return titleList; };
+ const QStringList & documentList() { return docList; };
+ const QStringList & titlesList() { return titleList; };
signals:
- void indexingStart( int );
- void indexingProgress( int );
- void indexingEnd();
+ void indexingStart(int);
+ void indexingProgress(int);
+ void indexingEnd();
private slots:
- void setLastWinClosed();
+ void setLastWinClosed();
void filterNext();
+
private:
- void setupDocumentList();
- void parseDocument( const QString&, int );
- void insertInDict( const QString&, int );
- void writeDocumentList();
- void readDocumentList();
- QStringList getWildcardTerms( const QString& );
- QStringList split( const QString& );
- QVector<Document> setupDummyTerm( const QStringList& );
- bool searchForPattern( const QStringList&, const QStringList&, const QString& );
- void buildMiniDict( const QString& );
- QString getCharsetForDocument(QFile *);
- QStringList docList;
- QStringList titleList;
- QHash<QString, Entry*> dict;
- QHash<QString, PosEntry*> miniDict;
- uint wordNum;
- QString docPath;
- QString dictFile, docListFile;
- bool alreadyHaveDocList;
- bool lastWindowClosed;
- QHash<QString, QString> documentTitleCache;
- QTimer * m_pTimer;
- int m_iCurItem;
+ void setupDocumentList();
+ void parseDocument(const QString &, int);
+ void insertInDict(const QString &, int);
+ void writeDocumentList();
+ void readDocumentList();
+ QStringList getWildcardTerms(const QString &);
+ QStringList split(const QString &);
+ QVector<Document> setupDummyTerm(const QStringList &);
+ bool searchForPattern(const QStringList &, const QStringList &, const QString &);
+ void buildMiniDict(const QString &);
+ QString getCharsetForDocument(QFile *);
+ QStringList docList;
+ QStringList titleList;
+ QHash<QString, Entry *> dict;
+ QHash<QString, PosEntry *> miniDict;
+ uint wordNum;
+ QString docPath;
+ QString dictFile, docListFile;
+ bool alreadyHaveDocList;
+ bool lastWindowClosed;
+ QHash<QString, QString> documentTitleCache;
+ QTimer * m_pTimer;
+ int m_iCurItem;
};
#endif