2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-25 18:32:24 +00:00

class_::enable_pickling() in publicized interface; tested with everything incl. VC6 and 7.0

[SVN r22254]
This commit is contained in:
Ralf W. Grosse-Kunstleve
2004-02-13 05:32:38 +00:00
parent 4a7686cd33
commit ae1584ff3c
9 changed files with 147 additions and 7 deletions

View File

@@ -415,6 +415,12 @@ class class_ : public objects::class_base
return *this;
}
self& enable_pickling()
{
this->base::enable_pickling_(false);
return *this;
}
self& staticmethod(char const* name)
{
this->make_method_static(name);

View File

@@ -32,7 +32,7 @@ struct BOOST_PYTHON_DECL class_base : python::api::object
// Implementation detail. Hiding this in the private section would
// require use of template friend declarations.
void enable_pickling(bool getstate_manages_dict);
void enable_pickling_(bool getstate_manages_dict);
protected:
void add_property(char const* name, object const& fget);

View File

@@ -59,7 +59,7 @@ namespace detail {
inaccessible* (*setstate_fn)(),
bool)
{
cl.enable_pickling(false);
cl.enable_pickling_(false);
cl.def("__getinitargs__", getinitargs_fn);
}
@@ -75,7 +75,7 @@ namespace detail {
void (*setstate_fn)(Tsetstate, Ttuple),
bool getstate_manages_dict)
{
cl.enable_pickling(getstate_manages_dict);
cl.enable_pickling_(getstate_manages_dict);
cl.def("__getstate__", getstate_fn);
cl.def("__setstate__", setstate_fn);
}
@@ -93,7 +93,7 @@ namespace detail {
void (*setstate_fn)(Tsetstate, Ttuple),
bool getstate_manages_dict)
{
cl.enable_pickling(getstate_manages_dict);
cl.enable_pickling_(getstate_manages_dict);
cl.def("__getinitargs__", getinitargs_fn);
cl.def("__getstate__", getstate_fn);
cl.def("__setstate__", setstate_fn);