Merge branch 'feature/cpp-refactor-code' into staged

This commit is contained in:
xiaoyifang 2022-02-03 17:51:40 +08:00
commit c2b466ce19
75 changed files with 269 additions and 276 deletions

View file

@ -261,7 +261,7 @@ class AardDictionary: public BtreeIndexing::BtreeDictionary
vector< wstring > const & alts,
wstring const &,
bool ignoreDiacritics )
THROW_SPEC( std::exception );
;
virtual QString const& getDescription();
@ -826,7 +826,7 @@ sptr< Dictionary::DataRequest > AardDictionary::getArticle( wstring const & word
vector< wstring > const & alts,
wstring const &,
bool ignoreDiacritics )
THROW_SPEC( std::exception )
{
return new AardArticleRequest( word, alts, *this, ignoreDiacritics );
}
@ -838,7 +838,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
string const & indicesDir,
Dictionary::Initializing & initializing,
unsigned maxHeadwordsToExpand )
THROW_SPEC( std::exception )
{
vector< sptr< Dictionary::Class > > dictionaries;

View file

@ -17,7 +17,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
string const & indicesDir,
Dictionary::Initializing &,
unsigned maxHeadwordsToExpand )
THROW_SPEC( std::exception );
;
}

View file

@ -406,7 +406,7 @@ public:
}
};
std::vector< sptr< Dictionary::Class > > makeDictionaries() THROW_SPEC( std::exception )
std::vector< sptr< Dictionary::Class > > makeDictionaries()
{
static BelarusianLatinToClassicTable t0;
static BelarusianLatinToSchoolTable t1;

View file

@ -10,7 +10,7 @@
// Support for Belarusian transliteration
namespace BelarusianTranslit {
std::vector< sptr< Dictionary::Class > > makeDictionaries() THROW_SPEC( std::exception );
std::vector< sptr< Dictionary::Class > > makeDictionaries() ;
}

14
bgl.cc
View file

@ -226,16 +226,16 @@ namespace
{ return idxHeader.langTo; }
virtual sptr< Dictionary::WordSearchRequest > findHeadwordsForSynonym( wstring const & )
THROW_SPEC( std::exception );
;
virtual sptr< Dictionary::DataRequest > getArticle( wstring const &,
vector< wstring > const & alts,
wstring const &,
bool ignoreDiacritics )
THROW_SPEC( std::exception );
;
virtual sptr< Dictionary::DataRequest > getResource( string const & name )
THROW_SPEC( std::exception );
;
virtual sptr< Dictionary::DataRequest > getSearchResults( QString const & searchString,
int searchMode, bool matchCase,
@ -609,7 +609,7 @@ void BglHeadwordsRequest::run()
sptr< Dictionary::WordSearchRequest >
BglDictionary::findHeadwordsForSynonym( wstring const & word )
THROW_SPEC( std::exception )
{
return synonymSearchEnabled ? new BglHeadwordsRequest( word, *this ) :
Class::findHeadwordsForSynonym( word );
@ -933,7 +933,7 @@ sptr< Dictionary::DataRequest > BglDictionary::getArticle( wstring const & word,
vector< wstring > const & alts,
wstring const &,
bool ignoreDiacritics )
THROW_SPEC( std::exception )
{
return new BglArticleRequest( word, alts, *this, ignoreDiacritics );
}
@ -1077,7 +1077,7 @@ void BglResourceRequest::run()
}
sptr< Dictionary::DataRequest > BglDictionary::getResource( string const & name )
THROW_SPEC( std::exception )
{
return new BglResourceRequest( idxMutex, idx, idxHeader.resourceListOffset,
idxHeader.resourcesCount, name );
@ -1178,7 +1178,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
vector< string > const & fileNames,
string const & indicesDir,
Dictionary::Initializing & initializing )
THROW_SPEC( std::exception )
{
vector< sptr< Dictionary::Class > > dictionaries;

2
bgl.hh
View file

@ -23,7 +23,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
vector< string > const & fileNames,
string const & indicesDir,
Dictionary::Initializing & )
THROW_SPEC( std::exception );
;
}

View file

@ -462,7 +462,7 @@ BtreeWordSearchRequest::~BtreeWordSearchRequest()
sptr< Dictionary::WordSearchRequest > BtreeDictionary::prefixMatch(
wstring const & str, unsigned long maxResults )
THROW_SPEC( std::exception )
{
return new BtreeWordSearchRequest( *this, str, 0, -1, true, maxResults );
}
@ -470,7 +470,7 @@ sptr< Dictionary::WordSearchRequest > BtreeDictionary::prefixMatch(
sptr< Dictionary::WordSearchRequest > BtreeDictionary::stemmedMatch(
wstring const & str, unsigned minLength, unsigned maxSuffixVariation,
unsigned long maxResults )
THROW_SPEC( std::exception )
{
return new BtreeWordSearchRequest( *this, str, minLength, (int)maxSuffixVariation,
false, maxResults );

View file

@ -167,13 +167,13 @@ public:
/// need not to implement this function.
virtual sptr< Dictionary::WordSearchRequest > prefixMatch( wstring const &,
unsigned long )
THROW_SPEC( std::exception );
;
virtual sptr< Dictionary::WordSearchRequest > stemmedMatch( wstring const &,
unsigned minLength,
unsigned maxSuffixVariation,
unsigned long maxResults )
THROW_SPEC( std::exception );
;
virtual bool isLocalDictionary()
{ return true; }

View file

@ -109,7 +109,7 @@ std::vector< gd::wstring > CharacterConversionDictionary::getAlternateWritings(
}
std::vector< sptr< Dictionary::Class > > makeDictionaries( Config::Chinese const & cfg )
THROW_SPEC( std::exception )
{
std::vector< sptr< Dictionary::Class > > result;

View file

@ -12,7 +12,7 @@
namespace Chinese {
std::vector< sptr< Dictionary::Class > > makeDictionaries( Config::Chinese const & )
THROW_SPEC( std::exception );
;
}

View file

@ -446,7 +446,7 @@ void saveMutedDictionaries( QDomDocument & dd, QDomElement & muted,
}
Class load() THROW_SPEC( exError )
Class load()
{
QString configName = getConfigFileName();
@ -1278,7 +1278,7 @@ void saveGroup( Group const & data, QDomElement & group )
}
void save( Class const & c ) THROW_SPEC( exError )
void save( Class const & c )
{
QFile configFile( getConfigFileName() + ".tmp" );
@ -2202,12 +2202,12 @@ QString getConfigFileName()
return getHomeDir().absoluteFilePath( "config" );
}
QString getConfigDir() THROW_SPEC( exError )
QString getConfigDir()
{
return getHomeDir().path() + QDir::separator();
}
QString getIndexDir() THROW_SPEC( exError )
QString getIndexDir()
{
QDir result = getHomeDir();
@ -2228,12 +2228,12 @@ QString getIndexDir() THROW_SPEC( exError )
return result.path() + QDir::separator();
}
QString getPidFileName() THROW_SPEC( exError )
QString getPidFileName()
{
return getHomeDir().filePath( "pid" );
}
QString getHistoryFileName() THROW_SPEC( exError )
QString getHistoryFileName()
{
QString homeHistoryPath = getHomeDir().filePath( "history" );
@ -2249,22 +2249,22 @@ QString getHistoryFileName() THROW_SPEC( exError )
return homeHistoryPath;
}
QString getFavoritiesFileName() THROW_SPEC( exError )
QString getFavoritiesFileName()
{
return getHomeDir().filePath( "favorites" );
}
QString getUserCssFileName() THROW_SPEC( exError )
QString getUserCssFileName()
{
return getHomeDir().filePath( "article-style.css" );
}
QString getUserCssPrintFileName() THROW_SPEC( exError )
QString getUserCssPrintFileName()
{
return getHomeDir().filePath( "article-style-print.css" );
}
QString getUserQtCssFileName() THROW_SPEC( exError )
QString getUserQtCssFileName()
{
return getHomeDir().filePath( "qt-style.css" );
}

View file

@ -763,38 +763,38 @@ DEF_EX( exCantWriteConfigFile, "Can't write the configuration file", exError )
DEF_EX( exMalformedConfigFile, "The configuration file is malformed", exError )
/// Loads the configuration, or creates the default one if none is present
Class load() THROW_SPEC( exError );
Class load() ;
/// Saves the configuration
void save( Class const & ) THROW_SPEC( exError );
void save( Class const & ) ;
/// Returns the configuration file name.
QString getConfigFileName();
/// Returns the main configuration directory.
QString getConfigDir() THROW_SPEC( exError );
QString getConfigDir() ;
/// Returns the index directory, where the indices are to be stored.
QString getIndexDir() THROW_SPEC( exError );
QString getIndexDir() ;
/// Returns the filename of a .pid file which should store current pid of
/// the process.
QString getPidFileName() THROW_SPEC( exError );
QString getPidFileName() ;
/// Returns the filename of a history file which stores search history.
QString getHistoryFileName() THROW_SPEC( exError );
QString getHistoryFileName() ;
/// Returns the filename of a favorities file.
QString getFavoritiesFileName() THROW_SPEC( exError );
QString getFavoritiesFileName() ;
/// Returns the user .css file name.
QString getUserCssFileName() THROW_SPEC( exError );
QString getUserCssFileName() ;
/// Returns the user .css file name used for printing only.
QString getUserCssPrintFileName() THROW_SPEC( exError );
QString getUserCssPrintFileName() ;
/// Returns the user .css file name for the Qt interface customization.
QString getUserQtCssFileName() THROW_SPEC( exError );
QString getUserQtCssFileName() ;
/// Returns the program's data dir. Under Linux that would be something like
/// /usr/share/apps/goldendict, under Windows C:/Program Files/GoldenDict.

View file

@ -1,10 +1,6 @@
#ifndef __CPP_HH_INCLUDED__
#define __CPP_HH_INCLUDED__
#if __cplusplus > 199711L
#define THROW_SPEC(...)
#else
#define THROW_SPEC(...) throw(__VA_ARGS__)
#endif
#endif // CPP_HH

View file

@ -124,7 +124,7 @@ public:
vector< wstring > const & alts,
wstring const &,
bool ignoreDiacritics )
THROW_SPEC( std::exception );
;
virtual QString const& getDescription();
@ -258,7 +258,7 @@ sptr< Dictionary::DataRequest > DictdDictionary::getArticle( wstring const & wor
vector< wstring > const & alts,
wstring const &,
bool ignoreDiacritics )
THROW_SPEC( std::exception )
{
try
{
@ -583,7 +583,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
vector< string > const & fileNames,
string const & indicesDir,
Dictionary::Initializing & initializing )
THROW_SPEC( std::exception )
{
vector< sptr< Dictionary::Class > > dictionaries;

View file

@ -16,7 +16,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
vector< string > const & fileNames,
string const & indicesDir,
Dictionary::Initializing & )
THROW_SPEC( std::exception );
;
}

View file

@ -73,7 +73,7 @@ size_t WordSearchRequest::matchesCount()
return matches.size();
}
WordMatch WordSearchRequest::operator [] ( size_t index ) THROW_SPEC( exIndexOutOfRange )
WordMatch WordSearchRequest::operator [] ( size_t index )
{
Mutex::Lock _( dataMutex );
@ -83,7 +83,7 @@ WordMatch WordSearchRequest::operator [] ( size_t index ) THROW_SPEC( exIndexOut
return matches[ index ];
}
vector< WordMatch > & WordSearchRequest::getAllMatches() THROW_SPEC( exRequestUnfinished )
vector< WordMatch > & WordSearchRequest::getAllMatches()
{
if ( !isFinished() )
throw exRequestUnfinished();
@ -112,7 +112,7 @@ long DataRequest::dataSize()
}
void DataRequest::getDataSlice( size_t offset, size_t size, void * buffer )
THROW_SPEC( exSliceOutOfRange )
{
if ( size == 0 )
return;
@ -125,7 +125,7 @@ void DataRequest::getDataSlice( size_t offset, size_t size, void * buffer )
memcpy( buffer, &data[ offset ], size );
}
vector< char > & DataRequest::getFullData() THROW_SPEC( exRequestUnfinished )
vector< char > & DataRequest::getFullData()
{
if ( !isFinished() )
throw exRequestUnfinished();
@ -147,13 +147,13 @@ sptr< WordSearchRequest > Class::stemmedMatch( wstring const & /*str*/,
unsigned /*minLength*/,
unsigned /*maxSuffixVariation*/,
unsigned long /*maxResults*/ )
THROW_SPEC( std::exception )
{
return new WordSearchRequestInstant();
}
sptr< WordSearchRequest > Class::findHeadwordsForSynonym( wstring const & )
THROW_SPEC( std::exception )
{
return new WordSearchRequestInstant();
}
@ -165,7 +165,7 @@ vector< wstring > Class::getAlternateWritings( wstring const & )
}
sptr< DataRequest > Class::getResource( string const & /*name*/ )
THROW_SPEC( std::exception )
{
return new DataRequestInstant( false );
}

View file

@ -144,11 +144,11 @@ public:
/// Returns the match with the given zero-based index, which should be less
/// than matchesCount().
WordMatch operator [] ( size_t index ) THROW_SPEC( exIndexOutOfRange );
WordMatch operator [] ( size_t index ) ;
/// Returns all the matches found. Since no further locking can or would be
/// done, this can only be called after the request has finished.
vector< WordMatch > & getAllMatches() THROW_SPEC( exRequestUnfinished );
vector< WordMatch > & getAllMatches() ;
/// Returns true if the match was uncertain -- that is, there may be more
/// results in the dictionary itself, the dictionary index isn't good enough
@ -188,11 +188,11 @@ public:
/// Writes "size" bytes starting from "offset" of the data read to the given
/// buffer. "size + offset" must be <= than dataSize().
void getDataSlice( size_t offset, size_t size, void * buffer )
THROW_SPEC( exSliceOutOfRange );
;
/// Returns all the data read. Since no further locking can or would be
/// done, this can only be called after the request has finished.
vector< char > & getFullData() THROW_SPEC( exRequestUnfinished );
vector< char > & getFullData() ;
DataRequest(): hasAnyData( false ) {}
@ -344,7 +344,7 @@ public:
/// be stored. The whole operation is supposed to be fast, though some
/// dictionaries, the network ones particularly, may of course be slow.
virtual sptr< WordSearchRequest > prefixMatch( wstring const &,
unsigned long maxResults ) THROW_SPEC( std::exception )=0;
unsigned long maxResults ) =0;
/// Looks up a given word in the dictionary, aiming to find different forms
/// of the given word by allowing suffix variations. This means allowing words
@ -357,14 +357,14 @@ public:
virtual sptr< WordSearchRequest > stemmedMatch( wstring const &,
unsigned minLength,
unsigned maxSuffixVariation,
unsigned long maxResults ) THROW_SPEC( std::exception );
unsigned long maxResults ) ;
/// Finds known headwords for the given word, that is, the words for which
/// the given word is a synonym. If a dictionary can't perform this operation,
/// it should leave the default implementation which always returns an empty
/// result.
virtual sptr< WordSearchRequest > findHeadwordsForSynonym( wstring const & )
THROW_SPEC( std::exception );
;
/// For a given word, provides alternate writings of it which are to be looked
/// up alongside with it. Transliteration dictionaries implement this. The
@ -385,14 +385,14 @@ public:
vector< wstring > const & alts,
wstring const & context = wstring(),
bool ignoreDiacritics = false )
THROW_SPEC( std::exception )=0;
=0;
/// Loads contents of a resource named 'name' into the 'data' vector. This is
/// usually a picture file referenced in the article or something like that.
/// The default implementation always returns the non-existing resource
/// response.
virtual sptr< DataRequest > getResource( string const & /*name*/ )
THROW_SPEC( std::exception );
;
/// Returns a results of full-text search of given string similar getArticle().
virtual sptr< DataRequest > getSearchResults( QString const & searchString,

View file

@ -222,11 +222,11 @@ public:
{ return 0; }
virtual sptr< WordSearchRequest > prefixMatch( wstring const &,
unsigned long maxResults ) THROW_SPEC( std::exception );
unsigned long maxResults ) ;
virtual sptr< DataRequest > getArticle( wstring const &, vector< wstring > const & alts,
wstring const &, bool )
THROW_SPEC( std::exception );
;
virtual quint32 getLangFrom() const
{ return langId; }
@ -918,7 +918,7 @@ void DictServerArticleRequest::cancel()
sptr< WordSearchRequest > DictServerDictionary::prefixMatch( wstring const & word,
unsigned long maxResults )
THROW_SPEC( std::exception )
{
(void) maxResults;
if ( word.size() > 80 )
@ -934,7 +934,7 @@ sptr< WordSearchRequest > DictServerDictionary::prefixMatch( wstring const & wor
sptr< DataRequest > DictServerDictionary::getArticle( wstring const & word,
vector< wstring > const &,
wstring const &, bool )
THROW_SPEC( std::exception )
{
if ( word.size() > 80 )
{
@ -949,7 +949,7 @@ sptr< DataRequest > DictServerDictionary::getArticle( wstring const & word,
} // Anonimuos namespace
vector< sptr< Dictionary::Class > > makeDictionaries( Config::DictServers const & servers )
THROW_SPEC( std::exception )
{
vector< sptr< Dictionary::Class > > result;

View file

@ -12,7 +12,7 @@ using std::string;
vector< sptr< Dictionary::Class > > makeDictionaries(
Config::DictServers const & servers )
THROW_SPEC( std::exception );
;
}

10
dsl.cc
View file

@ -217,10 +217,10 @@ public:
vector< wstring > const & alts,
wstring const &,
bool ignoreDiacritics )
THROW_SPEC( std::exception );
;
virtual sptr< Dictionary::DataRequest > getResource( string const & name )
THROW_SPEC( std::exception );
;
virtual sptr< Dictionary::DataRequest > getSearchResults( QString const & searchString,
int searchMode, bool matchCase,
@ -1797,7 +1797,7 @@ sptr< Dictionary::DataRequest > DslDictionary::getArticle( wstring const & word,
vector< wstring > const & alts,
wstring const &,
bool ignoreDiacritics )
THROW_SPEC( std::exception )
{
return new DslArticleRequest( word, alts, *this, ignoreDiacritics );
}
@ -1983,7 +1983,7 @@ void DslResourceRequest::run()
}
sptr< Dictionary::DataRequest > DslDictionary::getResource( string const & name )
THROW_SPEC( std::exception )
{
return new DslResourceRequest( *this, name );
}
@ -2008,7 +2008,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
string const & indicesDir,
Dictionary::Initializing & initializing,
int maxPictureWidth, unsigned int maxHeadwordSize )
THROW_SPEC( std::exception )
{
vector< sptr< Dictionary::Class > > dictionaries;

2
dsl.hh
View file

@ -17,7 +17,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
string const & indicesDir,
Dictionary::Initializing &,
int maxPictureWidth, unsigned int maxHeadwordSize )
THROW_SPEC( std::exception );
;
}

View file

@ -780,7 +780,7 @@ void ArticleDom::closeTag( wstring const & name,
}
}
void ArticleDom::nextChar() THROW_SPEC( eot )
void ArticleDom::nextChar()
{
if ( !*stringPos )
throw eot();
@ -825,7 +825,7 @@ bool ArticleDom::atSignFirstInLine()
/////////////// DslScanner
DslScanner::DslScanner( string const & fileName ) THROW_SPEC( Ex, Iconv::Ex ):
DslScanner::DslScanner( string const & fileName ) :
encoding( Utf8::Windows1252 ), readBufferPtr( readBuffer ),
readBufferLeft( 0 ), linesRead( 0 )
{
@ -995,8 +995,7 @@ DslScanner::~DslScanner() throw()
gzclose( f );
}
bool DslScanner::readNextLine( wstring & out, size_t & offset, bool only_head_word ) THROW_SPEC( Ex,
Iconv::Ex )
bool DslScanner::readNextLine( wstring & out, size_t & offset, bool only_head_word )
{
offset = (size_t)( gztell( f ) - readBufferLeft/*+pos*/ );
@ -1050,7 +1049,7 @@ bool DslScanner::readNextLine( wstring & out, size_t & offset, bool only_head_wo
}
bool DslScanner::readNextLineWithoutComments( wstring & out, size_t & offset , bool only_headword)
THROW_SPEC( Ex, Iconv::Ex )
{
wstring str;
bool commentToNextLine = false;

View file

@ -91,7 +91,7 @@ private:
unsigned transcriptionCount; // >0 = inside a [t] tag
unsigned mediaCount; // >0 = inside a [s] tag
void nextChar() THROW_SPEC( eot );
void nextChar() ;
/// Information for diagnostic purposes
string dictionaryName;
@ -125,7 +125,7 @@ public:
DEF_EX( exUnknownCodePage, "The .dsl file specified an unknown code page", Ex )
DEF_EX( exEncodingError, "Encoding error", Ex ) // Should never happen really
DslScanner( string const & fileName ) THROW_SPEC( Ex, Iconv::Ex );
DslScanner( string const & fileName ) ;
~DslScanner() throw();
/// Returns the detected encoding of this file.
@ -154,10 +154,10 @@ public:
/// If end of file is reached, false is returned.
/// Reading begins from the first line after the headers (ones which start
/// with #).
bool readNextLine( wstring &, size_t & offset, bool only_head_word = false ) THROW_SPEC( Ex, Iconv::Ex );
bool readNextLine( wstring &, size_t & offset, bool only_head_word = false ) ;
/// Similar readNextLine but strip all DSL comments {{...}}
bool readNextLineWithoutComments( wstring &, size_t & offset, bool only_headword = false ) THROW_SPEC( Ex, Iconv::Ex );
bool readNextLineWithoutComments( wstring &, size_t & offset, bool only_headword = false ) ;
/// Returns the number of lines read so far from the file.
unsigned getLinesRead() const

View file

@ -120,10 +120,10 @@ public:
vector< wstring > const & alts,
wstring const &,
bool ignoreDiacritics )
THROW_SPEC( std::exception );
;
virtual sptr< Dictionary::DataRequest > getResource( string const & name )
THROW_SPEC( std::exception );
;
virtual sptr< Dictionary::DataRequest > getSearchResults( QString const & searchString,
int searchMode, bool matchCase,
@ -153,13 +153,13 @@ public:
virtual sptr< Dictionary::WordSearchRequest > prefixMatch( wstring const &,
unsigned long )
THROW_SPEC( std::exception );
;
virtual sptr< Dictionary::WordSearchRequest > stemmedMatch( wstring const &,
unsigned minLength,
unsigned maxSuffixVariation,
unsigned long maxResults )
THROW_SPEC( std::exception );
;
protected:
@ -657,7 +657,7 @@ sptr< Dictionary::DataRequest > EpwingDictionary::getArticle( wstring const & wo
vector< wstring > const & alts,
wstring const &,
bool ignoreDiacritics )
THROW_SPEC( std::exception )
{
return new EpwingArticleRequest( word, alts, *this, ignoreDiacritics );
}
@ -785,7 +785,7 @@ void EpwingResourceRequest::run()
}
sptr< Dictionary::DataRequest > EpwingDictionary::getResource( string const & name )
THROW_SPEC( std::exception )
{
return new EpwingResourceRequest( *this, name );
}
@ -932,7 +932,7 @@ void EpwingWordSearchRequest::findMatches()
sptr< Dictionary::WordSearchRequest > EpwingDictionary::prefixMatch(
wstring const & str, unsigned long maxResults )
THROW_SPEC( std::exception )
{
return new EpwingWordSearchRequest( *this, str, 0, -1, true, maxResults );
}
@ -940,7 +940,7 @@ sptr< Dictionary::WordSearchRequest > EpwingDictionary::prefixMatch(
sptr< Dictionary::WordSearchRequest > EpwingDictionary::stemmedMatch(
wstring const & str, unsigned minLength, unsigned maxSuffixVariation,
unsigned long maxResults )
THROW_SPEC( std::exception )
{
return new EpwingWordSearchRequest( *this, str, minLength, (int)maxSuffixVariation,
false, maxResults );
@ -952,7 +952,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
vector< string > const & fileNames,
string const & indicesDir,
Dictionary::Initializing & initializing )
THROW_SPEC( std::exception )
{
vector< sptr< Dictionary::Class > > dictionaries;

View file

@ -13,7 +13,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
vector< string > const & fileNames,
string const & indicesDir,
Dictionary::Initializing & )
THROW_SPEC( std::exception );
;
}
#endif // __EPWING_HH__INCLUDED__

View file

@ -10,7 +10,7 @@
ExternalViewer::ExternalViewer( const char * data, int size,
QString const & extension, QString const & viewerCmdLine_,
QObject * parent)
THROW_SPEC( exCantCreateTempFile ):
:
QObject( parent ),
tempFile( QDir::temp().filePath( QString( "gd-XXXXXXXX." ) + extension ) ),
viewer( this ),
@ -31,7 +31,7 @@ ExternalViewer::ExternalViewer( const char * data, int size,
GD_DPRINTF( "%s\n", tempFile.fileName().toLocal8Bit().data() );
}
void ExternalViewer::start() THROW_SPEC( exCantRunViewer )
void ExternalViewer::start()
{
connect( &viewer, SIGNAL( finished( int, QProcess::ExitStatus ) ),
this, SLOT( deleteLater() ) );

View file

@ -29,11 +29,11 @@ public:
ExternalViewer( const char * data, int size,
QString const & extension, QString const & viewerCmdLine,
QObject * parent = 0 )
THROW_SPEC( exCantCreateTempFile );
;
// Once this is called, the object will be deleted when it's done, even if
// the function throws.
void start() THROW_SPEC( exCantRunViewer );
void start() ;
/// If the external process is running, requests its termination and returns
/// false - expect the QObject::destroyed() signal to be emitted soon.

38
file.cc
View file

@ -88,7 +88,7 @@ bool exists( char const * filename ) throw()
#endif
}
void Class::open( char const * filename, char const * mode ) THROW_SPEC( exCantOpen )
void Class::open( char const * filename, char const * mode )
{
QFile::OpenMode openMode = QIODevice::Text;
const char * pch = mode;
@ -118,19 +118,19 @@ void Class::open( char const * filename, char const * mode ) THROW_SPEC( exCantO
throw exCantOpen( std::string( filename ) + ": " + f.errorString().toUtf8().data() );
}
Class::Class( char const * filename, char const * mode ) THROW_SPEC( exCantOpen ):
Class::Class( char const * filename, char const * mode ) :
writeBuffer( 0 )
{
open( filename, mode );
}
Class::Class( std::string const & filename, char const * mode )
THROW_SPEC( exCantOpen ): writeBuffer( 0 )
: writeBuffer( 0 )
{
open( filename.c_str(), mode );
}
void Class::read( void * buf, qint64 size ) THROW_SPEC( exReadError, exWriteError )
void Class::read( void * buf, qint64 size )
{
if ( !size )
return;
@ -144,7 +144,7 @@ void Class::read( void * buf, qint64 size ) THROW_SPEC( exReadError, exWriteErro
throw exReadError();
}
size_t Class::readRecords( void * buf, qint64 size, size_t count ) THROW_SPEC( exWriteError )
size_t Class::readRecords( void * buf, qint64 size, size_t count )
{
if ( writeBuffer )
flushWriteBuffer();
@ -153,7 +153,7 @@ size_t Class::readRecords( void * buf, qint64 size, size_t count ) THROW_SPEC( e
return result < 0 ? result : result / size;
}
void Class::write( void const * buf, qint64 size ) THROW_SPEC( exWriteError, exAllocation )
void Class::write( void const * buf, qint64 size )
{
if ( !size )
return;
@ -201,7 +201,7 @@ void Class::write( void const * buf, qint64 size ) THROW_SPEC( exWriteError, exA
}
size_t Class::writeRecords( void const * buf, qint64 size, size_t count )
THROW_SPEC( exWriteError )
{
flushWriteBuffer();
@ -210,7 +210,7 @@ size_t Class::writeRecords( void const * buf, qint64 size, size_t count )
}
char * Class::gets( char * s, int size, bool stripNl )
THROW_SPEC( exWriteError )
{
if ( writeBuffer )
flushWriteBuffer();
@ -237,7 +237,7 @@ char * Class::gets( char * s, int size, bool stripNl )
return result;
}
std::string Class::gets( bool stripNl ) THROW_SPEC( exReadError, exWriteError )
std::string Class::gets( bool stripNl )
{
char buf[ 1024 ];
@ -247,7 +247,7 @@ std::string Class::gets( bool stripNl ) THROW_SPEC( exReadError, exWriteError )
return std::string( buf );
}
void Class::seek( qint64 offset ) THROW_SPEC( exSeekError, exWriteError )
void Class::seek( qint64 offset )
{
if ( writeBuffer )
flushWriteBuffer();
@ -256,7 +256,7 @@ void Class::seek( qint64 offset ) THROW_SPEC( exSeekError, exWriteError )
throw exSeekError();
}
void Class::seekCur( qint64 offset ) THROW_SPEC( exSeekError, exWriteError )
void Class::seekCur( qint64 offset )
{
if ( writeBuffer )
flushWriteBuffer();
@ -265,7 +265,7 @@ void Class::seekCur( qint64 offset ) THROW_SPEC( exSeekError, exWriteError )
throw exSeekError();
}
void Class::seekEnd( qint64 offset ) THROW_SPEC( exSeekError, exWriteError )
void Class::seekEnd( qint64 offset )
{
if ( writeBuffer )
flushWriteBuffer();
@ -274,12 +274,12 @@ void Class::seekEnd( qint64 offset ) THROW_SPEC( exSeekError, exWriteError )
throw exSeekError();
}
void Class::rewind() THROW_SPEC( exSeekError, exWriteError )
void Class::rewind()
{
seek( 0 );
}
qint64 Class::tell() THROW_SPEC( exSeekError )
qint64 Class::tell()
{
qint64 result = f.pos();
@ -292,7 +292,7 @@ qint64 Class::tell() THROW_SPEC( exSeekError )
return result;
}
bool Class::eof() THROW_SPEC( exWriteError )
bool Class::eof()
{
if ( writeBuffer )
flushWriteBuffer();
@ -300,14 +300,14 @@ bool Class::eof() THROW_SPEC( exWriteError )
return f.atEnd();
}
QFile & Class::file() THROW_SPEC( exWriteError )
QFile & Class::file()
{
flushWriteBuffer();
return f;
}
void Class::close() THROW_SPEC( exWriteError )
void Class::close()
{
releaseWriteBuffer();
f.close();
@ -328,7 +328,7 @@ Class::~Class() throw()
}
}
void Class::flushWriteBuffer() THROW_SPEC( exWriteError )
void Class::flushWriteBuffer()
{
if ( writeBuffer && writeBufferLeft != WriteBufferSize )
{
@ -341,7 +341,7 @@ void Class::flushWriteBuffer() THROW_SPEC( exWriteError )
}
}
void Class::releaseWriteBuffer() THROW_SPEC( exWriteError )
void Class::releaseWriteBuffer()
{
flushWriteBuffer();

44
file.hh
View file

@ -42,29 +42,29 @@ class Class
char * writeBuffer;
qint64 writeBufferLeft;
void open( char const * filename, char const * mode ) THROW_SPEC( exCantOpen );
void open( char const * filename, char const * mode ) ;
public:
Class( char const * filename, char const * mode ) THROW_SPEC( exCantOpen );
Class( char const * filename, char const * mode ) ;
Class( std::string const & filename, char const * mode ) THROW_SPEC( exCantOpen );
Class( std::string const & filename, char const * mode ) ;
/// Reads the number of bytes to the buffer, throws an error if it
/// failed to fill the whole buffer (short read, i/o error etc).
void read( void * buf, qint64 size ) THROW_SPEC( exReadError, exWriteError );
void read( void * buf, qint64 size ) ;
template< typename T >
void read( T & value ) THROW_SPEC( exReadError, exWriteError )
void read( T & value )
{ read( &value, sizeof( value ) ); }
template< typename T >
T read() THROW_SPEC( exReadError, exWriteError )
T read()
{ T value; read( value ); return value; }
/// Attempts reading at most 'count' records sized 'size'. Returns
/// the number of records it managed to read, up to 'count'.
size_t readRecords( void * buf, qint64 size, size_t count ) THROW_SPEC( exWriteError );
size_t readRecords( void * buf, qint64 size, size_t count ) ;
/// Writes the number of bytes from the buffer, throws an error if it
/// failed to write the whole buffer (short write, i/o error etc).
@ -72,10 +72,10 @@ public:
/// end up on disk immediately, or a short write may occur later
/// than it really did. If you don't want write buffering, use
/// writeRecords() function instead.
void write( void const * buf, qint64 size ) THROW_SPEC( exWriteError, exAllocation );
void write( void const * buf, qint64 size ) ;
template< typename T >
void write( T const & value ) THROW_SPEC( exWriteError )
void write( T const & value )
{ write( &value, sizeof( value ) ); }
/// Attempts writing at most 'count' records sized 'size'. Returns
@ -83,46 +83,46 @@ public:
/// This function does not employ buffering, but flushes the buffer if it
/// was used before.
size_t writeRecords( void const * buf, qint64 size, size_t count )
THROW_SPEC( exWriteError );
;
/// Reads a string from the file. Unlike the normal fgets(), this one
/// can strip the trailing newline character, if this was requested.
/// Returns either s or 0 if no characters were read.
char * gets( char * s, int size, bool stripNl = false ) THROW_SPEC( exWriteError );
char * gets( char * s, int size, bool stripNl = false ) ;
/// Like the above, but uses its own local internal buffer (1024 bytes
/// currently), and strips newlines by default.
std::string gets( bool stripNl = true ) THROW_SPEC( exReadError, exWriteError );
std::string gets( bool stripNl = true ) ;
/// Seeks in the file, relative to its beginning.
void seek( qint64 offset ) THROW_SPEC( exSeekError, exWriteError );
void seek( qint64 offset ) ;
/// Seeks in the file, relative to the current position.
void seekCur( qint64 offset ) THROW_SPEC( exSeekError, exWriteError );
void seekCur( qint64 offset ) ;
/// Seeks in the file, relative to the end of file.
void seekEnd( qint64 offset = 0 ) THROW_SPEC( exSeekError, exWriteError );
void seekEnd( qint64 offset = 0 ) ;
/// Seeks to the beginning of file
void rewind() THROW_SPEC( exSeekError, exWriteError );
void rewind() ;
/// Tells the current position within the file, relative to its beginning.
qint64 tell() THROW_SPEC( exSeekError );
qint64 tell() ;
/// Returns true if end-of-file condition is set.
bool eof() THROW_SPEC( exWriteError );
bool eof() ;
/// Returns the underlying FILE * record, so other operations can be
/// performed on it.
QFile & file() THROW_SPEC( exWriteError );
QFile & file() ;
/// Closes the file. No further operations are valid.
void close() THROW_SPEC( exWriteError );
void close() ;
~Class() throw();
private:
void flushWriteBuffer() THROW_SPEC( exWriteError );
void releaseWriteBuffer() THROW_SPEC( exWriteError );
void flushWriteBuffer() ;
void releaseWriteBuffer() ;
};
}

View file

@ -55,7 +55,7 @@ public:
{ return 0; }
virtual sptr< WordSearchRequest > prefixMatch( wstring const & /*word*/,
unsigned long /*maxResults*/ ) THROW_SPEC( std::exception )
unsigned long /*maxResults*/ )
{
sptr< WordSearchRequestInstant > sr = new WordSearchRequestInstant;
@ -66,7 +66,7 @@ public:
virtual sptr< DataRequest > getArticle( wstring const &, vector< wstring > const & alts,
wstring const &, bool )
THROW_SPEC( std::exception );
;
protected:
@ -77,7 +77,7 @@ protected:
sptr< DataRequest > ForvoDictionary::getArticle( wstring const & word,
vector< wstring > const & alts,
wstring const &, bool )
THROW_SPEC( std::exception )
{
if ( word.size() > 80 )
{
@ -347,7 +347,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
Dictionary::Initializing &,
Config::Forvo const & forvo,
QNetworkAccessManager & mgr )
THROW_SPEC( std::exception )
{
vector< sptr< Dictionary::Class > > result;

View file

@ -21,7 +21,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
Dictionary::Initializing &,
Config::Forvo const &,
QNetworkAccessManager & )
THROW_SPEC( std::exception );
;
/// Exposed here for moc
class ForvoArticleRequest: public Dictionary::DataRequest

View file

@ -40,7 +40,7 @@ GermanTable::GermanTable()
}
sptr< Dictionary::Class > makeDictionary() THROW_SPEC( std::exception )
sptr< Dictionary::Class > makeDictionary()
{
static GermanTable t;

View file

@ -9,7 +9,7 @@
// Support for German transliteration
namespace GermanTranslit {
sptr< Dictionary::Class > makeDictionary() THROW_SPEC( std::exception );
sptr< Dictionary::Class > makeDictionary() ;
}

23
gls.cc
View file

@ -83,7 +83,7 @@ public:
DEF_EX_STR( exMalformedGlsFile, "The .gls file is malformed:", Ex )
DEF_EX( exEncodingError, "Encoding error", Ex ) // Should never happen really
GlsScanner( string const & fileName ) THROW_SPEC( Ex, Iconv::Ex );
GlsScanner( string const & fileName ) ;
~GlsScanner() throw();
/// Returns the detected encoding of this file.
@ -116,13 +116,13 @@ public:
/// If end of file is reached, false is returned.
/// Reading begins from the first line after the headers (ones which end
/// by the "### Glossary section:" line).
bool readNextLine( wstring &, size_t & offset ) THROW_SPEC( Ex, Iconv::Ex );
bool readNextLine( wstring &, size_t & offset ) ;
/// Returns the number of lines read so far from the file.
unsigned getLinesRead() const
{ return linesRead; }
};
GlsScanner::GlsScanner( string const & fileName ) THROW_SPEC( Ex, Iconv::Ex ):
GlsScanner::GlsScanner( string const & fileName ) :
encoding( Utf8::Utf8 ), readBufferPtr( readBuffer ),
readBufferLeft( 0 ), linesRead( 0 )
{
@ -242,8 +242,7 @@ GlsScanner::GlsScanner( string const & fileName ) THROW_SPEC( Ex, Iconv::Ex ):
}
}
bool GlsScanner::readNextLine( wstring & out, size_t & offset ) THROW_SPEC( Ex,
Iconv::Ex )
bool GlsScanner::readNextLine( wstring & out, size_t & offset )
{
offset = (size_t)(gztell(f) - readBufferLeft);
@ -393,16 +392,16 @@ public:
{ return idxHeader.langTo; }
virtual sptr< Dictionary::WordSearchRequest > findHeadwordsForSynonym( wstring const & )
THROW_SPEC( std::exception );
;
virtual sptr< Dictionary::DataRequest > getArticle( wstring const &,
vector< wstring > const & alts,
wstring const &,
bool ignoreDiacritics )
THROW_SPEC( std::exception );
;
virtual sptr< Dictionary::DataRequest > getResource( string const & name )
THROW_SPEC( std::exception );
;
virtual QString const& getDescription();
@ -979,7 +978,7 @@ void GlsHeadwordsRequest::run()
sptr< Dictionary::WordSearchRequest >
GlsDictionary::findHeadwordsForSynonym( wstring const & word )
THROW_SPEC( std::exception )
{
return synonymSearchEnabled ? new GlsHeadwordsRequest( word, *this ) :
Class::findHeadwordsForSynonym( word );
@ -1161,7 +1160,7 @@ sptr< Dictionary::DataRequest > GlsDictionary::getArticle( wstring const & word,
vector< wstring > const & alts,
wstring const &,
bool ignoreDiacritics )
THROW_SPEC( std::exception )
{
return new GlsArticleRequest( word, alts, *this, ignoreDiacritics );
}
@ -1380,7 +1379,7 @@ void GlsResourceRequest::run()
}
sptr< Dictionary::DataRequest > GlsDictionary::getResource( string const & name )
THROW_SPEC( std::exception )
{
return new GlsResourceRequest( *this, name );
}
@ -1403,7 +1402,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
vector< string > const & fileNames,
string const & indicesDir,
Dictionary::Initializing & initializing )
THROW_SPEC( std::exception )
{
vector< sptr< Dictionary::Class > > dictionaries;

2
gls.hh
View file

@ -13,7 +13,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
vector< string > const & fileNames,
string const & indicesDir,
Dictionary::Initializing & )
THROW_SPEC( std::exception );
;
}

View file

@ -831,7 +831,7 @@ GreekTable::GreekTable()
}
sptr< Dictionary::Class > makeDictionary() THROW_SPEC( std::exception )
sptr< Dictionary::Class > makeDictionary()
{
static GreekTable t;

View file

@ -9,7 +9,7 @@
// Support for Greek transliteration
namespace GreekTranslit {
sptr< Dictionary::Class > makeDictionary() THROW_SPEC( std::exception );
sptr< Dictionary::Class > makeDictionary() ;
}

View file

@ -73,16 +73,16 @@ public:
virtual sptr< WordSearchRequest > prefixMatch( wstring const &,
unsigned long maxResults )
THROW_SPEC( std::exception );
;
virtual sptr< WordSearchRequest > findHeadwordsForSynonym( wstring const & )
THROW_SPEC( std::exception );
;
virtual sptr< DataRequest > getArticle( wstring const &,
vector< wstring > const & alts,
wstring const &,
bool )
THROW_SPEC( std::exception );
;
virtual bool isLocalDictionary()
{ return true; }
@ -329,7 +329,7 @@ void HunspellArticleRequest::run()
sptr< DataRequest > HunspellDictionary::getArticle( wstring const & word,
vector< wstring > const &,
wstring const &, bool )
THROW_SPEC( std::exception )
{
return new HunspellArticleRequest( word, getHunspellMutex(), hunspell );
}
@ -503,7 +503,7 @@ QVector< wstring > suggest( wstring & word, Mutex & hunspellMutex, Hunspell & hu
sptr< WordSearchRequest > HunspellDictionary::findHeadwordsForSynonym( wstring const & word )
THROW_SPEC( std::exception )
{
return new HunspellHeadwordsRequest( word, getHunspellMutex(), hunspell );
}
@ -618,7 +618,7 @@ void HunspellPrefixMatchRequest::run()
sptr< WordSearchRequest > HunspellDictionary::prefixMatch( wstring const & word,
unsigned long /*maxResults*/ )
THROW_SPEC( std::exception )
{
return new HunspellPrefixMatchRequest( word, getHunspellMutex(), hunspell );
}
@ -761,7 +761,7 @@ wstring decodeFromHunspell( Hunspell & hunspell, char const * str )
}
vector< sptr< Dictionary::Class > > makeDictionaries( Config::Hunspell const & cfg )
THROW_SPEC( std::exception )
{
vector< sptr< Dictionary::Class > > result;

View file

@ -34,7 +34,7 @@ struct DataFiles
vector< DataFiles > findDataFiles( QString const & path );
vector< sptr< Dictionary::Class > > makeDictionaries( Config::Hunspell const & )
THROW_SPEC( std::exception );
;
}

View file

@ -18,14 +18,14 @@ char const * const Iconv::Utf8 = "UTF-8";
using gd::wchar;
Iconv::Iconv( char const * to, char const * from ) THROW_SPEC( exCantInit ):
Iconv::Iconv( char const * to, char const * from ) :
state( iconv_open( to, from ) )
{
if ( state == (iconv_t) -1 )
throw exCantInit( strerror( errno ) );
}
void Iconv::reinit( char const * to, char const * from ) THROW_SPEC( exCantInit )
void Iconv::reinit( char const * to, char const * from )
{
iconv_close( state );
@ -42,7 +42,7 @@ Iconv::~Iconv() throw()
Iconv::Result Iconv::convert( void const * & inBuf, size_t & inBytesLeft,
void * & outBuf, size_t & outBytesLeft )
THROW_SPEC( exIncorrectSeq, exOther )
{
size_t result = iconv( state,
// #ifdef __WIN32
@ -73,7 +73,7 @@ Iconv::Result Iconv::convert( void const * & inBuf, size_t & inBytesLeft,
gd::wstring Iconv::toWstring( char const * fromEncoding, void const * fromData,
size_t dataSize )
THROW_SPEC( exCantInit, exIncorrectSeq, exPrematureEnd, exOther )
{
/// Special-case the dataSize == 0 to avoid any kind of iconv-specific
/// behaviour in that regard.
@ -114,7 +114,7 @@ gd::wstring Iconv::toWstring( char const * fromEncoding, void const * fromData,
std::string Iconv::toUtf8( char const * fromEncoding, void const * fromData,
size_t dataSize )
THROW_SPEC( exCantInit, exIncorrectSeq, exPrematureEnd, exOther )
{
// Similar to toWstring

View file

@ -28,10 +28,10 @@ public:
static char const * const Utf16Le;
static char const * const Utf8;
Iconv( char const * to, char const * from ) THROW_SPEC( exCantInit );
Iconv( char const * to, char const * from ) ;
// Changes to another pair of encodings. All the internal state is reset.
void reinit( char const * to, char const * from ) THROW_SPEC( exCantInit );
void reinit( char const * to, char const * from ) ;
~Iconv() throw();
@ -43,19 +43,18 @@ public:
};
Result convert( void const * & inBuf, size_t & inBytesLeft,
void * & outBuf, size_t & outBytesLeft ) THROW_SPEC( exIncorrectSeq,
exOther );
void * & outBuf, size_t & outBytesLeft );
// Converts a given block of data from the given encoding to a wide string.
static gd::wstring toWstring( char const * fromEncoding, void const * fromData,
size_t dataSize )
THROW_SPEC( exCantInit, exIncorrectSeq, exPrematureEnd, exOther );
;
// Converts a given block of data from the given encoding to an utf8-encoded
// string.
static std::string toUtf8( char const * fromEncoding, void const * fromData,
size_t dataSize )
THROW_SPEC( exCantInit, exIncorrectSeq, exPrematureEnd, exOther );
;
private:

10
lsa.cc
View file

@ -179,10 +179,10 @@ public:
vector< wstring > const & alts,
wstring const &,
bool ignoreDiacritics )
THROW_SPEC( std::exception );
;
virtual sptr< Dictionary::DataRequest > getResource( string const & name )
THROW_SPEC( std::exception );
;
protected:
@ -217,7 +217,7 @@ sptr< Dictionary::DataRequest > LsaDictionary::getArticle( wstring const & word,
vector< wstring > const & alts,
wstring const &,
bool ignoreDiacritics )
THROW_SPEC( std::exception )
{
vector< WordArticleLink > chain = findArticles( word, ignoreDiacritics );
@ -399,7 +399,7 @@ __attribute__((packed))
;
sptr< Dictionary::DataRequest > LsaDictionary::getResource( string const & name )
THROW_SPEC( std::exception )
{
// See if the name ends in .wav. Remove that extension then
@ -524,7 +524,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
vector< string > const & fileNames,
string const & indicesDir,
Dictionary::Initializing & initializing )
THROW_SPEC( std::exception )
{
vector< sptr< Dictionary::Class > > dictionaries;

2
lsa.hh
View file

@ -16,7 +16,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
vector< string > const & fileNames,
string const & indicesDir,
Dictionary::Initializing & )
THROW_SPEC( std::exception );
;
}

10
mdx.cc
View file

@ -252,8 +252,8 @@ public:
virtual sptr< Dictionary::DataRequest > getArticle( wstring const & word,
vector< wstring > const & alts,
wstring const &,
bool ignoreDiacritics ) THROW_SPEC( std::exception );
virtual sptr< Dictionary::DataRequest > getResource( string const & name ) THROW_SPEC( std::exception );
bool ignoreDiacritics ) ;
virtual sptr< Dictionary::DataRequest > getResource( string const & name ) ;
virtual QString const & getDescription();
virtual sptr< Dictionary::DataRequest > getSearchResults( QString const & searchString,
@ -725,7 +725,7 @@ void MdxArticleRequest::run()
}
sptr<Dictionary::DataRequest> MdxDictionary::getArticle( const wstring & word, const vector<wstring> & alts,
const wstring &, bool ignoreDiacritics ) THROW_SPEC( std::exception )
const wstring &, bool ignoreDiacritics )
{
return new MdxArticleRequest( word, alts, *this, ignoreDiacritics );
}
@ -931,7 +931,7 @@ void MddResourceRequest::run()
finish();
}
sptr<Dictionary::DataRequest> MdxDictionary::getResource( const string & name ) THROW_SPEC( std::exception )
sptr<Dictionary::DataRequest> MdxDictionary::getResource( const string & name )
{
return new MddResourceRequest( *this, name );
}
@ -1443,7 +1443,7 @@ static void findResourceFiles( string const & mdx, vector< string > & dictFiles
vector< sptr< Dictionary::Class > > makeDictionaries( vector< string > const & fileNames,
string const & indicesDir,
Dictionary::Initializing & initializing ) THROW_SPEC( std::exception )
Dictionary::Initializing & initializing )
{
vector< sptr< Dictionary::Class > > dictionaries;

2
mdx.hh
View file

@ -14,7 +14,7 @@ using std::string;
vector< sptr< Dictionary::Class > > makeDictionaries( vector< string > const & fileNames,
string const & indicesDir,
Dictionary::Initializing & ) THROW_SPEC( std::exception );
Dictionary::Initializing & ) ;
}

View file

@ -60,11 +60,11 @@ public:
{ return 0; }
virtual sptr< WordSearchRequest > prefixMatch( wstring const &,
unsigned long maxResults ) THROW_SPEC( std::exception );
unsigned long maxResults ) ;
virtual sptr< DataRequest > getArticle( wstring const &, vector< wstring > const & alts,
wstring const &, bool )
THROW_SPEC( std::exception );
;
virtual quint32 getLangFrom() const
{ return langId; }
@ -545,7 +545,7 @@ void MediaWikiArticleRequest::requestFinished( QNetworkReply * r )
sptr< WordSearchRequest > MediaWikiDictionary::prefixMatch( wstring const & word,
unsigned long maxResults )
THROW_SPEC( std::exception )
{
(void) maxResults;
if ( word.size() > 80 )
@ -561,7 +561,7 @@ sptr< WordSearchRequest > MediaWikiDictionary::prefixMatch( wstring const & word
sptr< DataRequest > MediaWikiDictionary::getArticle( wstring const & word,
vector< wstring > const & alts,
wstring const &, bool )
THROW_SPEC( std::exception )
{
if ( word.size() > 80 )
{
@ -579,7 +579,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
Dictionary::Initializing &,
Config::MediaWikis const & wikis,
QNetworkAccessManager & mgr )
THROW_SPEC( std::exception )
{
vector< sptr< Dictionary::Class > > result;

View file

@ -18,7 +18,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
Dictionary::Initializing &,
Config::MediaWikis const & wikis,
QNetworkAccessManager & )
THROW_SPEC( std::exception );
;
/// Exposed here for moc
class MediaWikiWordSearchRequestSlots: public Dictionary::WordSearchRequest

View file

@ -44,12 +44,12 @@ public:
virtual sptr< WordSearchRequest > prefixMatch( wstring const & word,
unsigned long maxResults )
THROW_SPEC( std::exception );
;
virtual sptr< DataRequest > getArticle( wstring const &,
vector< wstring > const & alts,
wstring const &, bool )
THROW_SPEC( std::exception );
;
protected:
@ -58,7 +58,7 @@ protected:
sptr< WordSearchRequest > ProgramsDictionary::prefixMatch( wstring const & word,
unsigned long /*maxResults*/ )
THROW_SPEC( std::exception )
{
if ( prg.type == Config::Program::PrefixMatch )
return new ProgramWordSearchRequest( gd::toQString( word ), prg );
@ -74,7 +74,7 @@ sptr< WordSearchRequest > ProgramsDictionary::prefixMatch( wstring const & word,
sptr< Dictionary::DataRequest > ProgramsDictionary::getArticle(
wstring const & word, vector< wstring > const &, wstring const &, bool )
THROW_SPEC( std::exception )
{
switch( prg.type )
{
@ -372,7 +372,7 @@ void ProgramWordSearchRequest::cancel()
vector< sptr< Dictionary::Class > > makeDictionaries(
Config::Programs const & programs )
THROW_SPEC( std::exception )
{
vector< sptr< Dictionary::Class > > result;

View file

@ -17,7 +17,7 @@ using std::string;
using gd::wstring;
vector< sptr< Dictionary::Class > > makeDictionaries( Config::Programs const & )
THROW_SPEC( std::exception );
;
class RunInstance: public QObject
{

View file

@ -92,7 +92,7 @@ HepburnKatakana::HepburnKatakana()
}
vector< sptr< Dictionary::Class > > makeDictionaries( Config::Romaji const & r )
THROW_SPEC( std::exception )
{
vector< sptr< Dictionary::Class > > result;

View file

@ -13,7 +13,7 @@ namespace Romaji {
using std::vector;
vector< sptr< Dictionary::Class > > makeDictionaries( Config::Romaji const & )
THROW_SPEC( std::exception );
;
}

View file

@ -99,7 +99,7 @@ RussianTable::RussianTable()
ins( "Ya", "Я" );
}
sptr< Dictionary::Class > makeDictionary() THROW_SPEC( std::exception )
sptr< Dictionary::Class > makeDictionary()
{
static RussianTable t;

View file

@ -9,7 +9,7 @@
// Support for Russian transliteration
namespace RussianTranslit {
sptr< Dictionary::Class > makeDictionary() THROW_SPEC( std::exception );
sptr< Dictionary::Class > makeDictionary() ;
}

View file

@ -163,7 +163,7 @@ class SdictDictionary: public BtreeIndexing::BtreeDictionary
vector< wstring > const & alts,
wstring const &,
bool ignoreDiacritics )
THROW_SPEC( std::exception );
;
virtual QString const & getDescription();
@ -663,7 +663,7 @@ sptr< Dictionary::DataRequest > SdictDictionary::getArticle( wstring const & wor
vector< wstring > const & alts,
wstring const &,
bool ignoreDiacritics )
THROW_SPEC( std::exception )
{
return new SdictArticleRequest( word, alts, *this, ignoreDiacritics );
}
@ -742,7 +742,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
vector< string > const & fileNames,
string const & indicesDir,
Dictionary::Initializing & initializing )
THROW_SPEC( std::exception )
{
vector< sptr< Dictionary::Class > > dictionaries;

View file

@ -16,7 +16,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
vector< string > const & fileNames,
string const & indicesDir,
Dictionary::Initializing & )
THROW_SPEC( std::exception );
;
}

10
slob.cc
View file

@ -606,10 +606,10 @@ class SlobDictionary: public BtreeIndexing::BtreeDictionary
vector< wstring > const & alts,
wstring const &,
bool ignoreDiacritics )
THROW_SPEC( std::exception );
;
virtual sptr< Dictionary::DataRequest > getResource( string const & name )
THROW_SPEC( std::exception );
;
virtual QString const& getDescription();
@ -1485,7 +1485,7 @@ sptr< Dictionary::DataRequest > SlobDictionary::getArticle( wstring const & word
vector< wstring > const & alts,
wstring const &,
bool ignoreDiacritics )
THROW_SPEC( std::exception )
{
return new SlobArticleRequest( word, alts, *this, ignoreDiacritics );
}
@ -1634,7 +1634,7 @@ void SlobResourceRequest::run()
}
sptr< Dictionary::DataRequest > SlobDictionary::getResource( string const & name )
THROW_SPEC( std::exception )
{
return new SlobResourceRequest( *this, name );
}
@ -1645,7 +1645,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
string const & indicesDir,
Dictionary::Initializing & initializing,
unsigned maxHeadwordsToExpand )
THROW_SPEC( std::exception )
{
vector< sptr< Dictionary::Class > > dictionaries;

View file

@ -16,7 +16,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
string const & indicesDir,
Dictionary::Initializing &,
unsigned maxHeadwordsToExpand )
THROW_SPEC( std::exception );
;
}

View file

@ -95,10 +95,10 @@ public:
vector< wstring > const & alts,
wstring const &,
bool ignoreDiacritics )
THROW_SPEC( std::exception );
;
virtual sptr< Dictionary::DataRequest > getResource( string const & name )
THROW_SPEC( std::exception );
;
protected:
@ -128,7 +128,7 @@ sptr< Dictionary::DataRequest > SoundDirDictionary::getArticle( wstring const &
vector< wstring > const & alts,
wstring const &,
bool ignoreDiacritics )
THROW_SPEC( std::exception )
{
vector< WordArticleLink > chain = findArticles( word, ignoreDiacritics );
@ -306,7 +306,7 @@ void SoundDirDictionary::loadIcon() throw()
}
sptr< Dictionary::DataRequest > SoundDirDictionary::getResource( string const & name )
THROW_SPEC( std::exception )
{
bool isNumber = false;
@ -408,7 +408,7 @@ void addDir( QDir const & baseDir, QDir const & dir, IndexedWords & indexedWords
vector< sptr< Dictionary::Class > > makeDictionaries( Config::SoundDirs const & soundDirs,
string const & indicesDir,
Dictionary::Initializing & initializing )
THROW_SPEC( std::exception )
{
vector< sptr< Dictionary::Class > > dictionaries;

View file

@ -16,7 +16,7 @@ using std::string;
vector< sptr< Dictionary::Class > > makeDictionaries( Config::SoundDirs const &,
string const & indicesDir,
Dictionary::Initializing & )
THROW_SPEC( std::exception );
;
}

View file

@ -170,16 +170,16 @@ public:
{ return idxHeader.langTo; }
virtual sptr< Dictionary::WordSearchRequest > findHeadwordsForSynonym( wstring const & )
THROW_SPEC( std::exception );
;
virtual sptr< Dictionary::DataRequest > getArticle( wstring const &,
vector< wstring > const & alts,
wstring const &,
bool ignoreDiacritics )
THROW_SPEC( std::exception );
;
virtual sptr< Dictionary::DataRequest > getResource( string const & name )
THROW_SPEC( std::exception );
;
virtual QString const& getDescription();
@ -1310,7 +1310,7 @@ void StardictHeadwordsRequest::run()
sptr< Dictionary::WordSearchRequest >
StardictDictionary::findHeadwordsForSynonym( wstring const & word )
THROW_SPEC( std::exception )
{
return synonymSearchEnabled ? new StardictHeadwordsRequest( word, *this ) :
Class::findHeadwordsForSynonym( word );
@ -1514,7 +1514,7 @@ sptr< Dictionary::DataRequest > StardictDictionary::getArticle( wstring const &
vector< wstring > const & alts,
wstring const &,
bool ignoreDiacritics )
THROW_SPEC( std::exception )
{
return new StardictArticleRequest( word, alts, *this, ignoreDiacritics );
}
@ -1821,7 +1821,7 @@ void StardictResourceRequest::run()
}
sptr< Dictionary::DataRequest > StardictDictionary::getResource( string const & name )
THROW_SPEC( std::exception )
{
return new StardictResourceRequest( *this, name );
}
@ -2004,7 +2004,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
string const & indicesDir,
Dictionary::Initializing & initializing,
unsigned maxHeadwordsToExpand )
THROW_SPEC( std::exception )
{
vector< sptr< Dictionary::Class > > dictionaries;

View file

@ -17,7 +17,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
string const & indicesDir,
Dictionary::Initializing &,
unsigned maxHeadwordsToExpand )
THROW_SPEC( std::exception );
;
}

View file

@ -35,17 +35,17 @@ unsigned long BaseTransliterationDictionary::getWordCount() throw()
{ return 0; }
sptr< Dictionary::WordSearchRequest > BaseTransliterationDictionary::prefixMatch( wstring const &,
unsigned long ) THROW_SPEC( std::exception )
unsigned long )
{ return new Dictionary::WordSearchRequestInstant(); }
sptr< Dictionary::DataRequest > BaseTransliterationDictionary::getArticle( wstring const &,
vector< wstring > const &,
wstring const &, bool )
THROW_SPEC( std::exception )
{ return new Dictionary::DataRequestInstant( false ); }
sptr< Dictionary::WordSearchRequest > BaseTransliterationDictionary::findHeadwordsForSynonym( wstring const & str )
THROW_SPEC( std::exception )
{
sptr< Dictionary::WordSearchRequestInstant > result = new Dictionary::WordSearchRequestInstant();

View file

@ -40,15 +40,15 @@ public:
throw() = 0;
virtual sptr< Dictionary::WordSearchRequest > findHeadwordsForSynonym( wstring const & )
THROW_SPEC( std::exception );
;
virtual sptr< Dictionary::WordSearchRequest > prefixMatch( wstring const &,
unsigned long ) THROW_SPEC( std::exception );
unsigned long ) ;
virtual sptr< Dictionary::DataRequest > getArticle( wstring const &,
vector< wstring > const &,
wstring const &, bool )
THROW_SPEC( std::exception );
;
};

