clean: replace QVector & QPair in headers

This commit is contained in:
shenleban tongying 2024-09-01 20:07:17 -04:00
parent 9de4334204
commit 44853544f8
8 changed files with 30 additions and 30 deletions

View file

@ -105,9 +105,9 @@ class ArticleRequest: public Dictionary::DataRequest
typedef QList< QString > Spacings; typedef QList< QString > Spacings;
/// Splits the given string into words and spacings between them. /// 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 currentSplittedWordStart;
int currentSplittedWordEnd; int currentSplittedWordEnd;
QString currentSplittedWordCompound; QString currentSplittedWordCompound;

View file

@ -5,14 +5,14 @@
#define __ARTICLE_NETMGR_HH_INCLUDED__ #define __ARTICLE_NETMGR_HH_INCLUDED__
#include <QtNetwork> #include <QtNetwork>
#include <QSet> #include <QSet>
#include <QMap> #include <QMap>
#include <QPair>
#include <QWebEngineUrlSchemeHandler> #include <QWebEngineUrlSchemeHandler>
#include <QWebEngineUrlRequestJob> #include <QWebEngineUrlRequestJob>
#include <QNetworkAccessManager> #include <QNetworkAccessManager>
#include <utility>
#include "dict/dictionary.hh" #include "dict/dictionary.hh"
#include "article_maker.hh" #include "article_maker.hh"

View file

@ -16,7 +16,7 @@
#include <QFuture> #include <QFuture>
#include <QList> #include <QList>
#include <QSet> #include <QSet>
#include <QVector> #include <QList>
/// A base for the dictionary which creates a btree index to look up /// A base for the dictionary which creates a btree index to look up
@ -95,7 +95,7 @@ public:
void getAllHeadwords( QSet< QString > & headwords ); void getAllHeadwords( QSet< QString > & headwords );
/// Find all article links and/or headwords in the index /// 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< uint32_t > * offsets,
QSet< QString > * headwords, QSet< QString > * headwords,
QAtomicInt * isCancelled = 0 ); QAtomicInt * isCancelled = 0 );
@ -106,7 +106,7 @@ public:
/// Retrieve headwords for presented article addresses /// Retrieve headwords for presented article addresses
void void
getHeadwordsFromOffsets( QList< uint32_t > & offsets, QVector< QString > & headwords, QAtomicInt * isCancelled = 0 ); getHeadwordsFromOffsets( QList< uint32_t > & offsets, QList< QString > & headwords, QAtomicInt * isCancelled = 0 );
protected: protected:

View file

@ -194,7 +194,7 @@ inline void removeQueryItem( QUrl & url, QString const & key )
url.setQuery( urlQuery ); 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 ); QUrlQuery urlQuery( url );
urlQuery.setQueryItems( query ); urlQuery.setQueryItems( query );

View file

@ -5,7 +5,7 @@
#define __CONFIG_HH_INCLUDED__ #define __CONFIG_HH_INCLUDED__
#include <QObject> #include <QObject>
#include <QVector> #include <QList>
#include <QString> #include <QString>
#include <QSize> #include <QSize>
#include <QDateTime> #include <QDateTime>
@ -47,7 +47,7 @@ struct Path
}; };
/// A list of paths where to search for the dictionaries /// 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 /// A directory holding bunches of audiofiles, which is indexed into a separate
/// dictionary. /// dictionary.
@ -72,7 +72,7 @@ struct SoundDir
}; };
/// A list of SoundDirs /// A list of SoundDirs
typedef QVector< SoundDir > SoundDirs; typedef QList< SoundDir > SoundDirs;
struct DictionaryRef struct DictionaryRef
{ {
@ -101,7 +101,7 @@ struct Group
QByteArray iconData; QByteArray iconData;
QKeySequence shortcut; QKeySequence shortcut;
QString favoritesFolder; QString favoritesFolder;
QVector< DictionaryRef > dictionaries; QList< DictionaryRef > dictionaries;
Config::MutedDictionaries mutedDictionaries; // Disabled via dictionary bar Config::MutedDictionaries mutedDictionaries; // Disabled via dictionary bar
Config::MutedDictionaries popupMutedDictionaries; // Disabled via dictionary bar in popup Config::MutedDictionaries popupMutedDictionaries; // Disabled via dictionary bar in popup
@ -125,7 +125,7 @@ struct Group
}; };
/// All the groups /// All the groups
struct Groups: public QVector< Group > struct Groups: public QList< Group >
{ {
unsigned nextId; // Id to use to create the group next time unsigned nextId; // Id to use to create the group next time
@ -498,7 +498,7 @@ struct WebSite
}; };
/// All the WebSites /// All the WebSites
typedef QVector< WebSite > WebSites; typedef QList< WebSite > WebSites;
/// Any DICT server /// Any DICT server
struct DictServer struct DictServer
@ -539,14 +539,14 @@ struct DictServer
}; };
/// All the DictServers /// All the DictServers
typedef QVector< DictServer > DictServers; typedef QList< DictServer > DictServers;
/// Hunspell configuration /// Hunspell configuration
struct Hunspell struct Hunspell
{ {
QString dictionariesPath; QString dictionariesPath;
typedef QVector< QString > Dictionaries; typedef QList< QString > Dictionaries;
Dictionaries enabledDictionaries; Dictionaries enabledDictionaries;
@ -562,7 +562,7 @@ struct Hunspell
}; };
/// All the MediaWikis /// All the MediaWikis
typedef QVector< MediaWiki > MediaWikis; typedef QList< MediaWiki > MediaWikis;
/// Chinese transliteration configuration /// Chinese transliteration configuration
@ -755,7 +755,7 @@ struct Program
} }
}; };
typedef QVector< Program > Programs; typedef QList< Program > Programs;
#ifndef NO_TTS_SUPPORT #ifndef NO_TTS_SUPPORT
struct VoiceEngine struct VoiceEngine
@ -801,7 +801,7 @@ struct VoiceEngine
} }
}; };
typedef QVector< VoiceEngine > VoiceEngines; typedef QList< VoiceEngine > VoiceEngines;
#endif #endif
struct HeadwordsDialog struct HeadwordsDialog

