Update of /cvsroot/cpptool/rfta/src/rfta
In directory sc8-pr-cvs1:/tmp/cvs-serv25603/src/rfta
Modified Files:
CodeRewriter.cpp CodeRewriter.h
Log Message:
* added support for inserting multiple variable declarations
Index: CodeRewriter.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/CodeRewriter.cpp,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -d -r1.37 -r1.38
*** CodeRewriter.cpp 6 Apr 2003 18:06:59 -0000 1.37
--- CodeRewriter.cpp 8 Apr 2003 08:06:36 -0000 1.38
***************
*** 634,658 ****
CodeRewriter::visit( const DeclaratorExpressionPtr &expression )
{
! if ( isInserting() )
{
! if ( expression->getDeclaratorCount() == 0 )
! return;
! beginInsertNewStatement();
! insertText( expression->getPrimaryType()->getTypeText() );
! for ( int index =0; index < expression->getDeclaratorCount(); ++index )
! {
! if ( index > 0 )
! insertText( ", " );
- DeclaratorPtr declarator = expression->getDeclaratorAt(index);
- insertText( declarator->getType()->getTypeText() );
- insertText( declarator->getName()->getIdentifier() );
- insertText( declarator->getTypeSuffix()->getTypeText() );
- }
! endInsertNewStatement();
! }
}
--- 634,662 ----
CodeRewriter::visit( const DeclaratorExpressionPtr &expression )
{
! if ( expression->getDeclaratorCount() == 0 )
! return;
!
! beginInsertNewStatement();
! insertText( expression->getPrimaryType()->getTypeText() );
!
! for ( int index =0; index < expression->getDeclaratorCount(); ++index )
{
! if ( index > 0 )
! insertText( ", " );
! DeclaratorPtr declarator = expression->getDeclaratorAt(index);
! processDeclarator( declarator );
! }
! endInsertNewStatement();
! }
! void
! CodeRewriter::processDeclarator( const DeclaratorPtr &declarator )
! {
! insertText( declarator->getType()->getTypeText() );
! insertText( declarator->getName()->getIdentifier() );
! insertText( declarator->getTypeSuffix()->getTypeText() );
}
Index: CodeRewriter.h
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rfta/CodeRewriter.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** CodeRewriter.h 6 Apr 2003 07:20:23 -0000 1.15
--- CodeRewriter.h 8 Apr 2003 08:06:37 -0000 1.16
***************
*** 160,163 ****
--- 160,165 ----
void setCurrentInsertionPos( int index );
+ void processDeclarator( const DeclaratorPtr &declarator );
+
private:
IndentLevelManager indentManager_;
|