View file

@ -143,7 +143,7 @@ string encode( wstring const & in ) throw()
encode( in.data(), in.size(), &buffer.front() ) );
}
wstring decode( string const & in ) THROW_SPEC( exCantDecode )
wstring decode( string const & in )
{
if ( in.size() == 0 )

View file

@ -46,7 +46,7 @@ long decode( char const * in, size_t inSize, wchar * out );
/// Versions for non time-critical code.
string encode( wstring const & ) throw();
wstring decode( string const & ) THROW_SPEC( exCantDecode );
wstring decode( string const & ) ;
/// Since the standard isspace() is locale-specific, we need something
/// that would never mess up our utf8 input. The stock one worked fine under

View file

@ -58,12 +58,12 @@ public:
virtual sptr< WordSearchRequest > prefixMatch( wstring const & word,
unsigned long maxResults )
THROW_SPEC( std::exception );
;
virtual sptr< DataRequest > getArticle( wstring const &,
vector< wstring > const & alts,
wstring const &, bool )
THROW_SPEC( std::exception );
;
protected:
@ -72,7 +72,7 @@ protected:
sptr< WordSearchRequest > VoiceEnginesDictionary::prefixMatch( wstring const & /*word*/,
unsigned long /*maxResults*/ )
THROW_SPEC( std::exception )
{
WordSearchRequestInstant * sr = new WordSearchRequestInstant();
sr->setUncertain( true );
@ -81,7 +81,7 @@ sptr< WordSearchRequest > VoiceEnginesDictionary::prefixMatch( wstring const & /
sptr< Dictionary::DataRequest > VoiceEnginesDictionary::getArticle(
wstring const & word, vector< wstring > const &, wstring const &, bool )
THROW_SPEC( std::exception )
{
string result;
string wordUtf8( Utf8::encode( word ) );
@ -128,7 +128,7 @@ void VoiceEnginesDictionary::loadIcon() throw()
vector< sptr< Dictionary::Class > > makeDictionaries(
Config::VoiceEngines const & voiceEngines )
THROW_SPEC( std::exception )
{
vector< sptr< Dictionary::Class > > result;

View file

@ -18,7 +18,7 @@ using std::string;
using gd::wstring;
vector< sptr< Dictionary::Class > > makeDictionaries(Config::VoiceEngines const & voiceEngines)
THROW_SPEC( std::exception );
;
}

View file

@ -56,14 +56,14 @@ public:
{ return 0; }
virtual sptr< WordSearchRequest > prefixMatch( wstring const & word,
unsigned long ) THROW_SPEC( std::exception );
unsigned long ) ;
virtual sptr< DataRequest > getArticle( wstring const &,
vector< wstring > const & alts,
wstring const & context, bool )
THROW_SPEC( std::exception );
;
virtual sptr< Dictionary::DataRequest > getResource( string const & name ) THROW_SPEC( std::exception );
virtual sptr< Dictionary::DataRequest > getResource( string const & name ) ;
void isolateWebCSS( QString & css );
@ -73,7 +73,7 @@ protected:
};
sptr< WordSearchRequest > WebSiteDictionary::prefixMatch( wstring const & /*word*/,
unsigned long ) THROW_SPEC( std::exception )
unsigned long )
{
sptr< WordSearchRequestInstant > sr = new WordSearchRequestInstant;
@ -328,7 +328,7 @@ void WebSiteArticleRequest::requestFinished( QNetworkReply * r )
sptr< DataRequest > WebSiteDictionary::getArticle( wstring const & str,
vector< wstring > const &,
wstring const & context, bool )
THROW_SPEC( std::exception )
{
QByteArray urlString;
@ -507,7 +507,7 @@ void WebSiteResourceRequest::requestFinished( QNetworkReply * r )
finish();
}
sptr< Dictionary::DataRequest > WebSiteDictionary::getResource( string const & name ) THROW_SPEC( std::exception )
sptr< Dictionary::DataRequest > WebSiteDictionary::getResource( string const & name )
{
QString link = QString::fromUtf8( name.c_str() );
int pos = link.indexOf( '/' );
@ -536,7 +536,7 @@ void WebSiteDictionary::loadIcon() throw()
vector< sptr< Dictionary::Class > > makeDictionaries( Config::WebSites const & ws,
QNetworkAccessManager & mgr )
THROW_SPEC( std::exception )
{
vector< sptr< Dictionary::Class > > result;

View file

@ -17,7 +17,7 @@ using std::string;
vector< sptr< Dictionary::Class > > makeDictionaries( Config::WebSites const &,
QNetworkAccessManager & )
THROW_SPEC( std::exception );
;
/// Exposed here for moc
class WebSiteDataRequestSlots: public Dictionary::DataRequest

14
xdxf.cc
View file

@ -167,10 +167,10 @@ public:
vector< wstring > const & alts,
wstring const &,
bool ignoreDiacritics )
THROW_SPEC( std::exception );
;
virtual sptr< Dictionary::DataRequest > getResource( string const & name )
THROW_SPEC( std::exception );
;
virtual QString const& getDescription();
@ -622,7 +622,7 @@ sptr< Dictionary::DataRequest > XdxfDictionary::getArticle( wstring const & word
vector< wstring > const & alts,
wstring const &,
bool ignoreDiacritics )
THROW_SPEC( std::exception )
{
return new XdxfArticleRequest( word, alts, *this, ignoreDiacritics );
}
@ -686,7 +686,7 @@ class GzippedFile: public QIODevice
public:
GzippedFile( char const * fileName ) THROW_SPEC( exCantReadFile );
GzippedFile( char const * fileName ) ;
~GzippedFile();
@ -717,7 +717,7 @@ protected:
{ return -1; }
};
GzippedFile::GzippedFile( char const * fileName ) THROW_SPEC( exCantReadFile )
GzippedFile::GzippedFile( char const * fileName )
{
gz = gd_gzopen( fileName );
if ( !gz )
@ -1134,7 +1134,7 @@ void XdxfResourceRequest::run()
}
sptr< Dictionary::DataRequest > XdxfDictionary::getResource( string const & name )
THROW_SPEC( std::exception )
{
return new XdxfResourceRequest( *this, name );
}
@ -1146,7 +1146,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
vector< string > const & fileNames,
string const & indicesDir,
Dictionary::Initializing & initializing )
THROW_SPEC( std::exception )
{
vector< sptr< Dictionary::Class > > dictionaries;

View file

@ -16,7 +16,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
vector< string > const & fileNames,
string const & indicesDir,
Dictionary::Initializing & )
THROW_SPEC( std::exception );
;
}