View file

@ -6,7 +6,7 @@
#include <QMap> #include <QMap>
#include <QStack> #include <QStack>
#include <QVector> #include <QList>
#include <QtGlobal> #include <QtGlobal>
#include <string> #include <string>
@ -58,7 +58,7 @@ struct EpwingHeadword
class EpwingBook class EpwingBook
{ {
typedef QPair< int, int > EWPos; typedef std::pair< int, int > EWPos;
void setErrorString( QString const & func, EB_Error_Code code ); void setErrorString( QString const & func, EB_Error_Code code );
@ -79,10 +79,10 @@ class EpwingBook
int monoWidth, monoHeight; int monoWidth, monoHeight;
QStringList imageCacheList, soundsCacheList, moviesCacheList, fontsCacheList; QStringList imageCacheList, soundsCacheList, moviesCacheList, fontsCacheList;
QMap< QString, QString > baseFontsMap, customFontsMap; QMap< QString, QString > baseFontsMap, customFontsMap;
QVector< int > refPages, refOffsets; QList< int > refPages, refOffsets;
QMap< uint64_t, bool > allHeadwordPositions; QMap< uint64_t, bool > allHeadwordPositions;
QMap< uint64_t, bool > allRefPositions; QMap< uint64_t, bool > allRefPositions;
QVector< EWPos > LinksQueue; QList< EWPos > LinksQueue;
int refOpenCount, refCloseCount; int refOpenCount, refCloseCount;
static QMutex libMutex; static QMutex libMutex;
QList< EpwingHeadword > candidateItems; QList< EpwingHeadword > candidateItems;
@ -242,9 +242,9 @@ public:
QByteArray handleReference( EB_Hook_Code code, const unsigned int * argv ); 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 ); QString repairSubBookDirectory( QString subBookDir );
}; };

View file

@ -40,8 +40,8 @@ public:
static quint32 findIdForLanguageCode3( std::string const & ); static quint32 findIdForLanguageCode3( std::string const & );
/// find id pairs like en-zh in dictioanry name /// find id pairs like en-zh in dictioanry name
static QPair< quint32, quint32 > findLangIdPairFromName( QString const & ); static std::pair< quint32, quint32 > findLangIdPairFromName( QString const & );
static QPair< quint32, quint32 > findLangIdPairFromPath( std::string const & ); static std::pair< quint32, quint32 > findLangIdPairFromPath( std::string const & );
static quint32 guessId( const QString & lang ); static quint32 guessId( const QString & lang );

View file

@ -2,7 +2,7 @@
#define __SPLITFILE_HH_INCLUDED__ #define __SPLITFILE_HH_INCLUDED__
#include <QFile> #include <QFile>
#include <QVector> #include <QList>
#include <QString> #include <QString>
#include <vector> #include <vector>
@ -19,8 +19,8 @@ class SplitFile
{ {
protected: protected:
QVector< QFile * > files; QList< QFile * > files;
QVector< quint64 > offsets; QList< quint64 > offsets;
int currentFile; int currentFile;
void appendFile( const QString & name ); void appendFile( const QString & name );