Update of /cvsroot/cpptool/rfta/include/rfta/refactoring
In directory sc8-pr-cvs1:/tmp/cvs-serv25283/include/rfta/refactoring
Modified Files:
CodeModelElement.h CodeModelExpressions.h
CodeModelStatements.h
Log Message:
* refactored so that GenericExpression don't rely on ElementText::setText().
Index: CodeModelElement.h
===================================================================
RCS file: /cvsroot/cpptool/rfta/include/rfta/refactoring/CodeModelElement.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** CodeModelElement.h 12 Mar 2003 07:46:09 -0000 1.5
--- CodeModelElement.h 16 Mar 2003 13:15:06 -0000 1.6
***************
*** 21,25 ****
explicit ElementText( const std::string &text );
! void setText( const std::string &newText );
const std::string getOriginalText() const;
--- 21,25 ----
explicit ElementText( const std::string &text );
! // void setText( const std::string &newText );
const std::string getOriginalText() const;
***************
*** 29,38 ****
bool hasOriginalSourceRange() const;
- bool isOriginalText() const;
-
- bool isModifiedText() const;
-
- bool isNewText() const;
-
private:
ASTNodePtr node_;
--- 29,32 ----
***************
*** 42,45 ****
--- 36,87 ----
+ class Change
+ {
+ public:
+ enum ChangeType
+ {
+ added = 0,
+ replaced,
+ removed,
+ unmodified
+ };
+
+ Change()
+ : type_( unmodified )
+ {
+ }
+
+ Change( ChangeType type,
+ const SourceRange &oldRange = SourceRange() )
+ : type_( type )
+ , oldRange_( oldRange )
+ {
+ }
+
+ bool wasReplaced() const
+ {
+ return type_ == replaced;
+ }
+
+ bool wasRemoved() const
+ {
+ return type_ == removed;
+ }
+
+ bool wasAdded() const
+ {
+ return type_ == added;
+ }
+
+ bool isUnmodified() const
+ {
+ return type_ == unmodified;
+ }
+
+ ChangeType type_;
+ SourceRange oldRange_;
+ };
+
+
/// This class represents
class Element
***************
*** 51,55 ****
void setOriginalText( const ElementText &text );
! void setText( const std::string &text );
const ElementText &getText() const;
--- 93,97 ----
void setOriginalText( const ElementText &text );
! // void setText( const std::string &text );
const ElementText &getText() const;
Index: CodeModelExpressions.h
===================================================================
RCS file: /cvsroot/cpptool/rfta/include/rfta/refactoring/CodeModelExpressions.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** CodeModelExpressions.h 12 Mar 2003 07:46:09 -0000 1.6
--- CodeModelExpressions.h 16 Mar 2003 13:15:07 -0000 1.7
***************
*** 29,43 ****
{
public:
! GenericExpression( const ElementText &value );
! GenericExpression( const std::string &value );
! // const std::string getValue() const;
! // void setValue( const std::string &value );
// overridden from Expression
void accept( ExpressionVisitor &visitor );
private:
! // std::string value_;
};
--- 29,49 ----
{
public:
! GenericExpression( const std::string &value = "" );
! const std::string getTextValue() const;
!
! void setValueText( const std::string &value );
!
! Change getValueChange() const;
// overridden from Expression
void accept( ExpressionVisitor &visitor );
+ private: // overridden from CodeElement
+ void originalTextSet();
+
private:
! std::string value_;
! Change valueChange_;
};
Index: CodeModelStatements.h
===================================================================
RCS file: /cvsroot/cpptool/rfta/include/rfta/refactoring/CodeModelStatements.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** CodeModelStatements.h 16 Mar 2003 11:49:48 -0000 1.7
--- CodeModelStatements.h 16 Mar 2003 13:15:07 -0000 1.8
***************
*** 17,68 ****
- class Change
- {
- public:
- enum ChangeType
- {
- added = 0,
- replaced,
- removed,
- unmodified
- };
-
- Change()
- : type_( unmodified )
- {
- }
-
- Change( ChangeType type,
- const SourceRange &oldRange = SourceRange() )
- : type_( type )
- , oldRange_( oldRange )
- {
- }
-
- bool wasReplaced() const
- {
- return type_ == replaced;
- }
-
- bool wasRemoved() const
- {
- return type_ == removed;
- }
-
- bool wasAdded() const
- {
- return type_ == added;
- }
-
- bool isUnmodified() const
- {
- return type_ == unmodified;
- }
-
- ChangeType type_;
- SourceRange oldRange_;
- };
-
-
class Statement : public Element
{
--- 17,20 ----
|