Update of /cvsroot/cpptool/rfta/src/rfta
In directory sc8-pr-cvs1:/tmp/cvs-serv10043/rfta
Modified Files:
ReduceTempScopeRefactoringTest.h Transform.h
ReduceTempScopeRefactoringTest.cpp SplitTempRefactoringTest.h
InlineTempRefactoringTest.h ReduceTempScopeRefactoring.cpp
RefactoringBase.cpp SplitDeclarationRefactoringTest.cpp
SplitDeclarationRefactoringTest.h SplitTempRefactoringTest.cpp
CodeWriterTestBase.h InlineTempRefactoringTest.cpp
TransformListTest.h ReplaceTextTransform.cpp
ReplaceTextTransform.h MockTextDocument.h TransformList.cpp
IndentLevelManager.cpp SourceBasedTestBase.h
CodeWriterTestBase.cpp RenameTempRefactoringTest.h
SplitTempRefactoring.cpp InlineTempRefactoring.cpp
IndentLevelManager.h RenameTempRefactoringTest.cpp
RenameTempRefactoring.cpp CodeWriterTest.cpp CodeRewriter.cpp
Log Message:
-- integrated preprocessor (replaced all NonSemanticBlanker)
Index: ReduceTempScopeRefactoringTest.h
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/ReduceTempScopeRefactoringTest.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ReduceTempScopeRefactoringTest.h 21 Dec 2002 14:40:41 -0000 1.1
--- ReduceTempScopeRefactoringTest.h 13 Jan 2004 22:27:35 -0000 1.2
***************
*** 7,11 ****
#include "SourceBasedTestBase.h"
!
namespace Refactoring
--- 7,11 ----
#include "SourceBasedTestBase.h"
! #include <rfta/test/SourceManagerMock.h>
namespace Refactoring
***************
*** 37,41 ****
void applyRefactoring();
! boost::shared_ptr<PlainTextDocument> document_;
};
--- 37,42 ----
void applyRefactoring();
! Testing::SourceManagerMock sourceMngMock_;
! SourcePtr sourceDoc_;
};
Index: Transform.h
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/Transform.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Transform.h 16 Dec 2003 13:47:00 -0000 1.1
--- Transform.h 13 Jan 2004 22:27:35 -0000 1.2
***************
*** 8,11 ****
--- 8,12 ----
#include <rfta/refactoring/Config.h>
+ #include <boost/shared_ptr.hpp>
namespace Refactoring
***************
*** 13,16 ****
--- 14,19 ----
class TextDocument;
+ class Source;
+ typedef boost::shared_ptr<Source> SourcePtr;
***************
*** 31,34 ****
--- 34,42 ----
virtual int apply( TextDocument &document ) const = 0;
+ /**
+ * does the text transformation and returns the delta-length
+ */
+ virtual int apply( SourcePtr pSource ) const = 0;
+
virtual void moveStartIndexBy( int delta ) = 0;
Index: ReduceTempScopeRefactoringTest.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/ReduceTempScopeRefactoringTest.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ReduceTempScopeRefactoringTest.cpp 22 Dec 2002 15:47:34 -0000 1.2
--- ReduceTempScopeRefactoringTest.cpp 13 Jan 2004 22:27:35 -0000 1.3
***************
*** 6,11 ****
#include "stdafx.h"
#include "ReduceTempScopeRefactoringTest.h"
! #include <rfta/refactoring/PlainTextDocument.h>
#include <rfta/refactoring/ReduceTempScopeRefactoring.h>
--- 6,12 ----
#include "stdafx.h"
#include "ReduceTempScopeRefactoringTest.h"
! #include <rfta/parser/PlainTextDocument.h>
#include <rfta/refactoring/ReduceTempScopeRefactoring.h>
+ #include <rfta/parser/Source.h>
***************
*** 43,49 ****
ReduceTempScopeRefactoringTest::applyRefactoring()
{
! document_.reset( new PlainTextDocument( source_ ) );
int selectionIndex = builder_->getStartIndex( "selection" );
! ReduceTempScopeRefactoring refactoring( *document_,
selectionIndex );
refactoring.apply();
--- 44,51 ----
ReduceTempScopeRefactoringTest::applyRefactoring()
{
! sourceDoc_ = SourcePtr( new Source( TextDocumentPtr(new PlainTextDocument( source_ ) ) ) );
int selectionIndex = builder_->getStartIndex( "selection" );
! ReduceTempScopeRefactoring refactoring( sourceDoc_,
! sourceMngMock_,
selectionIndex );
refactoring.apply();
***************
*** 71,75 ****
" }"
"}";
! std::string actualSource( document_->getAllText() );
// RFTA_ASSERT_EQUAL( expectedSource, actualSource );
}
--- 73,77 ----
" }"
"}";
! std::string actualSource( sourceDoc_->getOriginalText() );
// RFTA_ASSERT_EQUAL( expectedSource, actualSource );
}
Index: SplitTempRefactoringTest.h
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/SplitTempRefactoringTest.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** SplitTempRefactoringTest.h 19 Dec 2003 20:14:39 -0000 1.2
--- SplitTempRefactoringTest.h 13 Jan 2004 22:27:35 -0000 1.3
***************
*** 7,11 ****
#include "SourceBasedTestBase.h"
!
namespace Refactoring
--- 7,11 ----
#include "SourceBasedTestBase.h"
! #include <rfta/test/SourceManagerMock.h>
namespace Refactoring
***************
*** 40,44 ****
void applyRefactoring( const std::string &newTemporaryName );
! boost::shared_ptr<PlainTextDocument> document_;
};
--- 40,44 ----
void applyRefactoring( const std::string &newTemporaryName );
! Testing::SourceManagerMock sourceMngMock_;
};
Index: InlineTempRefactoringTest.h
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/InlineTempRefactoringTest.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** InlineTempRefactoringTest.h 5 Apr 2003 12:13:36 -0000 1.3
--- InlineTempRefactoringTest.h 13 Jan 2004 22:27:35 -0000 1.4
***************
*** 8,11 ****
--- 8,12 ----
#include "SourceBasedTestBase.h"
#include <rfta/refactoring/RefactoringError.h>
+ #include <rfta/test/SourceManagerMock.h>
namespace Refactoring
***************
*** 72,76 ****
void applyRefactoringNoThrow ( const std::string &assignment , const std::string &LocaleVariableName , const CppUnit::SourceLine &sourceLine );
! boost::shared_ptr<PlainTextDocument> document_;
};
--- 73,79 ----
void applyRefactoringNoThrow ( const std::string &assignment , const std::string &LocaleVariableName , const CppUnit::SourceLine &sourceLine );
! //boost::shared_ptr<PlainTextDocument> document_;
! SourcePtr sourceDoc_;
! Testing::SourceManagerMock sourceMngMock_;
};
Index: ReduceTempScopeRefactoring.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/ReduceTempScopeRefactoring.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** ReduceTempScopeRefactoring.cpp 22 Dec 2002 15:47:34 -0000 1.3
--- ReduceTempScopeRefactoring.cpp 13 Jan 2004 22:27:35 -0000 1.4
***************
*** 13,19 ****
ReduceTempScopeRefactoring::ReduceTempScopeRefactoring(
! TextDocument &document,
int localeVariableLocation )
! : RefactoringBase( document )
, localeVariableLocation_( localeVariableLocation )
{
--- 13,20 ----
ReduceTempScopeRefactoring::ReduceTempScopeRefactoring(
! SourcePtr source,
! SourceManager& manager,
int localeVariableLocation )
! : RefactoringBase( source, manager )
, localeVariableLocation_( localeVariableLocation )
{
Index: RefactoringBase.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/RefactoringBase.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** RefactoringBase.cpp 22 Dec 2002 16:03:52 -0000 1.4
--- RefactoringBase.cpp 13 Jan 2004 22:27:35 -0000 1.5
***************
*** 9,18 ****
#include <rfta/refactoring/RefactoringBase.h>
#include <rfta/parser/SourceRange.h>
namespace Refactoring{
! RefactoringBase::RefactoringBase( TextDocument& document )
! : baseDocument_( document )
{
}
--- 9,20 ----
#include <rfta/refactoring/RefactoringBase.h>
#include <rfta/parser/SourceRange.h>
+ #include <rfta/parser/Source.h>
namespace Refactoring{
! RefactoringBase::RefactoringBase( SourcePtr source, SourceManager& manager )
! : source_( source )
! , manager_( manager )
{
}
***************
*** 27,31 ****
RefactoringBase::getDocument()
{
! return baseDocument_;
}
--- 29,33 ----
RefactoringBase::getDocument()
{
! return *(source_->getTextDocument());
}
Index: SplitDeclarationRefactoringTest.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/SplitDeclarationRefactoringTest.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** SplitDeclarationRefactoringTest.cpp 19 Dec 2003 20:14:27 -0000 1.4
--- SplitDeclarationRefactoringTest.cpp 13 Jan 2004 22:27:35 -0000 1.5
***************
*** 7,11 ****
#include "SplitDeclarationRefactoringTest.h"
#include <rfta/refactoring/SplitDeclarationRefactoring.h>
! #include <rfta/refactoring/PlainTextDocument.h>
--- 7,12 ----
#include "SplitDeclarationRefactoringTest.h"
#include <rfta/refactoring/SplitDeclarationRefactoring.h>
! #include <rfta/parser/PlainTextDocument.h>
! #include <rfta/parser/Source.h>
***************
*** 36,40 ****
SplitDeclarationRefactoringTest::tearDown()
{
- document_.reset();
SourceBasedTestBase::tearDown();
}
--- 37,40 ----
***************
*** 44,50 ****
SplitDeclarationRefactoringTest::applyRefactoring( )
{
! document_.reset( new PlainTextDocument( source_ ) );
int selectionIndex = builder_->getStartIndex( "selection" );
! SplitDeclarationRefactoring refactoring( *document_,
selectionIndex );
refactoring.apply( );
--- 44,52 ----
SplitDeclarationRefactoringTest::applyRefactoring( )
{
! sourceDoc_ = SourcePtr( new Source( TextDocumentPtr( new PlainTextDocument( source_ ) ) ) );
!
int selectionIndex = builder_->getStartIndex( "selection" );
! SplitDeclarationRefactoring refactoring( sourceDoc_,
! sourceMngMock_,
selectionIndex );
refactoring.apply( );
***************
*** 65,69 ****
" double y;\n"
"}\n" );
! std::string actualSource( document_->getAllText() );
RFTA_ASSERT_EQUAL( expectedSource, actualSource );
}
--- 67,71 ----
" double y;\n"
"}\n" );
! std::string actualSource( sourceDoc_->getOriginalText() );
RFTA_ASSERT_EQUAL( expectedSource, actualSource );
}
***************
*** 83,87 ****
" double &z;\n"
"}\n" );
! std::string actualSource( document_->getAllText() );
RFTA_ASSERT_EQUAL( expectedSource, actualSource );
}
--- 85,89 ----
" double &z;\n"
"}\n" );
! std::string actualSource( sourceDoc_->getOriginalText() );
RFTA_ASSERT_EQUAL( expectedSource, actualSource );
}
***************
*** 101,105 ****
" double&z;\n"
"}\n" );
! std::string actualSource( document_->getAllText() );
RFTA_ASSERT_EQUAL( expectedSource, actualSource );
}
--- 103,107 ----
" double&z;\n"
"}\n" );
! std::string actualSource( sourceDoc_->getOriginalText() );
RFTA_ASSERT_EQUAL( expectedSource, actualSource );
}
***************
*** 121,125 ****
" bool n, m;\n"
"}\n");
! std::string actualSource( document_->getAllText() );
RFTA_ASSERT_EQUAL( expectedSource, actualSource );
--- 123,127 ----
" bool n, m;\n"
"}\n");
! std::string actualSource( sourceDoc_->getOriginalText() );
RFTA_ASSERT_EQUAL( expectedSource, actualSource );
***************
*** 138,142 ****
" int y(2);\n"
"}\n");
! std::string actualSource( document_->getAllText() );
RFTA_ASSERT_EQUAL( expectedSource, actualSource );
}
--- 140,144 ----
" int y(2);\n"
"}\n");
! std::string actualSource( sourceDoc_->getOriginalText() );
RFTA_ASSERT_EQUAL( expectedSource, actualSource );
}
***************
*** 161,165 ****
" }\n"
"}\n");
! std::string actualSource( document_->getAllText() );
RFTA_ASSERT_EQUAL( expectedSource, actualSource );
--- 163,167 ----
" }\n"
"}\n");
! std::string actualSource( sourceDoc_->getOriginalText() );
RFTA_ASSERT_EQUAL( expectedSource, actualSource );
***************
*** 181,185 ****
" ;\n"
"}\n");
! std::string actualSource( document_->getAllText() );
RFTA_ASSERT_EQUAL( expectedSource, actualSource );
}
--- 183,187 ----
" ;\n"
"}\n");
! std::string actualSource( sourceDoc_->getOriginalText() );
RFTA_ASSERT_EQUAL( expectedSource, actualSource );
}
***************
*** 202,206 ****
" double y;\n"
"}\n" );
! std::string actualSource( document_->getAllText() );
RFTA_ASSERT_EQUAL( expectedSource, actualSource );
}
--- 204,208 ----
" double y;\n"
"}\n" );
! std::string actualSource( sourceDoc_->getOriginalText() );
RFTA_ASSERT_EQUAL( expectedSource, actualSource );
}
Index: SplitDeclarationRefactoringTest.h
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/SplitDeclarationRefactoringTest.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** SplitDeclarationRefactoringTest.h 19 Dec 2003 20:14:27 -0000 1.4
--- SplitDeclarationRefactoringTest.h 13 Jan 2004 22:27:35 -0000 1.5
***************
*** 7,11 ****
#include "SourceBasedTestBase.h"
!
namespace Refactoring
--- 7,11 ----
#include "SourceBasedTestBase.h"
! #include <rfta/test/SourceManagerMock.h>
namespace Refactoring
***************
*** 52,56 ****
void applyRefactoring( );
! boost::shared_ptr<PlainTextDocument> document_;
};
--- 52,57 ----
void applyRefactoring( );
! Testing::SourceManagerMock sourceMngMock_;
! SourcePtr sourceDoc_;
};
Index: SplitTempRefactoringTest.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/SplitTempRefactoringTest.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** SplitTempRefactoringTest.cpp 19 Dec 2003 20:14:39 -0000 1.4
--- SplitTempRefactoringTest.cpp 13 Jan 2004 22:27:35 -0000 1.5
***************
*** 7,11 ****
#include "SplitTempRefactoringTest.h"
#include <rfta/refactoring/SplitTempRefactoring.h>
! #include <rfta/refactoring/PlainTextDocument.h>
--- 7,12 ----
#include "SplitTempRefactoringTest.h"
#include <rfta/refactoring/SplitTempRefactoring.h>
! #include <rfta/parser/PlainTextDocument.h>
! #include <rfta/parser/Source.h>
***************
*** 35,40 ****
void
SplitTempRefactoringTest::tearDown()
! {
! document_.reset();
SourceBasedTestBase::tearDown();
}
--- 36,40 ----
void
SplitTempRefactoringTest::tearDown()
! {
SourceBasedTestBase::tearDown();
}
***************
*** 44,50 ****
SplitTempRefactoringTest::applyRefactoring( const std::string &newTemporaryName )
{
! document_.reset( new PlainTextDocument( source_ ) );
int selectionIndex = builder_->getStartIndex( "selection" );
! SplitTempRefactoring refactoring( *document_,
selectionIndex );
refactoring.apply( newTemporaryName );
--- 44,52 ----
SplitTempRefactoringTest::applyRefactoring( const std::string &newTemporaryName )
{
! sourceDoc_ = SourcePtr( new Source( TextDocumentPtr( new PlainTextDocument( source_ ) ) ) );
!
int selectionIndex = builder_->getStartIndex( "selection" );
! SplitTempRefactoring refactoring( sourceDoc_,
! sourceMngMock_,
selectionIndex );
refactoring.apply( newTemporaryName );
***************
*** 73,77 ****
" doSomething( x );"
"}" );
! std::string actualSource( document_->getAllText() );
RFTA_ASSERT_EQUAL( expectedSource, actualSource );
}
--- 75,79 ----
" doSomething( x );"
"}" );
! std::string actualSource( sourceDoc_->getOriginalText() );
RFTA_ASSERT_EQUAL( expectedSource, actualSource );
}
***************
*** 102,106 ****
" doSomething( x );"
"}" );
! std::string actualSource( document_->getAllText() );
RFTA_ASSERT_EQUAL( expectedSource, actualSource );
}
--- 104,108 ----
" doSomething( x );"
"}" );
! std::string actualSource( sourceDoc_->getOriginalText() );
RFTA_ASSERT_EQUAL( expectedSource, actualSource );
}
Index: CodeWriterTestBase.h
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/CodeWriterTestBase.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** CodeWriterTestBase.h 6 Apr 2003 18:06:59 -0000 1.5
--- CodeWriterTestBase.h 13 Jan 2004 22:27:35 -0000 1.6
***************
*** 8,12 ****
#include <rfta/refactoring/CodeModelStatements.h>
#include <rfta/refactoring/CodeModelExpressions.h>
! #include <rfta/refactoring/PlainTextDocument.h>
#include "CodeRewriter.h"
#include "SourceBasedTestBase.h"
--- 8,12 ----
#include <rfta/refactoring/CodeModelStatements.h>
#include <rfta/refactoring/CodeModelExpressions.h>
! #include <rfta/parser/PlainTextDocument.h>
#include "CodeRewriter.h"
#include "SourceBasedTestBase.h"
***************
*** 42,47 ****
void generateAndCheckSource( const std::string &expectedSource );
! CodeModel::CompoundStatementPtr compound_;
! boost::shared_ptr<PlainTextDocument> document_;
boost::shared_ptr<CodeModel::CodeRewriter> writer_;
};
--- 42,46 ----
void generateAndCheckSource( const std::string &expectedSource );
! CodeModel::CompoundStatementPtr compound_;
boost::shared_ptr<CodeModel::CodeRewriter> writer_;
};
Index: InlineTempRefactoringTest.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/InlineTempRefactoringTest.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** InlineTempRefactoringTest.cpp 6 Apr 2003 16:17:19 -0000 1.5
--- InlineTempRefactoringTest.cpp 13 Jan 2004 22:27:35 -0000 1.6
***************
*** 7,11 ****
#include "InlineTempRefactoringTest.h"
#include <rfta/refactoring/InlineTempRefactoring.h>
! #include <rfta/refactoring/PlainTextDocument.h>
--- 7,12 ----
#include "InlineTempRefactoringTest.h"
#include <rfta/refactoring/InlineTempRefactoring.h>
! #include <rfta/parser/PlainTextDocument.h>
! #include <rfta/parser/Source.h>
***************
*** 36,40 ****
InlineTempRefactoringTest::tearDown()
{
! document_.reset();
SourceBasedTestBase::tearDown();
}
--- 37,41 ----
InlineTempRefactoringTest::tearDown()
{
! sourceDoc_->getTextDocument().reset();
SourceBasedTestBase::tearDown();
}
***************
*** 46,52 ****
InlineTempRefactoringTest::applyRefactoring( const std::string &LocaleVariableName )
{
! document_.reset( new PlainTextDocument( source_ ) );
int selectionIndex = builder_->getStartIndex( "selection" );
! InlineTempRefactoring refactoring( *document_,
selectionIndex );
refactoring.apply( refactoring.areBracesSuggested() );
--- 47,55 ----
InlineTempRefactoringTest::applyRefactoring( const std::string &LocaleVariableName )
{
! TextDocumentPtr document(new PlainTextDocument( source_ ));
! sourceDoc_ = SourcePtr( new Source(document) );
int selectionIndex = builder_->getStartIndex( "selection" );
! InlineTempRefactoring refactoring( sourceDoc_,
! sourceMngMock_,
selectionIndex );
refactoring.apply( refactoring.areBracesSuggested() );
***************
*** 65,72 ****
bool failed = true;
RefactoringError expected(_cause);
! document_.reset( new PlainTextDocument( source_ ) );
int selectionIndex = builder_->getStartIndex( "selection" );
try {
! InlineTempRefactoring refactoring( *document_,
selectionIndex );
refactoring.apply( refactoring.areBracesSuggested() );
--- 68,79 ----
bool failed = true;
RefactoringError expected(_cause);
!
! TextDocumentPtr document(new PlainTextDocument( source_ ));
! sourceDoc_ = SourcePtr( new Source(document) );
!
int selectionIndex = builder_->getStartIndex( "selection" );
try {
! InlineTempRefactoring refactoring( sourceDoc_,
! sourceMngMock_,
selectionIndex );
refactoring.apply( refactoring.areBracesSuggested() );
***************
*** 137,141 ****
" return 4 * getQuantity();"
"}" );
! std::string actualSource( document_->getAllText() );
RFTA_ASSERT_EQUAL( expectedSource, actualSource );
}
--- 144,148 ----
" return 4 * getQuantity();"
"}" );
! std::string actualSource( sourceDoc_->getOriginalText() );
RFTA_ASSERT_EQUAL( expectedSource, actualSource );
}
***************
*** 160,164 ****
" return 4 * getQuantity();"
"}" );
! std::string actualSource( document_->getAllText() );
RFTA_ASSERT_EQUAL( expectedSource, actualSource );
}
--- 167,171 ----
" return 4 * getQuantity();"
"}" );
! std::string actualSource( sourceDoc_->getOriginalText() );
RFTA_ASSERT_EQUAL( expectedSource, actualSource );
}
***************
*** 241,245 ****
" return 4 * getQuantity();"
"}" );
! std::string actualSource( document_->getAllText() );
RFTA_ASSERT_EQUAL( expectedSource, actualSource );
}
--- 248,252 ----
" return 4 * getQuantity();"
"}" );
! std::string actualSource( sourceDoc_->getOriginalText() );
RFTA_ASSERT_EQUAL( expectedSource, actualSource );
}
***************
*** 265,269 ****
" return 4 * getQuantity();"
"}" );
! std::string actualSource( document_->getAllText() );
RFTA_ASSERT_EQUAL( expectedSource, actualSource );
}
--- 272,276 ----
" return 4 * getQuantity();"
"}" );
! std::string actualSource( sourceDoc_->getOriginalText() );
RFTA_ASSERT_EQUAL( expectedSource, actualSource );
}
***************
*** 289,293 ****
" return 4 * getQuantity();"
"}" );
! std::string actualSource( document_->getAllText() );
RFTA_ASSERT_EQUAL( expectedSource, actualSource );
}
--- 296,300 ----
" return 4 * getQuantity();"
"}" );
! std::string actualSource( sourceDoc_->getOriginalText() );
RFTA_ASSERT_EQUAL( expectedSource, actualSource );
}
***************
*** 313,317 ****
" return ( 4 + 3 ) * getQuantity();"
"}" );
! std::string actualSource( document_->getAllText() );
RFTA_ASSERT_EQUAL( expectedSource, actualSource );
}
--- 320,324 ----
" return ( 4 + 3 ) * getQuantity();"
"}" );
! std::string actualSource( sourceDoc_->getOriginalText() );
RFTA_ASSERT_EQUAL( expectedSource, actualSource );
}
***************
*** 337,341 ****
" return 4 * getQuantity();"
"}" );
! std::string actualSource( document_->getAllText() );
RFTA_ASSERT_EQUAL( expectedSource, actualSource );
}
--- 344,348 ----
" return 4 * getQuantity();"
"}" );
! std::string actualSource( sourceDoc_->getOriginalText() );
RFTA_ASSERT_EQUAL( expectedSource, actualSource );
}
Index: TransformListTest.h
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/TransformListTest.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** TransformListTest.h 20 Dec 2003 08:59:50 -0000 1.5
--- TransformListTest.h 13 Jan 2004 22:27:35 -0000 1.6
***************
*** 8,14 ****
#include "MockTextDocument.h"
#include "ReplaceTextTransform.h"
- #include <rfta/refactoring/TransformList.h>
#include "UnitTesting.h"
#include <boost/shared_ptr.hpp>
--- 8,14 ----
#include "MockTextDocument.h"
#include "ReplaceTextTransform.h"
#include "UnitTesting.h"
#include <boost/shared_ptr.hpp>
+ #include <rfta/refactoring/TransformList.h>
Index: ReplaceTextTransform.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/ReplaceTextTransform.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** ReplaceTextTransform.cpp 16 May 2003 19:55:02 -0000 1.6
--- ReplaceTextTransform.cpp 13 Jan 2004 22:27:35 -0000 1.7
***************
*** 6,10 ****
#include "stdafx.h"
#include "ReplaceTextTransform.h"
! #include <rfta/refactoring/TextDocument.h>
--- 6,11 ----
#include "stdafx.h"
#include "ReplaceTextTransform.h"
! #include <rfta/parser/TextDocument.h>
! #include <rfta/parser/Source.h>
***************
*** 35,38 ****
--- 36,51 ----
}
+ int
+ ReplaceTextTransform::apply( SourcePtr pSource ) const
+ {
+ Source& where = pSource->getSourceOrigin(range_);
+ SourceRange r = pSource->getRangeOrigin(range_);
+
+ int lengthDelta = text_.length() - range_.getLength();
+ where.getTextDocument()->replaceTextRange( r, text_ );
+
+ return lengthDelta;
+ }
+
void
Index: ReplaceTextTransform.h
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/ReplaceTextTransform.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** ReplaceTextTransform.h 16 Dec 2003 13:27:29 -0000 1.6
--- ReplaceTextTransform.h 13 Jan 2004 22:27:35 -0000 1.7
***************
*** 32,35 ****
--- 32,37 ----
int apply( TextDocument &document ) const;
+ int apply( SourcePtr pSource ) const;
+
void moveStartIndexBy( int delta );
Index: MockTextDocument.h
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/MockTextDocument.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** MockTextDocument.h 16 May 2003 19:55:02 -0000 1.7
--- MockTextDocument.h 13 Jan 2004 22:27:35 -0000 1.8
***************
*** 8,12 ****
#include <boost/utility.hpp>
#include <mock/Expectations.h>
! #include <rfta/refactoring/TextDocument.h>
#include <deque>
--- 8,12 ----
#include <boost/utility.hpp>
#include <mock/Expectations.h>
! #include <rfta/parser/TextDocument.h>
#include <deque>
Index: TransformList.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/TransformList.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** TransformList.cpp 20 Dec 2003 08:59:50 -0000 1.7
--- TransformList.cpp 13 Jan 2004 22:27:35 -0000 1.8
***************
*** 7,12 ****
#include "stdafx.h"
#include "ReplaceTextTransform.h"
- #include <rfta/refactoring/TransformList.h>
#include <rfta/parser/SourceRange.h>
#include <algorithm>
--- 7,12 ----
#include "stdafx.h"
#include "ReplaceTextTransform.h"
#include <rfta/parser/SourceRange.h>
+ #include <rfta/refactoring/TransformList.h>
#include <algorithm>
***************
*** 63,66 ****
--- 63,82 ----
}
+ void
+ TransformList::apply( SourcePtr pSource )
+ {
+ sortListByStartIndex();
+
+ int totalDelta = 0;
+ while ( !transforms_.empty() )
+ {
+ TransformPtr transform = transforms_.front();
+ transforms_.pop_front();
+
+ transform->moveStartIndexBy( totalDelta );
+ totalDelta += transform->apply( pSource );
+ }
+ }
+
struct TransformList::SortPredicate
Index: IndentLevelManager.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/IndentLevelManager.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** IndentLevelManager.cpp 18 Mar 2003 22:37:51 -0000 1.9
--- IndentLevelManager.cpp 13 Jan 2004 22:27:35 -0000 1.10
***************
*** 13,20 ****
! IndentLevelManager::IndentLevelManager( const std::string &originalSource,
int indentWidth )
! : originalSource_( originalSource )
! , indentWidth_( indentWidth )
{
}
--- 13,20 ----
! IndentLevelManager::IndentLevelManager( SourcePtr source,
int indentWidth )
! : indentWidth_( indentWidth )
! , source_( source )
{
}
***************
*** 123,128 ****
{
int indent = 0;
! while ( --pos >= 0 && originalSource_[pos] != '\n' )
++indent;
return indent;
}
--- 123,132 ----
{
int indent = 0;
! SourceRange r(pos,1);r.moveStartIndexBy(-1);
! while ( r.getStartIndex() >= 0 && source_->getOriginalText(r)[0] != '\n' )
! {
++indent;
+ r.moveStartIndexBy(-1);
+ }
return indent;
}
Index: SourceBasedTestBase.h
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/SourceBasedTestBase.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** SourceBasedTestBase.h 16 Dec 2003 13:32:45 -0000 1.9
--- SourceBasedTestBase.h 13 Jan 2004 22:27:35 -0000 1.10
***************
*** 11,17 ****
#include <rfta/parser/SourceASTNode.h>
#include <rfta/test/SourceBuilder.h>
#include <rfta/parser/ParseContext.h>
#include <rfta/parser/MaxLODMutator.h>
! #include <rfta/parser/NonSemanticBlanker.h>
namespace Refactoring
--- 11,19 ----
#include <rfta/parser/SourceASTNode.h>
#include <rfta/test/SourceBuilder.h>
+ #include <rfta/test/SourceManagerMock.h>
#include <rfta/parser/ParseContext.h>
#include <rfta/parser/MaxLODMutator.h>
! #include <rfta/parser/Preprocessor.h>
! #include <rfta/parser/PreprocessorContext.h>...
[truncated message content] |