* indentations + whitespace cleanup
This commit is contained in:
parent
8457e39efe
commit
56c6edab04
285 changed files with 6068 additions and 6223 deletions
|
|
@ -29,32 +29,31 @@
|
|||
#include <sstream>
|
||||
/** Implements pickle support for eoPersistent derivatives */
|
||||
|
||||
|
||||
template <class T>
|
||||
struct T_pickle_suite : boost::python::pickle_suite
|
||||
{
|
||||
static
|
||||
std::string print_to_string(const T& t)
|
||||
{
|
||||
std::ostringstream os;
|
||||
t.printOn(os);
|
||||
os << std::ends;
|
||||
return os.str();
|
||||
std::ostringstream os;
|
||||
t.printOn(os);
|
||||
os << std::ends;
|
||||
return os.str();
|
||||
}
|
||||
|
||||
static
|
||||
boost::python::tuple getstate(const T& t)
|
||||
{
|
||||
std::string s = print_to_string(t);
|
||||
return boost::python::make_tuple( boost::python::str(s));
|
||||
std::string s = print_to_string(t);
|
||||
return boost::python::make_tuple( boost::python::str(s));
|
||||
}
|
||||
|
||||
static
|
||||
void setstate(T& t, boost::python::tuple pickled)
|
||||
{
|
||||
std::string s = boost::python::extract<std::string>(pickled[0]);
|
||||
std::istringstream is(s);
|
||||
t.readFrom(is);
|
||||
std::string s = boost::python::extract<std::string>(pickled[0]);
|
||||
std::istringstream is(s);
|
||||
t.readFrom(is);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -65,7 +64,7 @@ template <class Persistent, class X1, class X2, class X3>
|
|||
boost::python::class_<Persistent, X1, X2, X3>& pickle(boost::python::class_<Persistent, X1, X2, X3>& c)
|
||||
{
|
||||
return c.def_pickle(T_pickle_suite<Persistent>())
|
||||
.def("__str__", T_pickle_suite<Persistent>::print_to_string);
|
||||
.def("__str__", T_pickle_suite<Persistent>::print_to_string);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Reference in a new issue