diff options
author | John Wiegley <johnw@newartisans.com> | 2009-10-30 18:06:37 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-10-30 18:06:37 -0400 |
commit | a757b19f51ac7aa120e6829b573187b1ff36301a (patch) | |
tree | 5e6d4ef278f3f9915713f958979a4c35a53378fb /src/annotate.h | |
parent | 1b8811f997568d8aede86197a36fc65586996494 (diff) | |
download | fork-ledger-a757b19f51ac7aa120e6829b573187b1ff36301a.tar.gz fork-ledger-a757b19f51ac7aa120e6829b573187b1ff36301a.tar.bz2 fork-ledger-a757b19f51ac7aa120e6829b573187b1ff36301a.zip |
Added serialization methods for most type
This allows journal_t objects to be completed serialized to disk and
deserialized.
Diffstat (limited to 'src/annotate.h')
-rw-r--r-- | src/annotate.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/annotate.h b/src/annotate.h index d98f7ef6..17c8a637 100644 --- a/src/annotate.h +++ b/src/annotate.h @@ -98,6 +98,21 @@ struct annotation_t : public supports_flags<>, assert(*this); return true; } + +#if defined(HAVE_BOOST_SERIALIZATION) +private: + /** Serialization. */ + + friend class boost::serialization::access; + + template<class Archive> + void serialize(Archive & ar, const unsigned int /* version */) { + ar & boost::serialization::base_object<supports_flags<> >(*this); + ar & price; + ar & date; + ar & tag; + } +#endif // HAVE_BOOST_SERIALIZATION }; struct keep_details_t @@ -136,6 +151,21 @@ struct keep_details_t return keep_price || keep_date || keep_tag; } bool keep_any(const commodity_t& comm) const; + +#if defined(HAVE_BOOST_SERIALIZATION) +private: + /** Serialization. */ + + friend class boost::serialization::access; + + template<class Archive> + void serialize(Archive & ar, const unsigned int /* version */) { + ar & keep_price; + ar & keep_date; + ar & keep_tag; + ar & only_actuals; + } +#endif // HAVE_BOOST_SERIALIZATION }; inline std::ostream& operator<<(std::ostream& out, @@ -183,6 +213,22 @@ public: virtual commodity_t& strip_annotations(const keep_details_t& what_to_keep); virtual void write_annotations(std::ostream& out) const; + +#if defined(HAVE_BOOST_SERIALIZATION) +private: + explicit annotated_commodity_t() : ptr(NULL) {} + + /** Serialization. */ + + friend class boost::serialization::access; + + template<class Archive> + void serialize(Archive & ar, const unsigned int /* version */) { + ar & boost::serialization::base_object<commodity_t>(*this); + ar & ptr; + ar & details; + } +#endif // HAVE_BOOST_SERIALIZATION }; inline annotated_commodity_t& |