Kaydet (Commit) 4099852d authored tarafından Joseph Powers's avatar Joseph Powers

Remove DECLARE_LIST( GSIBlock_Impl, GSILine *)

üst f99fbee2
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#define _GSICHECK_HXX_ #define _GSICHECK_HXX_
#include "tagtest.hxx" #include "tagtest.hxx"
#include <vector>
// //
// class GSILine // class GSILine
...@@ -88,13 +89,14 @@ public: ...@@ -88,13 +89,14 @@ public:
// class GSIBlock // class GSIBlock
// //
DECLARE_LIST( GSIBlock_Impl, GSILine * ) typedef ::std::vector< GSILine* > GSIBlock_Impl;
class LazySvFileStream; class LazySvFileStream;
class GSIBlock : public GSIBlock_Impl class GSIBlock
{ {
private: private:
GSIBlock_Impl maList;
GSILine *pSourceLine; GSILine *pSourceLine;
GSILine *pReferenceLine; GSILine *pReferenceLine;
void PrintList( ParserMessageList *pList, ByteString aPrefix, GSILine *pLine ); void PrintList( ParserMessageList *pList, ByteString aPrefix, GSILine *pLine );
......
...@@ -198,7 +198,6 @@ GSILine::GSILine( const ByteString &rLine, ULONG nLine ) ...@@ -198,7 +198,6 @@ GSILine::GSILine( const ByteString &rLine, ULONG nLine )
} }
if ( nPos != STRING_NOTFOUND ) if ( nPos != STRING_NOTFOUND )
{ {
// ByteString aStatus = sTmp.Copy( nStart, nPos - nStart ); // ext int ...
nStart = nPos + 4; // + length of the delemiter nStart = nPos + 4; // + length of the delemiter
} }
if ( nPos != STRING_NOTFOUND ) if ( nPos != STRING_NOTFOUND )
...@@ -306,8 +305,9 @@ GSIBlock::~GSIBlock() ...@@ -306,8 +305,9 @@ GSIBlock::~GSIBlock()
delete pSourceLine; delete pSourceLine;
delete pReferenceLine; delete pReferenceLine;
for ( ULONG i = 0; i < Count(); i++ ) for ( size_t i = 0, n = maList.size(); i < n; ++i )
delete ( GetObject( i )); delete maList[ i ];
maList.clear();
} }
/*****************************************************************************/ /*****************************************************************************/
...@@ -332,20 +332,19 @@ void GSIBlock::InsertLine( GSILine* pLine, ByteString aSourceLang) ...@@ -332,20 +332,19 @@ void GSIBlock::InsertLine( GSILine* pLine, ByteString aSourceLang)
if ( aSourceLang.Len() ) // only check blockstructure if source lang is given if ( aSourceLang.Len() ) // only check blockstructure if source lang is given
{ {
ULONG nPos = 0; for ( size_t nPos = 0, n = maList.size(); nPos < n; ++nPos )
while ( nPos < Count() )
{ {
if ( GetObject( nPos )->GetLanguageId().Equals( pLine->GetLanguageId() ) ) if ( maList[ nPos ]->GetLanguageId().Equals( pLine->GetLanguageId() ) )
{ {
PrintError( "Translation Language entry double. Checking both.", "File format", "", pLine->GetLineNumber(), pLine->GetUniqId() ); PrintError( "Translation Language entry double. Checking both.", "File format", "", pLine->GetLineNumber(), pLine->GetUniqId() );
bHasBlockError = TRUE; bHasBlockError = TRUE;
GetObject( nPos )->NotOK(); maList[ nPos ]->NotOK();
pLine->NotOK(); pLine->NotOK();
} }
nPos++; nPos++;
} }
} }
Insert( pLine, LIST_APPEND ); maList.push_back( pLine );
} }
/*****************************************************************************/ /*****************************************************************************/
...@@ -613,7 +612,7 @@ BOOL GSIBlock::CheckSyntax( ULONG nLine, BOOL bRequireSourceLine, BOOL bFixTags ...@@ -613,7 +612,7 @@ BOOL GSIBlock::CheckSyntax( ULONG nLine, BOOL bRequireSourceLine, BOOL bFixTags
if ( pSourceLine ) if ( pSourceLine )
pSource = pSourceLine; pSource = pSourceLine;
else else
pSource = GetObject( 0 ); // get some other line pSource = maList.empty() ? NULL : maList[ 0 ]; // get some other line
if ( pSource ) if ( pSource )
PrintError( "No reference line found. Entry is new in source file", "File format", "", pSource->GetLineNumber(), pSource->GetUniqId() ); PrintError( "No reference line found. Entry is new in source file", "File format", "", pSource->GetLineNumber(), pSource->GetUniqId() );
else else
...@@ -637,21 +636,21 @@ BOOL GSIBlock::CheckSyntax( ULONG nLine, BOOL bRequireSourceLine, BOOL bFixTags ...@@ -637,21 +636,21 @@ BOOL GSIBlock::CheckSyntax( ULONG nLine, BOOL bRequireSourceLine, BOOL bFixTags
if ( pSourceLine ) if ( pSourceLine )
bHasError |= !TestUTF8( pSourceLine, bFixTags ); bHasError |= !TestUTF8( pSourceLine, bFixTags );
ULONG i; for ( size_t i = 0, n = maList.size(); i < n; ++i )
for ( i = 0; i < Count(); i++ )
{ {
aTester.CheckTestee( GetObject( i ), pSourceLine != NULL, bFixTags ); GSILine* pItem = maList[ i ];
if ( GetObject( i )->HasMessages() || aTester.HasCompareWarnings() ) aTester.CheckTestee( pItem, pSourceLine != NULL, bFixTags );
if ( pItem->HasMessages() || aTester.HasCompareWarnings() )
{ {
if ( GetObject( i )->HasMessages() || aTester.GetCompareWarnings().HasErrors() ) if ( pItem->HasMessages() || aTester.GetCompareWarnings().HasErrors() )
GetObject( i )->NotOK(); pItem->NotOK();
bHasError = TRUE; bHasError = TRUE;
PrintList( GetObject( i )->GetMessageList(), "Translation", GetObject( i ) ); PrintList( pItem->GetMessageList(), "Translation", pItem );
PrintList( &(aTester.GetCompareWarnings()), "Translation Tag Mismatch", GetObject( i ) ); PrintList( &(aTester.GetCompareWarnings()), "Translation Tag Mismatch", pItem );
} }
bHasError |= !TestUTF8( GetObject( i ), bFixTags ); bHasError |= !TestUTF8( pItem, bFixTags );
if ( pSourceLine ) if ( pSourceLine )
bHasError |= HasSuspiciousChars( GetObject( i ), pSourceLine ); bHasError |= HasSuspiciousChars( pItem, pSourceLine );
} }
return bHasError || bHasBlockError; return bHasError || bHasBlockError;
...@@ -664,14 +663,14 @@ void GSIBlock::WriteError( LazySvFileStream &aErrOut, BOOL bRequireSourceLine ) ...@@ -664,14 +663,14 @@ void GSIBlock::WriteError( LazySvFileStream &aErrOut, BOOL bRequireSourceLine )
BOOL bHasError = FALSE; BOOL bHasError = FALSE;
BOOL bCopyAll = ( !pSourceLine && bRequireSourceLine ) || ( pSourceLine && !pSourceLine->IsOK() && !bCheckTranslationLang ) || bHasBlockError; BOOL bCopyAll = ( !pSourceLine && bRequireSourceLine ) || ( pSourceLine && !pSourceLine->IsOK() && !bCheckTranslationLang ) || bHasBlockError;
ULONG i; for ( size_t i = 0, n = maList.size(); i < n; ++i )
for ( i = 0; i < Count(); i++ )
{ {
if ( !GetObject( i )->IsOK() || bCopyAll ) GSILine* pItem = maList[ i ];
if ( !pItem->IsOK() || bCopyAll )
{ {
bHasError = TRUE; bHasError = TRUE;
aErrOut.LazyOpen(); aErrOut.LazyOpen();
aErrOut.WriteLine( *GetObject( i ) ); aErrOut.WriteLine( *pItem );
} }
} }
...@@ -688,18 +687,18 @@ void GSIBlock::WriteCorrect( LazySvFileStream &aOkOut, BOOL bRequireSourceLine ) ...@@ -688,18 +687,18 @@ void GSIBlock::WriteCorrect( LazySvFileStream &aOkOut, BOOL bRequireSourceLine )
return; return;
BOOL bHasOK = FALSE; BOOL bHasOK = FALSE;
ULONG i; for ( size_t i = 0, n = maList.size(); i < n; ++i )
for ( i = 0; i < Count(); i++ )
{ {
if ( ( GetObject( i )->IsOK() || bCheckSourceLang ) && !bHasBlockError ) GSILine* pItem = maList[ i ];
if ( ( pItem->IsOK() || bCheckSourceLang ) && !bHasBlockError )
{ {
bHasOK = TRUE; bHasOK = TRUE;
aOkOut.LazyOpen(); aOkOut.LazyOpen();
aOkOut.WriteLine( *GetObject( i ) ); aOkOut.WriteLine( *pItem );
} }
} }
if ( ( pSourceLine && pSourceLine->IsOK() && ( Count() || !bCheckTranslationLang ) ) || ( bHasOK && bCheckTranslationLang ) ) if ( ( pSourceLine && pSourceLine->IsOK() && ( !maList.empty() || !bCheckTranslationLang ) ) || ( bHasOK && bCheckTranslationLang ) )
{ {
aOkOut.LazyOpen(); aOkOut.LazyOpen();
aOkOut.WriteLine( *pSourceLine ); aOkOut.WriteLine( *pSourceLine );
...@@ -712,14 +711,14 @@ void GSIBlock::WriteFixed( LazySvFileStream &aFixOut, BOOL /*bRequireSourceLine* ...@@ -712,14 +711,14 @@ void GSIBlock::WriteFixed( LazySvFileStream &aFixOut, BOOL /*bRequireSourceLine*
return; return;
BOOL bHasFixes = FALSE; BOOL bHasFixes = FALSE;
ULONG i; for ( size_t i = 0, n = maList.size(); i < n; ++i )
for ( i = 0; i < Count(); i++ )
{ {
if ( GetObject( i )->IsFixed() ) GSILine* pItem = maList[ i ];
if ( pItem->IsFixed() )
{ {
bHasFixes = TRUE; bHasFixes = TRUE;
aFixOut.LazyOpen(); aFixOut.LazyOpen();
aFixOut.WriteLine( *GetObject( i ) ); aFixOut.WriteLine( *pItem );
} }
} }
...@@ -1115,8 +1114,6 @@ int _cdecl main( int argc, char *argv[] ) ...@@ -1115,8 +1114,6 @@ int _cdecl main( int argc, char *argv[] )
} }
else if ( pReferenceLine->GetUniqId() > aId ) else if ( pReferenceLine->GetUniqId() > aId )
{ {
// if ( pGSILine->GetLanguageId() == aSourceLang )
// PrintError( "No reference line found. Entry is new in source file", "File format", "", bPrintContext, pGSILine->GetLineNumber(), aId );
bContinueSearching = FALSE; bContinueSearching = FALSE;
} }
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment