summaryrefslogtreecommitdiff
path: root/src/op.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-10-31 00:55:56 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-10-31 00:55:56 -0400
commita2cb549b1dff9024e3f700203e424e496b25fd91 (patch)
tree1c03e9eb6f649a1446021dfb2a5d93a697f81feb /src/op.h
parent349fc5d175bc5c4acbc478b4d78c12dc507c4f58 (diff)
parenta88a4c55b2b11d58d3b9e49bf785be42afe63510 (diff)
downloadledger-a2cb549b1dff9024e3f700203e424e496b25fd91.tar.gz
ledger-a2cb549b1dff9024e3f700203e424e496b25fd91.tar.bz2
ledger-a2cb549b1dff9024e3f700203e424e496b25fd91.zip
Merge branch 'next'
Diffstat (limited to 'src/op.h')
-rw-r--r--src/op.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/op.h b/src/op.h
index c79ed3f6..8d474b80 100644
--- a/src/op.h
+++ b/src/op.h
@@ -192,6 +192,7 @@ public:
}
ptr_op_t& left() {
+ assert(kind > TERMINALS || kind == IDENT);
return left_;
}
const ptr_op_t& left() const {
@@ -289,6 +290,33 @@ public:
static ptr_op_t wrap_value(const value_t& val);
static ptr_op_t wrap_functor(const function_t& fobj);
+
+#if defined(HAVE_BOOST_SERIALIZATION)
+private:
+ /** Serialization. */
+
+ friend class boost::serialization::access;
+
+ template<class Archive>
+ void serialize(Archive & ar, const unsigned int /* version */) {
+ ar & refc;
+ ar & kind;
+ if (Archive::is_loading::value || ! left_ || left_->kind != FUNCTION) {
+ ar & left_;
+ } else {
+ ptr_op_t temp_op;
+ ar & temp_op;
+ }
+ if (Archive::is_loading::value || kind == VALUE || kind == IDENT ||
+ (kind > UNARY_OPERATORS &&
+ (! has_right() || ! right()->is_function()))) {
+ ar & data;
+ } else {
+ variant<ptr_op_t, value_t, string, function_t> temp_data;
+ ar & temp_data;
+ }
+ }
+#endif // HAVE_BOOST_SERIALIZATION
};
inline expr_t::ptr_op_t