2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-21 17:12:22 +00:00
Files
python/module.h
Ullrich Köthe ec4bc0382f Tons of changes to improve error reporting
Added attributes function.__name__ and function.__signature__ and dir(function) feature


[SVN r8311]
2000-11-23 22:48:51 +00:00

52 lines
1.3 KiB
C++

// (C) Copyright David Abrahams 2000. 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.
//
// The author gratefully acknowleges the support of Dragon Systems, Inc., in
// producing this work.
#ifndef MODULE_DWA051000_H_
# define MODULE_DWA051000_H_
# include "pyconfig.h"
# include "pyptr.h"
# include "objects.h"
# include "functions.h"
namespace python {
class module_builder
{
public:
// Create a module. REQUIRES: only one module_builder is created per module.
module_builder(const char* name);
// Add elements to the module
void add(detail::function* x, const char* name);
void add(PyTypeObject* x, const char* name = 0);
void add(ref x, const char*name);
template <class Fn>
void def_raw(Fn fn, const char* name)
{
add(detail::new_raw_arguments_function(fn, name), name);
}
template <class Fn>
void def(Fn fn, const char* name)
{
add(detail::new_wrapped_function(fn, name), name);
}
static string name();
private:
PyObject* m_module;
static PyMethodDef initial_methods[1];
};
}
#endif