|
From: Baptiste L. <bl...@us...> - 2004-08-07 20:15:38
|
Update of /cvsroot/cpptool/CppParser/src/pycppparser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16909/src/pycppparser Modified Files: main.cpp pycppparser.vcproj pyenumerator.h Added Files: nodeprocessor.cpp Log Message: * fixed many small issues revealed by python unit tests. * added NodeProcessor binding --- NEW FILE: nodeprocessor.cpp --- // Boost Includes ============================================================== #include <boost/python.hpp> #include <boost/cstdint.hpp> // Includes ==================================================================== #include <rfta/cppparser/nodeprocessor.h> #include "pyenumerator.h" // Using ======================================================================= using namespace boost::python; // Declarations ================================================================ namespace py { }// namespace py // Module ====================================================================== void Export_cppparser_NodeProcessor() { enum_<NodeSpecificationTypes>( "NodeSpecificationTypes" ) .value( "NONE", nsNone ) .value( "HAS_BRACE_VALUE", nsHasBraceValue ) .value( "HAS_BRACE_VALUES", nsHasBraceValues ) .value( "HAS_BRACE_NODE_VALUE", nsHasBraceNodeValue ) .value( "HAS_COLON_VALUE", nsHasColonValue ) .value( "HAS_COLON_NODE_VALUE", nsHasColonNodeValue ) .value( "HAS_COLON_ENUMERATION_VALUE", nsHasColonEnumerationValue ) .value( "HAS_COLON_STRING_LIST_VALUE", nsHasColonStringListValue ) .value( "HAS_CHILDREN", nsHasChildren ) ; class_< NodeSpecification >( "NodeSpecification", init<const std::string & ,const std::string & ,NodeSpecification::Features>() ) .add_property( "inputName", make_function( &NodeSpecification::inputName, return_value_policy<copy_const_reference>() ) ) .add_property( "specificationName", make_function( &NodeSpecification::specificationName, return_value_policy<copy_const_reference>() ) ) .def( "addEnumerationValue", &NodeSpecification::addEnumerationValue ) .def( "addChild", &NodeSpecification::addChild ) .def( "addMandatoryChild", &NodeSpecification::addMandatoryChild ) ; class_< Node, boost::noncopyable >( "ValueNode", no_init ) .add_property( "column", &Node::column ) .add_property( "line", &Node::line ) .add_property( "inputName", make_function( &Node::inputName, return_value_policy<copy_const_reference>() ) ) .add_property( "specificationName", make_function( &Node::specificationName, return_value_policy<copy_const_reference>() ) ) .def( "braceValue", &Node::braceValue ) .def( "braceValues", &Node::braceValues ) .def( "braceNodeValue", &Node::braceNodeValue ) .def( "braceNodeValues", &Node::braceNodeValues ) .def( "colonValue", &Node::colonValue ) .def( "colonValues", &Node::colonValues ) .def( "colonNodeValue", &Node::colonNodeValue ) .def( "colonNodeValues", &Node::colonNodeValues ) .def( "hasChild", &Node::hasChild ) .def( "child", &Node::child ) .def( "children", &Node::children ) ; EnumeratorDeclarator< Node::NodeEnumerator >( "ValueNodeEnumerator" ); EnumeratorDeclarator< Node::ValueEnumerator >( "ValueNodeValueEnumerator" ); class_< NodeProcessor, boost::noncopyable >( "ValueNodeProcessor", init<>() ) .def( "recordSpecification", &NodeProcessor::recordSpecfication ) .def( "setRootSpecification", &NodeProcessor::setRootSpecification ) .def( "checkSpecifications", &NodeProcessor::checkSpecifications ) .def( "parseNodeTree", &NodeProcessor::parseNodeTree ) ; register_ptr_to_python< NodeSpecificationPtr >(); register_ptr_to_python< NodePtr >(); } Index: main.cpp =================================================================== RCS file: /cvsroot/cpptool/CppParser/src/pycppparser/main.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** main.cpp 7 Aug 2004 15:52:24 -0000 1.1 --- main.cpp 7 Aug 2004 20:15:28 -0000 1.2 *************** *** 8,11 **** --- 8,12 ---- void Export_cppparser_ConstString(); void Export_cppparser_CppParserFacade(); + void Export_cppparser_NodeProcessor(); // Module ====================================================================== *************** *** 17,20 **** --- 18,22 ---- Export_cppparser_ConstString(); Export_cppparser_CppParserFacade(); + Export_cppparser_NodeProcessor(); } Index: pycppparser.vcproj =================================================================== RCS file: /cvsroot/cpptool/CppParser/src/pycppparser/pycppparser.vcproj,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pycppparser.vcproj 7 Aug 2004 15:52:24 -0000 1.1 --- pycppparser.vcproj 7 Aug 2004 20:15:28 -0000 1.2 *************** *** 173,176 **** --- 173,179 ---- </File> <File + RelativePath=".\nodeprocessor.cpp"> + </File> + <File RelativePath=".\pyenumerator.h"> </File> Index: pyenumerator.h =================================================================== RCS file: /cvsroot/cpptool/CppParser/src/pycppparser/pyenumerator.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pyenumerator.h 7 Aug 2004 15:52:24 -0000 1.1 --- pyenumerator.h 7 Aug 2004 20:15:28 -0000 1.2 *************** *** 22,29 **** if ( !iterator.hasNext() ) boost::python::objects::stop_iteration_error(); // in object/iterator_core.hpp ! return iterator.nextPtr(); } ! static IteratorType iter( const IteratorType &iterator ) { return iterator; --- 22,29 ---- if ( !iterator.hasNext() ) boost::python::objects::stop_iteration_error(); // in object/iterator_core.hpp ! return iterator.next(); } ! static EnumeratorType iter( const EnumeratorType &iterator ) { return iterator; |