10
zim.cc
View file

@ -584,10 +584,10 @@ class ZimDictionary: public BtreeIndexing::BtreeDictionary
vector< wstring > const & alts,
wstring const &,
bool ignoreDiacritics )
THROW_SPEC( std::exception );
;
virtual sptr< Dictionary::DataRequest > getResource( string const & name )
THROW_SPEC( std::exception );
;
virtual QString const& getDescription();
@ -1329,7 +1329,7 @@ sptr< Dictionary::DataRequest > ZimDictionary::getArticle( wstring const & word,
vector< wstring > const & alts,
wstring const &,
bool ignoreDiacritics )
THROW_SPEC( std::exception )
{
return new ZimArticleRequest( word, alts, *this, ignoreDiacritics );
}
@ -1475,7 +1475,7 @@ void ZimResourceRequest::run()
}
sptr< Dictionary::DataRequest > ZimDictionary::getResource( string const & name )
THROW_SPEC( std::exception )
{
return new ZimResourceRequest( *this, name );
}
@ -1487,7 +1487,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
string const & indicesDir,
Dictionary::Initializing & initializing,
unsigned maxHeadwordsToExpand )
THROW_SPEC( std::exception )
{
vector< sptr< Dictionary::Class > > dictionaries;

2
zim.hh
View file

@ -16,7 +16,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
string const & indicesDir,
Dictionary::Initializing &,
unsigned maxHeadwordsToExpand )
THROW_SPEC( std::exception );
;
}

