From 44853544f850e1de90b341780168c04d089c37a1 Mon Sep 17 00:00:00 2001 From: shenleban tongying Date: Sun, 1 Sep 2024 20:07:17 -0400 Subject: [PATCH] clean: replace QVector & QPair in headers --- src/article_maker.hh | 4 ++-- src/article_netmgr.hh | 4 ++-- src/btreeidx.hh | 6 +++--- src/common/utils.hh | 2 +- src/config.hh | 22 +++++++++++----------- src/dict/epwing_book.hh | 12 ++++++------ src/langcoder.hh | 4 ++-- src/splitfile.hh | 6 +++--- 8 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/article_maker.hh b/src/article_maker.hh index fd1e4f9b..1dc678c1 100644 --- a/src/article_maker.hh +++ b/src/article_maker.hh @@ -105,9 +105,9 @@ class ArticleRequest: public Dictionary::DataRequest typedef QList< QString > Spacings; /// Splits the given string into words and spacings between them. - QPair< Words, Spacings > splitIntoWords( QString const & ); + std::pair< Words, Spacings > splitIntoWords( QString const & ); - QPair< Words, Spacings > splittedWords; + std::pair< Words, Spacings > splittedWords; int currentSplittedWordStart; int currentSplittedWordEnd; QString currentSplittedWordCompound; diff --git a/src/article_netmgr.hh b/src/article_netmgr.hh index bb64fc96..3b93a20b 100644 --- a/src/article_netmgr.hh +++ b/src/article_netmgr.hh @@ -5,14 +5,14 @@ #define __ARTICLE_NETMGR_HH_INCLUDED__ #include - #include #include -#include #include #include #include +#include + #include "dict/dictionary.hh" #include "article_maker.hh" diff --git a/src/btreeidx.hh b/src/btreeidx.hh index 86aba17b..21ff0579 100644 --- a/src/btreeidx.hh +++ b/src/btreeidx.hh @@ -16,7 +16,7 @@ #include #include #include -#include +#include /// A base for the dictionary which creates a btree index to look up @@ -95,7 +95,7 @@ public: void getAllHeadwords( QSet< QString > & headwords ); /// Find all article links and/or headwords in the index - void findArticleLinks( QVector< WordArticleLink > * articleLinks, + void findArticleLinks( QList< WordArticleLink > * articleLinks, QSet< uint32_t > * offsets, QSet< QString > * headwords, QAtomicInt * isCancelled = 0 ); @@ -106,7 +106,7 @@ public: /// Retrieve headwords for presented article addresses void - getHeadwordsFromOffsets( QList< uint32_t > & offsets, QVector< QString > & headwords, QAtomicInt * isCancelled = 0 ); + getHeadwordsFromOffsets( QList< uint32_t > & offsets, QList< QString > & headwords, QAtomicInt * isCancelled = 0 ); protected: diff --git a/src/common/utils.hh b/src/common/utils.hh index 23dcd3ee..c794e60f 100644 --- a/src/common/utils.hh +++ b/src/common/utils.hh @@ -194,7 +194,7 @@ inline void removeQueryItem( QUrl & url, QString const & key ) url.setQuery( urlQuery ); } -inline void setQueryItems( QUrl & url, QList< QPair< QString, QString > > const & query ) +inline void setQueryItems( QUrl & url, QList< std::pair< QString, QString > > const & query ) { QUrlQuery urlQuery( url ); urlQuery.setQueryItems( query ); diff --git a/src/config.hh b/src/config.hh index 6960277e..5afb7741 100644 --- a/src/config.hh +++ b/src/config.hh @@ -5,7 +5,7 @@ #define __CONFIG_HH_INCLUDED__ #include -#include +#include #include #include #include @@ -47,7 +47,7 @@ struct Path }; /// A list of paths where to search for the dictionaries -typedef QVector< Path > Paths; +typedef QList< Path > Paths; /// A directory holding bunches of audiofiles, which is indexed into a separate /// dictionary. @@ -72,7 +72,7 @@ struct SoundDir }; /// A list of SoundDirs -typedef QVector< SoundDir > SoundDirs; +typedef QList< SoundDir > SoundDirs; struct DictionaryRef { @@ -101,7 +101,7 @@ struct Group QByteArray iconData; QKeySequence shortcut; QString favoritesFolder; - QVector< DictionaryRef > dictionaries; + QList< DictionaryRef > dictionaries; Config::MutedDictionaries mutedDictionaries; // Disabled via dictionary bar Config::MutedDictionaries popupMutedDictionaries; // Disabled via dictionary bar in popup @@ -125,7 +125,7 @@ struct Group }; /// All the groups -struct Groups: public QVector< Group > +struct Groups: public QList< Group > { unsigned nextId; // Id to use to create the group next time @@ -498,7 +498,7 @@ struct WebSite }; /// All the WebSites -typedef QVector< WebSite > WebSites; +typedef QList< WebSite > WebSites; /// Any DICT server struct DictServer @@ -539,14 +539,14 @@ struct DictServer }; /// All the DictServers -typedef QVector< DictServer > DictServers; +typedef QList< DictServer > DictServers; /// Hunspell configuration struct Hunspell { QString dictionariesPath; - typedef QVector< QString > Dictionaries; + typedef QList< QString > Dictionaries; Dictionaries enabledDictionaries; @@ -562,7 +562,7 @@ struct Hunspell }; /// All the MediaWikis -typedef QVector< MediaWiki > MediaWikis; +typedef QList< MediaWiki > MediaWikis; /// Chinese transliteration configuration @@ -755,7 +755,7 @@ struct Program } }; -typedef QVector< Program > Programs; +typedef QList< Program > Programs; #ifndef NO_TTS_SUPPORT struct VoiceEngine @@ -801,7 +801,7 @@ struct VoiceEngine } }; -typedef QVector< VoiceEngine > VoiceEngines; +typedef QList< VoiceEngine > VoiceEngines; #endif struct HeadwordsDialog diff --git a/src/dict/epwing_book.hh b/src/dict/epwing_book.hh index baeefa20..403034cc 100644 --- a/src/dict/epwing_book.hh +++ b/src/dict/epwing_book.hh @@ -6,7 +6,7 @@ #include #include -#include +#include #include #include @@ -58,7 +58,7 @@ struct EpwingHeadword class EpwingBook { - typedef QPair< int, int > EWPos; + typedef std::pair< int, int > EWPos; void setErrorString( QString const & func, EB_Error_Code code ); @@ -79,10 +79,10 @@ class EpwingBook int monoWidth, monoHeight; QStringList imageCacheList, soundsCacheList, moviesCacheList, fontsCacheList; QMap< QString, QString > baseFontsMap, customFontsMap; - QVector< int > refPages, refOffsets; + QList< int > refPages, refOffsets; QMap< uint64_t, bool > allHeadwordPositions; QMap< uint64_t, bool > allRefPositions; - QVector< EWPos > LinksQueue; + QList< EWPos > LinksQueue; int refOpenCount, refCloseCount; static QMutex libMutex; QList< EpwingHeadword > candidateItems; @@ -242,9 +242,9 @@ public: QByteArray handleReference( EB_Hook_Code code, const unsigned int * argv ); - bool getMatches( QString word, QVector< QString > & matches ); + bool getMatches( QString word, QList< QString > & matches ); - bool getArticlePos( QString word, QVector< int > & pages, QVector< int > & offsets ); + bool getArticlePos( QString word, QList< int > & pages, QList< int > & offsets ); QString repairSubBookDirectory( QString subBookDir ); }; diff --git a/src/langcoder.hh b/src/langcoder.hh index 8ba14361..c52b005b 100644 --- a/src/langcoder.hh +++ b/src/langcoder.hh @@ -40,8 +40,8 @@ public: static quint32 findIdForLanguageCode3( std::string const & ); /// find id pairs like en-zh in dictioanry name - static QPair< quint32, quint32 > findLangIdPairFromName( QString const & ); - static QPair< quint32, quint32 > findLangIdPairFromPath( std::string const & ); + static std::pair< quint32, quint32 > findLangIdPairFromName( QString const & ); + static std::pair< quint32, quint32 > findLangIdPairFromPath( std::string const & ); static quint32 guessId( const QString & lang ); diff --git a/src/splitfile.hh b/src/splitfile.hh index 3801e5f2..63f1b08b 100644 --- a/src/splitfile.hh +++ b/src/splitfile.hh @@ -2,7 +2,7 @@ #define __SPLITFILE_HH_INCLUDED__ #include -#include +#include #include #include @@ -19,8 +19,8 @@ class SplitFile { protected: - QVector< QFile * > files; - QVector< quint64 > offsets; + QList< QFile * > files; + QList< quint64 > offsets; int currentFile; void appendFile( const QString & name );