minor cleanups

This commit is contained in:
Wenzel Jakob 2015-10-26 20:10:24 +01:00
parent 42af9c295a
commit 54289302bc

View File

@ -32,7 +32,7 @@ template <typename T> struct arg_t;
/// Annotation for keyword arguments /// Annotation for keyword arguments
struct arg { struct arg {
arg(const char *name) : name(name) { } arg(const char *name) : name(name) { }
template <typename T> inline arg_t<T> operator=(const T &value); template <typename T> arg_t<T> operator=(const T &value);
const char *name; const char *name;
}; };
@ -41,13 +41,10 @@ template <typename T> struct arg_t : public arg {
arg_t(const char *name, const T &value) : arg(name), value(value) { } arg_t(const char *name, const T &value) : arg(name), value(value) { }
T value; T value;
}; };
template <typename T> inline arg_t<T> arg::operator=(const T &value) { return arg_t<T>(name, value); } template <typename T> arg_t<T> arg::operator=(const T &value) { return arg_t<T>(name, value); }
/// Annotation for methods /// Annotation for methods
struct is_method { struct is_method { PyObject *class_; is_method(object *o) : class_(o->ptr()) { } };
PyObject *class_;
is_method(object *o) : class_(o->ptr()) { }
};
/// Annotation for documentation /// Annotation for documentation
struct doc { const char *value; doc(const char *value) : value(value) { } }; struct doc { const char *value; doc(const char *value) : value(value) { } };
@ -67,9 +64,9 @@ private:
PyObject * (*impl) (function_entry *, PyObject *, PyObject *, PyObject *) = nullptr; PyObject * (*impl) (function_entry *, PyObject *, PyObject *, PyObject *) = nullptr;
PyMethodDef *def = nullptr; PyMethodDef *def = nullptr;
void *data = nullptr; void *data = nullptr;
void (*free) (void *ptr) = nullptr;
bool is_constructor = false, is_method = false; bool is_constructor = false, is_method = false;
short keywords = 0; short keywords = 0;
void (*free) (void *ptr) = nullptr;
return_value_policy policy = return_value_policy::automatic; return_value_policy policy = return_value_policy::automatic;
std::string signature; std::string signature;
PyObject *class_ = nullptr; PyObject *class_ = nullptr;