View file

@ -129,10 +129,10 @@ public:
vector< wstring > const & alts,
wstring const &,
bool ignoreDiacritics )
THROW_SPEC( std::exception );
;
virtual sptr< Dictionary::DataRequest > getResource( string const & name )
THROW_SPEC( std::exception );
;
protected:
@ -178,7 +178,7 @@ sptr< Dictionary::DataRequest > ZipSoundsDictionary::getArticle( wstring const &
vector< wstring > const & alts,
wstring const &,
bool ignoreDiacritics )
THROW_SPEC( std::exception )
{
vector< WordArticleLink > chain = findArticles( word, ignoreDiacritics );
@ -343,7 +343,7 @@ sptr< Dictionary::DataRequest > ZipSoundsDictionary::getArticle( wstring const &
}
sptr< Dictionary::DataRequest > ZipSoundsDictionary::getResource( string const & name )
THROW_SPEC( std::exception )
{
// Remove extension for sound files (like in sound dirs)
@ -410,7 +410,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
vector< string > const & fileNames,
string const & indicesDir,
Dictionary::Initializing & initializing )
THROW_SPEC( std::exception )
{
(void) initializing;
vector< sptr< Dictionary::Class > > dictionaries;

View file

@ -15,7 +15,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries(
vector< string > const & fileNames,
string const & indicesDir,
Dictionary::Initializing & )
THROW_SPEC( std::exception );
;
}