|
From: <bl...@us...> - 2003-03-06 22:54:23
|
Update of /cvsroot/cpptool/rfta/include/rfta/refactoring
In directory sc8-pr-cvs1:/tmp/cvs-serv6573/include/rfta/refactoring
Modified Files:
CodeModelElement.h CodeModelExpressions.h
CodeModelStatements.h
Log Message:
* new statement insertion in compound generate correct text change
Index: CodeModelElement.h
===================================================================
RCS file: /cvsroot/cpptool/rfta/include/rfta/refactoring/CodeModelElement.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** CodeModelElement.h 25 Dec 2002 12:13:57 -0000 1.3
--- CodeModelElement.h 6 Mar 2003 22:18:42 -0000 1.4
***************
*** 8,11 ****
--- 8,12 ----
#include <rfta/refactoring/Config.h>
#include <rfta/parser/SourceRange.h>
+ #include <rfta/parser/ASTNodeForward.h>
namespace Refactoring { namespace CodeModel
***************
*** 13,16 ****
--- 14,45 ----
+ class ElementText
+ {
+ public:
+ ElementText();
+ explicit ElementText( const ASTNodePtr &node );
+ explicit ElementText( const std::string &text );
+
+ void setText( const std::string &newText );
+
+ const std::string getOriginalText() const;
+
+ const SourceRange getOriginalSourceRange() const;
+
+ bool hasOriginalSourceRange() const;
+
+ bool isOriginalText() const;
+
+ bool isModifiedText() const;
+
+ bool isNewText() const;
+
+ private:
+ ASTNodePtr node_;
+ std::string newText_;
+ bool hasNewText_;
+ };
+
+
/// This class represents
class Element
***************
*** 21,25 ****
virtual ~Element();
! void setSourceRange( const SourceRange &sourceRange );
void unsetSourceRange();
--- 50,65 ----
virtual ~Element();
! void setOriginalText( const ElementText &text );
! void setText( const std::string &text );
!
! const ElementText &getText() const;
!
! private:
! virtual void originalTextSet();
!
! ElementText text_;
!
! #if 0
! void setOriginalText( const SourceRange &sourceRange );
void unsetSourceRange();
***************
*** 36,39 ****
--- 76,80 ----
SourceRange sourceRange_;
bool wasReplaced_;
+ #endif
};
Index: CodeModelExpressions.h
===================================================================
RCS file: /cvsroot/cpptool/rfta/include/rfta/refactoring/CodeModelExpressions.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** CodeModelExpressions.h 25 Dec 2002 12:13:57 -0000 1.4
--- CodeModelExpressions.h 6 Mar 2003 22:18:42 -0000 1.5
***************
*** 29,36 ****
{
public:
! GenericExpression( const std::string &value );
! const std::string getValue() const;
! void setValue( const std::string &value );
// overridden from Expression
--- 29,37 ----
{
public:
! GenericExpression( const ElementText &value );
! // GenericExpression( const std::string &value );
! // const std::string getValue() const;
! // void setValue( const std::string &value );
// overridden from Expression
***************
*** 38,42 ****
private:
! std::string value_;
};
--- 39,43 ----
private:
! // std::string value_;
};
Index: CodeModelStatements.h
===================================================================
RCS file: /cvsroot/cpptool/rfta/include/rfta/refactoring/CodeModelStatements.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** CodeModelStatements.h 22 Dec 2002 15:47:00 -0000 1.2
--- CodeModelStatements.h 6 Mar 2003 22:18:42 -0000 1.3
***************
*** 9,12 ****
--- 9,13 ----
#include <rfta/refactoring/CodeModelForward.h>
#include <rfta/refactoring/CodeModelElement.h>
+ //#include <rfta/parser/SourceRange.h>
#include <string>
#include <vector>
***************
*** 16,19 ****
--- 17,47 ----
+ class Change
+ {
+ public:
+ enum ChangeType
+ {
+ added = 0,
+ replaced,
+ removed,
+ unmodified
+ };
+
+ Change()
+ {
+ }
+
+ Change( ChangeType type,
+ const SourceRange &oldRange = SourceRange() )
+ : type_( type )
+ , oldRange_( oldRange )
+ {
+ }
+
+ ChangeType type_;
+ SourceRange oldRange_;
+ };
+
+
class Statement : public Element
{
***************
*** 28,31 ****
--- 56,71 ----
{
public:
+ struct StatementChange : public Change
+ {
+ StatementChange( ChangeType type,
+ const StatementPtr &statement )
+ : Change( type )
+ , statement_( statement )
+ {
+ }
+
+ StatementPtr statement_;
+ };
+
void removeStatementAt( int index );
***************
*** 41,44 ****
--- 81,88 ----
StatementPtr getStatementAt( int index ) const;
+
+ int getChangeCount() const;
+
+ StatementChange getChangeAt( int changeIndex ) const;
// overriden from Statement
***************
*** 46,50 ****
private:
! typedef std::vector<StatementPtr> Statements;
Statements statements_;
};
--- 90,99 ----
private:
! void originalTextSet();
!
! int getActualIndex( int index ) const;
!
! private:
! typedef std::vector<StatementChange> Statements;
Statements statements_;
};
|