diff --git a/include/boost/python/detail/module_base.hpp b/include/boost/python/detail/module_base.hpp new file mode 100644 index 00000000..e8a00ba6 --- /dev/null +++ b/include/boost/python/detail/module_base.hpp @@ -0,0 +1,44 @@ +// Copyright David Abrahams 2002. Permission to copy, use, +// modify, sell and distribute this software is granted provided this +// copyright notice appears in all copies. This software is provided +// "as is" without express or implied warranty, and with no claim as +// to its suitability for any purpose. +#ifndef MODULE_BASE_DWA2002227_HPP +# define MODULE_BASE_DWA2002227_HPP +# include +# include + +namespace boost { namespace python { namespace detail { + +class BOOST_PYTHON_DECL module_base +{ + public: + // Create a module. REQUIRES: only one module is created per module. + module_base(const char* name); + ~module_base(); + + // Add elements to the module + void setattr(const char* name, PyObject*); + void setattr(const char* name, ref const&); + void add(PyTypeObject* x); // just use the type's name + void add_type(ref); + + // Return a reference to the Python module object being built + inline ref object() const; + + private: + ref m_module; + static PyMethodDef initial_methods[1]; +}; + +// +// inline implementations +// +inline ref module_base::object() const +{ + return m_module; +} + +}}} // namespace boost::python::detail + +#endif // MODULE_BASE_DWA2002227_HPP diff --git a/include/boost/python/module.hpp b/include/boost/python/module.hpp index 11b0b6c7..7df183d5 100644 --- a/include/boost/python/module.hpp +++ b/include/boost/python/module.hpp @@ -8,36 +8,14 @@ # include # include -# include # include # include -# include # include +# include namespace boost { namespace python { -class BOOST_PYTHON_DECL module_base -{ - public: - // Create a module. REQUIRES: only one module is created per module. - module_base(const char* name); - ~module_base(); - - // Add elements to the module - void setattr(const char* name, PyObject*); - void setattr(const char* name, ref const&); - void add(PyTypeObject* x); // just use the type's name - void add_type(ref); - - // Return a reference to the Python module object being built - ref object() const; - - private: - ref m_module; - static PyMethodDef initial_methods[1]; -}; - -class module : public module_base +class module : public detail::module_base { public: module(const char* name) @@ -76,11 +54,6 @@ class module : public module_base // // inline implementations // -inline ref module_base::object() const -{ - return m_module; -} - inline module& module::setattr(const char* name, PyObject* x) { this->module_base::setattr(name, x); diff --git a/include/boost/python/object/class.hpp b/include/boost/python/object/class.hpp index 04f0e992..0d5210c7 100644 --- a/include/boost/python/object/class.hpp +++ b/include/boost/python/object/class.hpp @@ -6,7 +6,6 @@ #ifndef CLASS_DWA20011214_HPP # define CLASS_DWA20011214_HPP -# include # include # include # include diff --git a/src/module.cpp b/src/module.cpp index dbc81729..0291c9c1 100644 --- a/src/module.cpp +++ b/src/module.cpp @@ -6,9 +6,10 @@ // The author gratefully acknowleges the support of Dragon Systems, Inc., in // producing this work. -#include +#include +#include -namespace boost { namespace python { +namespace boost { namespace python { namespace detail { module_base::module_base(const char* name) : m_module( @@ -46,4 +47,4 @@ void module_base::add_type(ref x) PyMethodDef module_base::initial_methods[] = { { 0, 0, 0, 0 } }; -}} // namespace boost::python +}}} // namespace boost::python::detail diff --git a/src/object/class.cpp b/src/object/class.cpp index 8186f9be..b9deb98f 100644 --- a/src/object/class.cpp +++ b/src/object/class.cpp @@ -3,8 +3,7 @@ // copyright notice appears in all copies. This software is provided // "as is" without express or implied warranty, and with no claim as // to its suitability for any purpose. -#include -#include +#include #include #include #include