@ -139,9 +139,9 @@ void addWords (WordMap &map, TQString line) {
TQStringList : : ConstIterator it ;
TQStringList : : ConstIterator it ;
for ( it = words . begin ( ) ; it ! = words . end ( ) ; + + it ) {
for ( it = words . begin ( ) ; it ! = words . end ( ) ; + + it ) {
if ( ! ( * it ) . tq contains( TQRegExp ( " \\ d|_ " ) ) ) {
if ( ! ( * it ) . contains( TQRegExp ( " \\ d|_ " ) ) ) {
TQString key = ( * it ) . lower ( ) ;
TQString key = ( * it ) . lower ( ) ;
if ( map . tq contains( key ) )
if ( map . contains( key ) )
map [ key ] + = 1 ;
map [ key ] + = 1 ;
else
else
map [ key ] = 1 ;
map [ key ] = 1 ;
@ -152,7 +152,7 @@ void addWords (WordMap &map, TQString line) {
void addWords ( WordMap & map , WordMap add ) {
void addWords ( WordMap & map , WordMap add ) {
WordList : : WordMap : : ConstIterator it ;
WordList : : WordMap : : ConstIterator it ;
for ( it = add . begin ( ) ; it ! = add . end ( ) ; + + it )
for ( it = add . begin ( ) ; it ! = add . end ( ) ; + + it )
if ( map . tq contains( it . key ( ) ) )
if ( map . contains( it . key ( ) ) )
map [ it . key ( ) ] + = it . data ( ) ;
map [ it . key ( ) ] + = it . data ( ) ;
else
else
map [ it . key ( ) ] = it . data ( ) ;
map [ it . key ( ) ] = it . data ( ) ;
@ -186,7 +186,7 @@ void addWordsFromFile (WordMap &map, TQString filename, TQTextStream::Encoding e
bool ok ;
bool ok ;
int weight = list [ 1 ] . toInt ( & ok ) ;
int weight = list [ 1 ] . toInt ( & ok ) ;
if ( ok & & ( weight > 0 ) ) {
if ( ok & & ( weight > 0 ) ) {
if ( map . tq contains( list [ 0 ] ) )
if ( map . contains( list [ 0 ] ) )
map [ list [ 0 ] ] + = weight ;
map [ list [ 0 ] ] + = weight ;
else
else
map [ list [ 0 ] ] = weight ;
map [ list [ 0 ] ] = weight ;
@ -261,7 +261,7 @@ WordMap mergeFiles (TQMap<TQString,int> files, KProgressDialog *pdlg) {
maxWeight = weight ;
maxWeight = weight ;
for ( iter = fileMap . begin ( ) ; iter ! = fileMap . end ( ) ; + + iter )
for ( iter = fileMap . begin ( ) ; iter ! = fileMap . end ( ) ; + + iter )
if ( map . tq contains( iter . key ( ) ) )
if ( map . contains( iter . key ( ) ) )
map [ iter . key ( ) ] + = iter . data ( ) * factor ;
map [ iter . key ( ) ] + = iter . data ( ) * factor ;
else
else
map [ iter . key ( ) ] = iter . data ( ) * factor ;
map [ iter . key ( ) ] = iter . data ( ) * factor ;
@ -394,14 +394,14 @@ void loadAffFile(const TQString &filename, AffMap &prefixes, AffMap &suffixes) {
if ( s . startsWith ( " PFX " ) ) {
if ( s . startsWith ( " PFX " ) ) {
AffList list ;
AffList list ;
if ( prefixes . tq contains ( fields [ 1 ] [ 0 ] ) )
if ( prefixes . contains ( fields [ 1 ] [ 0 ] ) )
list = prefixes [ fields [ 1 ] [ 0 ] ] ;
list = prefixes [ fields [ 1 ] [ 0 ] ] ;
list < < e ;
list < < e ;
prefixes [ fields [ 1 ] [ 0 ] ] = list ;
prefixes [ fields [ 1 ] [ 0 ] ] = list ;
}
}
else if ( s . startsWith ( " SFX " ) ) {
else if ( s . startsWith ( " SFX " ) ) {
AffList list ;
AffList list ;
if ( suffixes . tq contains ( fields [ 1 ] [ 0 ] ) )
if ( suffixes . contains ( fields [ 1 ] [ 0 ] ) )
list = suffixes [ fields [ 1 ] [ 0 ] ] ;
list = suffixes [ fields [ 1 ] [ 0 ] ] ;
list < < e ;
list < < e ;
suffixes [ fields [ 1 ] [ 0 ] ] = list ;
suffixes [ fields [ 1 ] [ 0 ] ] = list ;
@ -432,7 +432,7 @@ inline bool checkCondition (const TQString &word, const TQStringList &condition)
it ! = condition . end ( ) ;
it ! = condition . end ( ) ;
+ + it , + + idx )
+ + it , + + idx )
{
{
if ( ( * it ) . tq contains( word [ idx ] ) = = ( ( * it ) [ 0 ] = = ' ^ ' ) )
if ( ( * it ) . contains( word [ idx ] ) = = ( ( * it ) [ 0 ] = = ' ^ ' ) )
return false ;
return false ;
}
}
return true ;
return true ;
@ -445,7 +445,7 @@ inline bool checkCondition (const TQString &word, const TQStringList &condition)
*/
*/
inline void checkWord ( const TQString & word , const TQString & modifiers , bool cross , const WordMap & map , WordMap & checkedMap , const AffMap & suffixes ) {
inline void checkWord ( const TQString & word , const TQString & modifiers , bool cross , const WordMap & map , WordMap & checkedMap , const AffMap & suffixes ) {
for ( uint i = 0 ; i < modifiers . length ( ) ; i + + ) {
for ( uint i = 0 ; i < modifiers . length ( ) ; i + + ) {
if ( suffixes . tq contains( modifiers [ i ] ) ) {
if ( suffixes . contains( modifiers [ i ] ) ) {
AffList sList = suffixes [ modifiers [ i ] ] ;
AffList sList = suffixes [ modifiers [ i ] ] ;
AffList : : ConstIterator sIt ;
AffList : : ConstIterator sIt ;
@ -454,7 +454,7 @@ inline void checkWord(const TQString &word, const TQString &modifiers, bool cros
& & ( checkCondition ( word , ( * sIt ) . condition ) ) )
& & ( checkCondition ( word , ( * sIt ) . condition ) ) )
{
{
TQString sWord = word . left ( word . length ( ) - ( * sIt ) . charsToRemove ) + ( * sIt ) . add ;
TQString sWord = word . left ( word . length ( ) - ( * sIt ) . charsToRemove ) + ( * sIt ) . add ;
if ( map . tq contains( sWord ) )
if ( map . contains( sWord ) )
checkedMap [ sWord ] = map [ sWord ] ;
checkedMap [ sWord ] = map [ sWord ] ;
}
}
}
}
@ -467,19 +467,19 @@ inline void checkWord(const TQString &word, const TQString &modifiers, bool cros
* @ param modifiers discribes which pre - and suffixes are valid
* @ param modifiers discribes which pre - and suffixes are valid
*/
*/
void checkWord ( const TQString & word , const TQString & modifiers , const WordMap & map , WordMap & checkedMap , const AffMap & prefixes , const AffMap & suffixes ) {
void checkWord ( const TQString & word , const TQString & modifiers , const WordMap & map , WordMap & checkedMap , const AffMap & prefixes , const AffMap & suffixes ) {
if ( map . tq contains( word ) )
if ( map . contains( word ) )
checkedMap [ word ] = map [ word ] ;
checkedMap [ word ] = map [ word ] ;
checkWord ( word , modifiers , true , map , checkedMap , suffixes ) ;
checkWord ( word , modifiers , true , map , checkedMap , suffixes ) ;
for ( uint i = 0 ; i < modifiers . length ( ) ; i + + ) {
for ( uint i = 0 ; i < modifiers . length ( ) ; i + + ) {
if ( prefixes . tq contains( modifiers [ i ] ) ) {
if ( prefixes . contains( modifiers [ i ] ) ) {
AffList pList = prefixes [ modifiers [ i ] ] ;
AffList pList = prefixes [ modifiers [ i ] ] ;
AffList : : ConstIterator pIt ;
AffList : : ConstIterator pIt ;
for ( pIt = pList . begin ( ) ; pIt ! = pList . end ( ) ; + + pIt ) {
for ( pIt = pList . begin ( ) ; pIt ! = pList . end ( ) ; + + pIt ) {
TQString pWord = ( * pIt ) . add + word ;
TQString pWord = ( * pIt ) . add + word ;
if ( map . tq contains( pWord ) )
if ( map . contains( pWord ) )
checkedMap [ pWord ] = map [ pWord ] ;
checkedMap [ pWord ] = map [ pWord ] ;
checkWord ( pWord , modifiers , false , map , checkedMap , suffixes ) ;
checkWord ( pWord , modifiers , false , map , checkedMap , suffixes ) ;
@ -520,14 +520,14 @@ WordMap spellCheck (WordMap map, TQString dictionary, KProgressDialog *pdlg) {
while ( ! stream . atEnd ( ) ) {
while ( ! stream . atEnd ( ) ) {
TQString s = stream . readLine ( ) ;
TQString s = stream . readLine ( ) ;
if ( s . tq contains( " / " ) ) {
if ( s . contains( " / " ) ) {
TQString word = s . left ( s . tq find( " / " ) ) . lower ( ) ;
TQString word = s . left ( s . find( " / " ) ) . lower ( ) ;
TQString modifiers = s . right ( s . length ( ) - s . tq find( " / " ) ) ;
TQString modifiers = s . right ( s . length ( ) - s . find( " / " ) ) ;
checkWord ( word , modifiers , map , checkedMap , prefixes , suffixes ) ;
checkWord ( word , modifiers , map , checkedMap , prefixes , suffixes ) ;
}
}
else {
else {
if ( ! s . isEmpty ( ) & & ! s . isNull ( ) & & map . tq contains( s . lower ( ) ) )
if ( ! s . isEmpty ( ) & & ! s . isNull ( ) & & map . contains( s . lower ( ) ) )
checkedMap [ s . lower ( ) ] = map [ s . lower ( ) ] ;
checkedMap [ s . lower ( ) ] = map [ s . lower ( ) ] ;
}
}