Inserting Code

| Inserting Code

You can insert arbitrary code in the generated cpps, just use the functions `declaration_code` and `module_code`. This will insert the given string in the respective sections. Example:

`

        ##file A.pyste
        Class("A", "A.h")
        declaration_code("/* declaration_code() comes here */\n")
        module_code("/* module_code() comes here */\n")

`

Will generate:

`

        // Includes ====================================================================
        #include <boost/python.hpp>

        // Using =======================================================================
        using namespace boost::python;

        // Declarations ================================================================

        /* declaration_code() comes here */

        // Module ======================================================================
        BOOST_PYTHON_MODULE(A)
        {
            class_< A >("A", init<  >())
                .def(init< const A& >())
            ;

        /* module_code() comes here */
        }

`

Copyright © 2003 Bruno da Silva de Oliveira
Copyright © 2002-2003 Joel de Guzman
Permission to copy, use, modify, sell and distribute this document is granted provided this copyright notice appears in all copies. This document is provided "as is" without express or implied warranty, and with no claim as to its suitability for any purpose.