|
From: <bl...@us...> - 2003-04-06 07:20:26
|
Update of /cvsroot/cpptool/rfta/src/pyrfta
In directory sc8-pr-cvs1:/tmp/cvs-serv8832/src/pyrfta
Modified Files:
ExposeStatements.cpp ExposeStatements2.cpp
ExposeStatements3.cpp ExposeVisitors.cpp Forwards.h pyrfta.cpp
pyrfta.dsp
Added Files:
ExposeExpressions.cpp ExposeExpressions2.cpp
Log Message:
* added working python binding for code model expression
--- NEW FILE: ExposeExpressions.cpp ---
#include "Forwards.h"
#include <boost/python.hpp>
#include <rfta/refactoring/CodeModelStatements.h>
#include <rfta/refactoring/CodeModelExpressions.h>
using namespace boost::python;
using namespace Refactoring::CodeModel;
void
exposeExpressions()
{
void (Expression::*mfAcceptExpressionVisitor)( ExpressionVisitor & ) = &Expression::accept;
class_<Expression, bases<Element>, boost::noncopyable >( "Expression", no_init )
.def( "accept", mfAcceptExpressionVisitor )
;
class_<GenericExpression, GenericExpressionPtr, bases<Expression>, boost::noncopyable >( "GenericExpression",
init< optional<std::string> >() )
.add_property( "valueText", &GenericExpression::getValueText, &GenericExpression::setValueText )
.def( "getValueChange", &GenericExpression::getValueChange )
;
class_<TypePart, TypePartPtr, bases<Element>, boost::noncopyable>( "TypePart",
init< optional<std::string> >() )
.add_property( "typeText", &TypePart::getTypeText )
;
const Declarator &(DeclaratorExpression::*mfGetDeclaratorAt)( int ) const = &DeclaratorExpression::getDeclaratorAt;
class_<DeclaratorExpression, DeclaratorExpressionPtr, bases<Expression>, boost::noncopyable>( "DeclaratorExpression",
init<TypePartPtr>() )
.add_property( "primaryType", &DeclaratorExpression::getPrimaryType, &DeclaratorExpression::setPrimaryType )
.add_property( "primaryTypeChange", &DeclaratorExpression::getPrimaryTypeChange )
.def( "getDeclaratorCount", &DeclaratorExpression::getDeclaratorCount )
// .def( "getDeclaratorAt", mfGetDeclaratorAt ) // return policity => need by ref
.def( "insertDeclaratorAt", &DeclaratorExpression::insertDeclaratorAt )
.def( "appendDeclarator", &DeclaratorExpression::appendDeclarator )
.def( "removeDeclaratorAt", &DeclaratorExpression::removeDeclaratorAt )
;
}
--- NEW FILE: ExposeExpressions2.cpp ---
#include "Forwards.h"
#include <boost/python.hpp>
#include <rfta/refactoring/CodeModelStatements.h>
#include <rfta/refactoring/CodeModelExpressions.h>
using namespace boost::python;
using namespace Refactoring::CodeModel;
void
exposeExpressions2()
{
// Not derived from Element at the time
class_<Declarator, DeclaratorPtr, bases<Element>, boost::noncopyable>( "Declarator",
init<std::string, std::string, std::string>() )
.def( init<std::string, std::string, std::string, ExpressionPtr>() )
.add_property( "type", &Declarator::getType, &Declarator::setType )
.add_property( "typeSuffix", &Declarator::getTypeSuffix, &Declarator::setTypeSuffix )
.add_property( "getName", &Declarator::getName, &Declarator::setName )
.def( "hasInitializer", &Declarator::hasInitializer )
.add_property( "initializer", &Declarator::getInitializer, &Declarator::setInitializer )
;
class_<ConstructorInitializerExpression, ConstructorInitializerExpressionPtr, bases<Expression>, boost::noncopyable>( "ConstructorInitializerExpression",
init<ExpressionPtr>() )
.add_property( "parameters", &ConstructorInitializerExpression::getParameters, &ConstructorInitializerExpression::setParameters )
;
class_<AssignInitializerExpression, AssignInitializerExpressionPtr, bases<Expression>, boost::noncopyable>( "AssignInitializerExpression",
init<ExpressionPtr>() )
.add_property( "value", &AssignInitializerExpression::getValue, &AssignInitializerExpression::setValue )
;
class_<DefaultConditionExpression, DefaultConditionExpressionPtr, bases<Expression>, boost::noncopyable>( "DefaultConditionExpression" )
;
class_<NullExpression, NullExpressionPtr, bases<Expression>, boost::noncopyable>( "NullExpression" )
;
}
Index: ExposeStatements.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/pyrfta/ExposeStatements.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ExposeStatements.cpp 5 Apr 2003 18:29:01 -0000 1.1
--- ExposeStatements.cpp 6 Apr 2003 07:20:23 -0000 1.2
***************
*** 2,6 ****
#include <boost/python.hpp>
#include <rfta/refactoring/CodeModelStatements.h>
- #include <rfta/refactoring/CodeModelExpressions.h>
using namespace boost::python;
--- 2,5 ----
Index: ExposeStatements2.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/pyrfta/ExposeStatements2.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ExposeStatements2.cpp 5 Apr 2003 18:29:01 -0000 1.1
--- ExposeStatements2.cpp 6 Apr 2003 07:20:23 -0000 1.2
***************
*** 2,6 ****
#include <boost/python.hpp>
#include <rfta/refactoring/CodeModelStatements.h>
- #include <rfta/refactoring/CodeModelExpressions.h>
using namespace boost::python;
--- 2,5 ----
Index: ExposeStatements3.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/pyrfta/ExposeStatements3.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ExposeStatements3.cpp 5 Apr 2003 18:29:01 -0000 1.1
--- ExposeStatements3.cpp 6 Apr 2003 07:20:23 -0000 1.2
***************
*** 2,6 ****
#include <boost/python.hpp>
#include <rfta/refactoring/CodeModelStatements.h>
- #include <rfta/refactoring/CodeModelExpressions.h>
using namespace boost::python;
--- 2,5 ----
Index: ExposeVisitors.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/pyrfta/ExposeVisitors.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ExposeVisitors.cpp 5 Apr 2003 18:29:01 -0000 1.1
--- ExposeVisitors.cpp 6 Apr 2003 07:20:23 -0000 1.2
***************
*** 109,143 ****
}
! void visit( AssignInitializerExpression &expression )
{
call_method<void>( self, "visitAssignInitializerExpression", object(expression) );
}
! void visit( ConstructorInitializerExpression &expression )
{
call_method<void>( self, "visitConstructorInitializerExpression", object(expression) );
}
! void visit( DeclaratorExpression &expression )
{
call_method<void>( self, "visitDeclaratorExpression", object(expression) );
}
! void visit( DefaultConditionExpression &expression )
{
call_method<void>( self, "visitDefaultConditionExpression", object(expression) );
}
! void visit( Expression &expression )
{
call_method<void>( self, "visitExpression", object(expression) );
}
! void visit( GenericExpression &expression )
{
call_method<void>( self, "visitGenericExpression", object(expression) );
}
! void visit( NullExpression &expression )
{
call_method<void>( self, "visitNullExpression", object(expression) );
--- 109,143 ----
}
! void visit( const AssignInitializerExpressionPtr &expression )
{
call_method<void>( self, "visitAssignInitializerExpression", object(expression) );
}
! void visit( const ConstructorInitializerExpressionPtr &expression )
{
call_method<void>( self, "visitConstructorInitializerExpression", object(expression) );
}
! void visit( const DeclaratorExpressionPtr &expression )
{
call_method<void>( self, "visitDeclaratorExpression", object(expression) );
}
! void visit( const DefaultConditionExpressionPtr &expression )
{
call_method<void>( self, "visitDefaultConditionExpression", object(expression) );
}
! void visit( const ExpressionPtr &expression )
{
call_method<void>( self, "visitExpression", object(expression) );
}
! void visit( const GenericExpressionPtr &expression )
{
call_method<void>( self, "visitGenericExpression", object(expression) );
}
! void visit( const NullExpressionPtr &expression )
{
call_method<void>( self, "visitNullExpression", object(expression) );
***************
*** 165,169 ****
;
! // class_<ExpressionVisitor, ExpressionVisitorWrap, boost::noncopyable>( "ExpressionVisitor", no_init )
;
--- 165,169 ----
;
! class_<ExpressionVisitor, ExpressionVisitorWrap, boost::noncopyable>( "ExpressionVisitor" )
;
Index: Forwards.h
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/pyrfta/Forwards.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Forwards.h 5 Apr 2003 18:29:01 -0000 1.1
--- Forwards.h 6 Apr 2003 07:20:23 -0000 1.2
***************
*** 8,11 ****
--- 8,13 ----
void exposeStatements3();
void exposeVisitors();
+ void exposeExpressions();
+ void exposeExpressions2();
Index: pyrfta.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/pyrfta/pyrfta.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** pyrfta.cpp 5 Apr 2003 18:29:01 -0000 1.4
--- pyrfta.cpp 6 Apr 2003 07:20:23 -0000 1.5
***************
*** 99,102 ****
--- 99,105 ----
exposeStatements3();
exposeVisitors();
+ exposeExpressions();
+ exposeExpressions2();
+
class_<B, boost::shared_ptr<B> >( "B", init<int>() )
.def( "accept", &B::accept )
Index: pyrfta.dsp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/pyrfta/pyrfta.dsp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** pyrfta.dsp 5 Apr 2003 18:29:01 -0000 1.3
--- pyrfta.dsp 6 Apr 2003 07:20:23 -0000 1.4
***************
*** 112,115 ****
--- 112,123 ----
# Begin Source File
+ SOURCE=.\ExposeExpressions.cpp
+ # End Source File
+ # Begin Source File
+
+ SOURCE=.\ExposeExpressions2.cpp
+ # End Source File
+ # Begin Source File
+
SOURCE=.\ExposeStatements.cpp
# End Source File
|