diff options
author | Alexis Hildebrandt <afh@surryhill.net> | 2015-02-15 08:39:58 +0100 |
---|---|---|
committer | Alexis Hildebrandt <afh@surryhill.net> | 2015-02-18 21:50:34 +0100 |
commit | d5e1308d07e9a7d9da33aed6f7f617b2209cba40 (patch) | |
tree | ef98ba33a55d64aee61d29a3f25232d20dbb2d20 | |
parent | f59abd4c765b08cbd5f18ec851b1d78a766a1c93 (diff) | |
download | fork-ledger-d5e1308d07e9a7d9da33aed6f7f617b2209cba40.tar.gz fork-ledger-d5e1308d07e9a7d9da33aed6f7f617b2209cba40.tar.bz2 fork-ledger-d5e1308d07e9a7d9da33aed6f7f617b2209cba40.zip |
[ledger] Remove --cache option
and all boost serialisation related code.
-rw-r--r-- | doc/ledger.1 | 1 | ||||
-rw-r--r-- | doc/ledger3.texi | 3 | ||||
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/account.h | 20 | ||||
-rw-r--r-- | src/amount.cc | 79 | ||||
-rw-r--r-- | src/amount.h | 10 | ||||
-rw-r--r-- | src/annotate.h | 48 | ||||
-rw-r--r-- | src/archive.cc | 295 | ||||
-rw-r--r-- | src/archive.h | 92 | ||||
-rw-r--r-- | src/balance.h | 12 | ||||
-rw-r--r-- | src/commodity.h | 61 | ||||
-rw-r--r-- | src/expr.h | 13 | ||||
-rw-r--r-- | src/exprbase.h | 15 | ||||
-rw-r--r-- | src/flags.h | 22 | ||||
-rw-r--r-- | src/item.h | 36 | ||||
-rw-r--r-- | src/journal.h | 35 | ||||
-rw-r--r-- | src/mask.h | 19 | ||||
-rw-r--r-- | src/op.h | 27 | ||||
-rw-r--r-- | src/pool.h | 20 | ||||
-rw-r--r-- | src/post.h | 18 | ||||
-rw-r--r-- | src/predicate.h | 13 | ||||
-rw-r--r-- | src/scope.h | 99 | ||||
-rw-r--r-- | src/session.cc | 20 | ||||
-rw-r--r-- | src/session.h | 2 | ||||
-rw-r--r-- | src/system.hh.in | 79 | ||||
-rw-r--r-- | src/times.h | 86 | ||||
-rw-r--r-- | src/value.h | 28 | ||||
-rw-r--r-- | src/xact.h | 72 |
28 files changed, 1 insertions, 1226 deletions
diff --git a/doc/ledger.1 b/doc/ledger.1 index c22b9018..19b4db31 100644 --- a/doc/ledger.1 +++ b/doc/ledger.1 @@ -401,7 +401,6 @@ Specify the format to use for the report. .It Fl \-by-payee Pq Fl P Group postings in the register report by common payee names. -.\".It Fl \-cache Ar FILE .It Fl \-check-payees Enable strict and pedantic checking for payees as well as accounts, commodities and tags. diff --git a/doc/ledger3.texi b/doc/ledger3.texi index 08d0d2db..651253fd 100644 --- a/doc/ledger3.texi +++ b/doc/ledger3.texi @@ -5867,9 +5867,6 @@ sessions with multiple reports per session. @ftable @option -@item --cache @var{FIXME} -@value{FIXME:UNDOCUMENTED} - @item --check-payees Enable strict and pedantic checking for payees as well as accounts, commodities and tags. This only works in conjunction with diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index dc8b60fc..a368d378 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -28,7 +28,6 @@ set(LEDGER_SOURCES textual.cc temps.cc journal.cc - archive.cc account.cc xact.cc post.cc @@ -80,7 +79,6 @@ set(LEDGER_INCLUDES account.h amount.h annotate.h - archive.h balance.h chain.h commodity.h diff --git a/src/account.h b/src/account.h index 76e839eb..7fae93e1 100644 --- a/src/account.h +++ b/src/account.h @@ -289,26 +289,6 @@ public: } bool children_with_xdata() const; std::size_t children_with_flags(xdata_t::flags_t flags) const; - -#if 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 & boost::serialization::base_object<scope_t>(*this); - ar & parent; - ar & name; - ar & note; - ar & depth; - ar & accounts; - ar & posts; - ar & _fullname; - } -#endif // HAVE_BOOST_SERIALIZATION }; std::ostream& operator<<(std::ostream& out, const account_t& account); diff --git a/src/amount.cc b/src/amount.cc index 6ddcdb4f..b0898bfb 100644 --- a/src/amount.cc +++ b/src/amount.cc @@ -93,20 +93,6 @@ struct amount_t::bigint_t : public supports_flags<> } return true; } - -#if HAVE_BOOST_SERIALIZATION -private: - 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 & val; - ar & prec; - ar & refc; - } -#endif // HAVE_BOOST_SERIALIZATION }; bool amount_t::is_initialized = false; @@ -1331,69 +1317,4 @@ void put_amount(property_tree::ptree& st, const amount_t& amt, st.put("quantity", amt.quantity_string()); } -#if HAVE_BOOST_SERIALIZATION - -template<class Archive> -void amount_t::serialize(Archive& ar, const unsigned int /* version */) -{ - ar & is_initialized; - ar & quantity; - ar & commodity_; -} - -#endif // HAVE_BOOST_SERIALIZATION - } // namespace ledger - -#if HAVE_BOOST_SERIALIZATION -namespace boost { -namespace serialization { - -template <class Archive> -void serialize(Archive& ar, MP_INT& mpz, const unsigned int /* version */) -{ - ar & mpz._mp_alloc; - ar & mpz._mp_size; - ar & mpz._mp_d; -} - -template <class Archive> -void serialize(Archive& ar, MP_RAT& mpq, const unsigned int /* version */) -{ - ar & mpq._mp_num; - ar & mpq._mp_den; -} - -template <class Archive> -void serialize(Archive& ar, long unsigned int& integer, - const unsigned int /* version */) -{ - ar & make_binary_object(&integer, sizeof(long unsigned int)); -} - -} // namespace serialization -} // namespace boost - -BOOST_CLASS_EXPORT(ledger::annotated_commodity_t) - -template void boost::serialization::serialize(boost::archive::binary_iarchive&, - MP_INT&, const unsigned int); -template void boost::serialization::serialize(boost::archive::binary_oarchive&, - MP_INT&, const unsigned int); -template void boost::serialization::serialize(boost::archive::binary_iarchive&, - MP_RAT&, const unsigned int); -template void boost::serialization::serialize(boost::archive::binary_oarchive&, - MP_RAT&, const unsigned int); -template void boost::serialization::serialize(boost::archive::binary_iarchive&, - long unsigned int&, - const unsigned int); -template void boost::serialization::serialize(boost::archive::binary_oarchive&, - long unsigned int&, - const unsigned int); - -template void ledger::amount_t::serialize(boost::archive::binary_iarchive&, - const unsigned int); -template void ledger::amount_t::serialize(boost::archive::binary_oarchive&, - const unsigned int); - -#endif // HAVE_BOOST_SERIALIZATION diff --git a/src/amount.h b/src/amount.h index ea5cadd6..4c959177 100644 --- a/src/amount.h +++ b/src/amount.h @@ -743,16 +743,6 @@ public: bool valid() const; -#if HAVE_BOOST_SERIALIZATION -private: - /** Serialization. */ - - friend class boost::serialization::access; - - template<class Archive> - void serialize(Archive& ar, const unsigned int /* version */); -#endif // HAVE_BOOST_SERIALIZATION - /*@}*/ }; diff --git a/src/annotate.h b/src/annotate.h index c0fbcd3d..c2b2ec9d 100644 --- a/src/annotate.h +++ b/src/annotate.h @@ -107,21 +107,6 @@ struct annotation_t : public supports_flags<>, assert(*this); return true; } - -#if 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 }; void put_annotation(property_tree::ptree& pt, const annotation_t& details); @@ -162,21 +147,6 @@ struct keep_details_t return keep_price || keep_date || keep_tag; } bool keep_any(const commodity_t& comm) const; - -#if 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, @@ -250,24 +220,6 @@ public: virtual void write_annotations(std::ostream& out, bool no_computed_annotations = false) const; - -#if HAVE_BOOST_SERIALIZATION -private: - explicit annotated_commodity_t() : ptr(NULL) { - TRACE_CTOR(annotated_commodity_t, ""); - } - - /** 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& diff --git a/src/archive.cc b/src/archive.cc deleted file mode 100644 index 9ae04e85..00000000 --- a/src/archive.cc +++ /dev/null @@ -1,295 +0,0 @@ -/* - * Copyright (c) 2003-2015, John Wiegley. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * - Neither the name of New Artisans LLC nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <system.hh> - -#if HAVE_BOOST_SERIALIZATION - -#include "archive.h" -#include "amount.h" -#include "commodity.h" -#include "pool.h" -#include "scope.h" -#include "account.h" -#include "post.h" -#include "xact.h" - -#define LEDGER_MAGIC 0x4c454447 -#define ARCHIVE_VERSION 0x03000006 - -//BOOST_IS_ABSTRACT(ledger::scope_t) -BOOST_CLASS_EXPORT(ledger::scope_t) -BOOST_CLASS_EXPORT(ledger::child_scope_t) -BOOST_CLASS_EXPORT(ledger::symbol_scope_t) -BOOST_CLASS_EXPORT(ledger::call_scope_t) -BOOST_CLASS_EXPORT(ledger::account_t) -BOOST_CLASS_EXPORT(ledger::item_t) -BOOST_CLASS_EXPORT(ledger::post_t) -BOOST_CLASS_EXPORT(ledger::xact_base_t) -BOOST_CLASS_EXPORT(ledger::xact_t) -BOOST_CLASS_EXPORT(ledger::auto_xact_t) -BOOST_CLASS_EXPORT(ledger::period_xact_t) - -template void ledger::journal_t::serialize(boost::archive::binary_oarchive&, - const unsigned int); -template void ledger::journal_t::serialize(boost::archive::binary_iarchive&, - const unsigned int); -namespace ledger { - -namespace { - bool read_header_bits(std::istream& in) { - uint32_t bytes; - - assert(sizeof(uint32_t) == 4); - in.read(reinterpret_cast<char *>(&bytes), sizeof(uint32_t)); - if (bytes != LEDGER_MAGIC) { - DEBUG("archive.journal", "Magic bytes not present"); - return false; - } - - in.read(reinterpret_cast<char *>(&bytes), sizeof(uint32_t)); - if (bytes != ARCHIVE_VERSION) { - DEBUG("archive.journal", "Archive version mismatch"); - return false; - } - - return true; - } - - void write_header_bits(std::ostream& out) { - uint32_t bytes; - - assert(sizeof(uint32_t) == 4); - bytes = LEDGER_MAGIC; - out.write(reinterpret_cast<char *>(&bytes), sizeof(uint32_t)); - - bytes = ARCHIVE_VERSION; - out.write(reinterpret_cast<char *>(&bytes), sizeof(uint32_t)); - } -} - -bool archive_t::read_header() -{ - uintmax_t size = file_size(file); - if (size < 8) - return false; - - // Open the stream, read the version number and the list of sources - ifstream stream(file, std::ios::binary); - if (! read_header_bits(stream)) - return false; - - boost::archive::binary_iarchive iarchive(stream); - - DEBUG("archive.journal", "Reading header from archive"); - iarchive >> *this; - - DEBUG("archive.journal", - "Version number: " << std::hex << ARCHIVE_VERSION << std::dec); - DEBUG("archive.journal", "Number of sources: " << sources.size()); - -#if DEBUG_ON - foreach (const journal_t::fileinfo_t& i, sources) - DEBUG("archive.journal", "Loaded source: " << *i.filename); -#endif - - return true; -} - -bool archive_t::should_load(const std::list<path>& data_files) -{ - std::size_t found = 0; - - DEBUG("archive.journal", "Should the archive be loaded?"); - - if (! exists(file)) { - DEBUG("archive.journal", "No, it does not exist"); - return false; - } - - if (! read_header()) { - DEBUG("archive.journal", "No, header failed to read"); - return false; - } - - if (data_files.empty()) { - DEBUG("archive.journal", "No, there were no data files!"); - return false; - } - - if (sources.empty()) { - DEBUG("archive.journal", "No, there were no sources!"); - return false; - } - - if (data_files.size() != sources.size()) { - DEBUG("archive.journal", "No, number of sources doesn't match: " - << data_files.size() << " != " << sources.size()); - return false; - } - - foreach (const path& p, data_files) { - DEBUG("archive.journal", "Scanning for data file: " << p); - - if (! exists(p)) { - DEBUG("archive.journal", "No, an input source no longer exists: " << p); - return false; - } - - foreach (const journal_t::fileinfo_t& i, sources) { - assert(! i.from_stream); - assert(i.filename); - - DEBUG("archive.journal", "Comparing against source file: " << *i.filename); - - if (*i.filename == p) { - if (! exists(*i.filename)) { - DEBUG("archive.journal", - "No, a referent source no longer exists: " << *i.filename); - return false; - } - - if (i.modtime != posix_time::from_time_t(last_write_time(p))) { - DEBUG("archive.journal", "No, a source's modtime has changed: " << p); - return false; - } - - if (i.size != file_size(p)) { - DEBUG("archive.journal", "No, a source's size has changed: " << p); - return false; - } - - found++; - } - } - } - - if (found != data_files.size()) { - DEBUG("archive.journal", "No, not every source's name matched"); - return false; - } - - DEBUG("archive.journal", "Yes, it should be loaded!"); - return true; -} - -bool archive_t::should_save(journal_t& journal) -{ - std::list<path> data_files; - - DEBUG("archive.journal", "Should the archive be saved?"); - - if (journal.was_loaded) { - DEBUG("archive.journal", "No, it's one we loaded before"); - return false; - } - - if (journal.sources.empty()) { - DEBUG("archive.journal", "No, there were no sources!"); - return false; - } - - foreach (const journal_t::fileinfo_t& i, journal.sources) { - if (i.from_stream) { - DEBUG("archive.journal", "No, one source was from a stream"); - return false; - } - - if (! exists(*i.filename)) { - DEBUG("archive.journal", - "No, a source no longer exists: " << *i.filename); - return false; - } - - data_files.push_back(*i.filename); - } - - if (should_load(data_files)) { - DEBUG("archive.journal", "No, because it's still loadable"); - return false; - } - - DEBUG("archive.journal", "Yes, it should be saved!"); - return true; -} - -void archive_t::save(journal_t& journal) -{ - INFO_START(archive, "Saved journal file cache"); - - ofstream stream(file, std::ios::binary); - - write_header_bits(stream); - sources = journal.sources; - -#if DEBUG_ON - foreach (const journal_t::fileinfo_t& i, sources) - DEBUG("archive.journal", "Saving source: " << *i.filename); -#endif - - boost::archive::binary_oarchive oa(stream); - - DEBUG("archive.journal", "Creating archive with version " - << std::hex << ARCHIVE_VERSION << std::dec); - oa << *this; - - DEBUG("archive.journal", - "Archiving journal with " << sources.size() << " sources"); - oa << journal; - - INFO_FINISH(archive); -} - -bool archive_t::load(journal_t& journal) -{ - INFO_START(archive, "Read cached journal file"); - - ifstream stream(file, std::ios::binary); - if (! read_header_bits(stream)) - return false; - - boost::archive::binary_iarchive iarchive(stream); - - // Skip past the archive header, it was already read in before - archive_t temp; - iarchive >> temp; - - iarchive >> journal; - journal.was_loaded = true; - - INFO_FINISH(archive); - - return true; -} - -} // namespace ledger - -#endif // HAVE_BOOST_SERIALIZATION diff --git a/src/archive.h b/src/archive.h deleted file mode 100644 index 485f9606..00000000 --- a/src/archive.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2003-2015, John Wiegley. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * - Neither the name of New Artisans LLC nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** - * @defgroup report Reporting - */ - -/** - * @file archive.h - * @author John Wiegley - * - * @ingroup report - */ -#ifndef _ARCHIVE_H -#define _ARCHIVE_H - -#include "journal.h" - -namespace ledger { - -class archive_t -{ - path file; - - std::list<journal_t::fileinfo_t> sources; - -public: - archive_t() { - TRACE_CTOR(archive_t, ""); - } - archive_t(const path& _file) : file(_file) { - TRACE_CTOR(archive_t, "const path&"); - } - archive_t(const archive_t& ar) : file(ar.file) { - TRACE_CTOR(archive_t, "copy"); - } - ~archive_t() { - TRACE_DTOR(archive_t); - } - - bool read_header(); - - bool should_load(const std::list<path>& data_files); - bool should_save(journal_t& journal); - - void save(journal_t& journal); - bool load(journal_t& journal); - -#if HAVE_BOOST_SERIALIZATION -private: - /** Serialization. */ - - friend class boost::serialization::access; - - template<class Archive> - void serialize(Archive& ar, const unsigned int /* version */) { - ar & sources; - } -#endif // HAVE_BOOST_SERIALIZATION -}; - -} // namespace ledger - -#endif // _ARCHIVE_H diff --git a/src/balance.h b/src/balance.h index 752bb4d6..c9ef9658 100644 --- a/src/balance.h +++ b/src/balance.h @@ -594,18 +594,6 @@ public: } return true; } - -#if HAVE_BOOST_SERIALIZATION -private: - /** Serialization. */ - - friend class boost::serialization::access; - - template<class Archive> - void serialize(Archive& ar, const unsigned int /* version */) { - ar & amounts; - } -#endif // HAVE_BOOST_SERIALIZATION }; inline std::ostream& operator<<(std::ostream& out, const balance_t& bal) { diff --git a/src/commodity.h b/src/commodity.h index 3d1ddf04..53ed3a9f 100644 --- a/src/commodity.h +++ b/src/commodity.h @@ -68,19 +68,6 @@ struct price_point_t bool operator==(const price_point_t& other) const { return when == other.when && price == other.price; } - -#if HAVE_BOOST_SERIALIZATION -private: - /** Serialization. */ - - friend class boost::serialization::access; - - template<class Archive> - void serialize(Archive& ar, const unsigned int /* version */) { - ar & when; - ar & price; - } -#endif // HAVE_BOOST_SERIALIZATION }; class commodity_t @@ -138,28 +125,6 @@ protected: virtual ~base_t() { TRACE_DTOR(commodity_t::base_t); } - -#if HAVE_BOOST_SERIALIZATION - private: - base_t() { - TRACE_CTOR(base_t, ""); - } - - /** Serialization. */ - - friend class boost::serialization::access; - - template<class Archive> - void serialize(Archive& ar, const unsigned int /* version */) { - ar & boost::serialization::base_object<supports_flags<uint_least16_t> >(*this); - ar & symbol; - ar & precision; - ar & name; - ar & note; - ar & smaller; - ar & larger; - } -#endif // HAVE_BOOST_SERIALIZATION }; shared_ptr<base_t> base; @@ -315,32 +280,6 @@ public: struct compare_by_commodity { bool operator()(const amount_t * left, const amount_t * right) const; }; - -#if HAVE_BOOST_SERIALIZATION -private: - supports_flags<uint_least16_t> temp_flags; - -protected: - explicit commodity_t() - : delegates_flags<uint_least16_t>(temp_flags), parent_(NULL), - annotated(false) { - TRACE_CTOR(commodity_t, ""); - } - -private: - /** Serialization. */ - - friend class boost::serialization::access; - - template<class Archive> - void serialize(Archive& ar, const unsigned int /* version */) { - ar & boost::serialization::base_object<delegates_flags<uint_least16_t> >(*this); - ar & base; - ar & parent_; - ar & qualified_symbol; - ar & annotated; - } -#endif // HAVE_BOOST_SERIALIZATION }; inline std::ostream& operator<<(std::ostream& out, const commodity_t& comm) { @@ -106,19 +106,6 @@ public: virtual string context_to_str() const; virtual void print(std::ostream& out) const; virtual void dump(std::ostream& out) const; - -#if 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<base_type>(*this); - ar & ptr; - } -#endif // HAVE_BOOST_SERIALIZATION }; /** diff --git a/src/exprbase.h b/src/exprbase.h index b88fcd7d..dcaa69ca 100644 --- a/src/exprbase.h +++ b/src/exprbase.h @@ -231,21 +231,6 @@ public: out << std::endl << _("--- Result value ---") << std::endl; return calc(); } - -#if HAVE_BOOST_SERIALIZATION -private: - /** Serialization. */ - - friend class boost::serialization::access; - - template<class Archive> - void serialize(Archive& ar, const unsigned int /* version */) { - ar & context; - ar & str; - if (Archive::is_loading::value) - compiled = false; - } -#endif // HAVE_BOOST_SERIALIZATION }; template <typename ResultType> diff --git a/src/flags.h b/src/flags.h index f3593517..82ebaac1 100644 --- a/src/flags.h +++ b/src/flags.h @@ -90,17 +90,6 @@ public: void drop_flags(const flags_t arg) { _flags = static_cast<T>(static_cast<U>(_flags) & static_cast<U>(~arg)); } - -#if HAVE_BOOST_SERIALIZATION -private: - friend class boost::serialization::access; - - template<class Archive> - void serialize(Archive& ar, const unsigned int /* version */) - { - ar & _flags; - } -#endif // HAVE_BOOST_SERIALIZATION }; template <typename T = boost::uint_least8_t, typename U = T> @@ -193,17 +182,6 @@ public: void drop_flags(const flags_t arg) { _flags.drop_flags(arg); } - -#if HAVE_BOOST_SERIALIZATION -private: - friend class boost::serialization::access; - - template<class Archive> - void serialize(Archive& ar, const unsigned int /* version */) - { - ar & _flags; - } -#endif // HAVE_BOOST_SERIALIZATION }; #endif // _FLAGS_H @@ -78,23 +78,6 @@ struct position_t } return *this; } - -#if HAVE_BOOST_SERIALIZATION -private: - /** Serialization. */ - - friend class boost::serialization::access; - - template<class Archive> - void serialize(Archive& ar, const unsigned int /* version */) { - ar & pathname; - ar & beg_pos; - ar & beg_line; - ar & end_pos; - ar & end_line; - ar & sequence; - } -#endif // HAVE_BOOST_SERIALIZATION }; class item_t : public supports_flags<uint_least16_t>, public scope_t @@ -226,25 +209,6 @@ public: const string& name); bool valid() const; - -#if 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<uint_least16_t> >(*this); - ar & boost::serialization::base_object<scope_t>(*this); - ar & _state; - ar & _date; - ar & _date_aux; - ar & note; - ar & pos; - ar & metadata; - } -#endif // HAVE_BOOST_SERIALIZATION }; value_t get_comment(item_t& item); diff --git a/src/journal.h b/src/journal.h index 613b2b96..324315b1 100644 --- a/src/journal.h +++ b/src/journal.h @@ -100,21 +100,6 @@ public: ~fileinfo_t() throw() { TRACE_DTOR(journal_t::fileinfo_t); } - -#if HAVE_BOOST_SERIALIZATION - private: - /** Serialization. */ - - friend class boost::serialization::access; - - template<class Archive> - void serialize(Archive& ar, const unsigned int /* version */) { - ar & filename; - ar & size; - ar & modtime; - ar & from_stream; - } -#endif // HAVE_BOOST_SERIALIZATION }; account_t * master; @@ -215,26 +200,6 @@ public: private: std::size_t read_textual(parse_context_stack_t& context); - -#if HAVE_BOOST_SERIALIZATION -private: - /** Serialization. */ - - friend class boost::serialization::access; - - template<class Archive> - void serialize(Archive& ar, const unsigned int /* version */) { - ar & master; - ar & bucket; - ar & xacts; - ar & auto_xacts; - ar & period_xacts; - ar & sources; - ar & payee_mappings; - ar & account_mappings; - ar & checksum_map; - } -#endif // HAVE_BOOST_SERIALIZATION }; } // namespace ledger @@ -124,25 +124,6 @@ public: } return true; } - -#if HAVE_BOOST_SERIALIZATION -private: - /** Serialization. */ - - friend class boost::serialization::access; - - template<class Archive> - void serialize(Archive& ar, const unsigned int /* version */) { - string temp; - if (Archive::is_loading::value) { - ar & temp; - *this = temp; - } else { - temp = str(); - ar & temp; - } - } -#endif // HAVE_BOOST_SERIALIZATION }; inline std::ostream& operator<<(std::ostream& out, const mask_t& mask) { @@ -314,33 +314,6 @@ private: value_t calc_call(scope_t& scope, ptr_op_t * locus, const int depth); value_t calc_cons(scope_t& scope, ptr_op_t * locus, const int depth); value_t calc_seq(scope_t& scope, ptr_op_t * locus, const int depth); - -#if 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_->is_function()) { - ar & left_; - } else { - ptr_op_t temp_op; - ar & temp_op; - } - if (Archive::is_loading::value || is_value() || is_ident() || - (kind > UNARY_OPERATORS && - (! has_right() || ! right()->is_function()))) { - ar & data; - } else { - variant<ptr_op_t, value_t, string, expr_t::func_t> temp_data; - ar & temp_data; - } - } -#endif // HAVE_BOOST_SERIALIZATION }; inline expr_t::ptr_op_t @@ -132,26 +132,6 @@ public: parse_price_expression(const std::string& str, const bool add_prices = true, const optional<datetime_t>& moment = none); - -#if HAVE_BOOST_SERIALIZATION -private: - /** Serialization. */ - - friend class boost::serialization::access; - - template<class Archive> - void serialize(Archive& ar, const unsigned int /* version */) { - ar & current_pool; - ar & commodities; - ar & annotated_commodities; - ar & null_commodity; - ar & default_commodity; - ar & keep_base; - ar & price_db; - ar & quote_leeway; - ar & get_quotes; - } -#endif // HAVE_BOOST_SERIALIZATION }; } // namespace ledger @@ -255,24 +255,6 @@ public: } } }; - -#if 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<item_t>(*this); - ar & xact; - ar & account; - ar & amount; - ar & amount_expr; - ar & cost; - ar & assigned_amount; - } -#endif // HAVE_BOOST_SERIALIZATION }; class journal_t; diff --git a/src/predicate.h b/src/predicate.h index 30d07223..e8c5b31c 100644 --- a/src/predicate.h +++ b/src/predicate.h @@ -90,19 +90,6 @@ public: .to_boolean() : true); } - -#if 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<expr_t>(*this); - ar & what_to_keep; - } -#endif // HAVE_BOOST_SERIALIZATION }; } // namespace ledger diff --git a/src/scope.h b/src/scope.h index 8ad3afac..ba1144b2 100644 --- a/src/scope.h +++ b/src/scope.h @@ -83,20 +83,6 @@ struct symbol_t bool operator==(const symbol_t& sym) const { return kind == sym.kind || name == sym.name; } - -#if HAVE_BOOST_SERIALIZATION -private: - /** Serialization. */ - - friend class boost::serialization::access; - - template<class Archive> - void serialize(Archive& ar, const unsigned int /* version */) { - ar & kind; - ar & name; - ar & definition; - } -#endif // HAVE_BOOST_SERIALIZATION }; class empty_scope_t; @@ -127,16 +113,6 @@ public: virtual bool type_required() const { return false; } - -#if HAVE_BOOST_SERIALIZATION -private: - /** Serialization. */ - - friend class boost::serialization::access; - - template<class Archive> - void serialize(Archive&, const unsigned int /* version */) {} -#endif // HAVE_BOOST_SERIALIZATION }; class empty_scope_t : public scope_t @@ -184,19 +160,6 @@ public: return parent->lookup(kind, name); return NULL; } - -#if 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<scope_t>(*this); - ar & parent; - } -#endif // HAVE_BOOST_SERIALIZATION }; class bind_scope_t : public child_scope_t @@ -233,19 +196,6 @@ public: return def; return child_scope_t::lookup(kind, name); } - -#if 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<child_scope_t>(*this); - ar & grandchild; - } -#endif // HAVE_BOOST_SERIALIZATION }; template <typename T> @@ -323,19 +273,6 @@ public: virtual expr_t::ptr_op_t lookup(const symbol_t::kind_t kind, const string& name); - -#if 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<child_scope_t>(*this); - ar & symbols; - } -#endif // HAVE_BOOST_SERIALIZATION }; class context_scope_t : public child_scope_t @@ -365,24 +302,6 @@ public: virtual bool type_required() const { return required; } - -#if HAVE_BOOST_SERIALIZATION -protected: - explicit context_scope_t() { - TRACE_CTOR(context_scope_t, ""); - } - - /** Serialization. */ - - friend class boost::serialization::access; - - template<class Archive> - void serialize(Archive& ar, const unsigned int /* version */) { - ar & boost::serialization::base_object<child_scope_t>(*this); - ar & value_type_context; - ar & required; - } -#endif // HAVE_BOOST_SERIALIZATION }; class call_scope_t : public context_scope_t @@ -480,24 +399,6 @@ public: bool empty() const { return args.size() == 0; } - -#if HAVE_BOOST_SERIALIZATION -protected: - explicit call_scope_t() : depth(0) { - TRACE_CTOR(call_scope_t, ""); - } - - /** Serialization. */ - - friend class boost::serialization::access; - - template<class Archive> - void serialize(Archive& ar, const unsigned int /* version */) { - ar & boost::serialization::base_object<context_scope_t>(*this); - ar & args; - //ar & ptr; - } -#endif // HAVE_BOOST_SERIALIZATION }; template <> diff --git a/src/session.cc b/src/session.cc index b0d31be9..7736023d 100644 --- a/src/session.cc +++ b/src/session.cc @@ -37,7 +37,6 @@ #include "journal.h" #include "iterators.h" #include "filters.h" -#include "archive.h" namespace ledger { @@ -128,16 +127,6 @@ std::size_t session_t::read_data(const string& master_account) if (HANDLED(value_expr_)) journal->value_expr = HANDLER(value_expr_).str(); - -#if HAVE_BOOST_SERIALIZATION - optional<archive_t> cache; - if (HANDLED(cache_) && master_account.empty()) - cache = archive_t(HANDLED(cache_).str()); - - if (! (cache && - cache->should_load(HANDLER(file_).data_files) && - cache->load(*journal.get()))) { -#endif // HAVE_BOOST_SERIALIZATION if (price_db_path) { if (exists(*price_db_path)) { parsing_context.push(*price_db_path); @@ -191,12 +180,6 @@ std::size_t session_t::read_data(const string& master_account) << "] == journal->xacts.size() [" << journal->xacts.size() << "]"); assert(xact_count == journal->xacts.size()); -#if HAVE_BOOST_SERIALIZATION - if (cache && cache->should_save(*journal.get())) - cache->save(*journal.get()); - } -#endif // HAVE_BOOST_SERIALIZATION - if (populated_data_files) HANDLER(file_).data_files.clear(); @@ -333,8 +316,7 @@ option_t<session_t> * session_t::lookup_option(const char * p) OPT_CH(price_exp_); break; case 'c': - OPT(cache_); - else OPT(check_payees); + OPT(check_payees); break; case 'd': OPT(download); // -Q diff --git a/src/session.h b/src/session.h index b287b19e..f9aee389 100644 --- a/src/session.h +++ b/src/session.h @@ -97,7 +97,6 @@ public: void report_options(std::ostream& out) { - HANDLER(cache_).report(out); HANDLER(check_payees).report(out); HANDLER(day_break).report(out); HANDLER(download).report(out); @@ -126,7 +125,6 @@ public: * Option handlers */ - OPTION(session_t, cache_); OPTION(session_t, check_payees); OPTION(session_t, day_break); OPTION(session_t, download); // -Q diff --git a/src/system.hh.in b/src/system.hh.in index eaf4b1ac..8de27ad6 100644 --- a/src/system.hh.in +++ b/src/system.hh.in @@ -71,7 +71,6 @@ #define HAVE_BOOST_PYTHON @HAVE_BOOST_PYTHON@ #define HAVE_BOOST_REGEX_UNICODE @HAVE_BOOST_REGEX_UNICODE@ -#define HAVE_BOOST_SERIALIZATION 0 #define DEBUG_MODE @DEBUG_MODE@ #define NO_ASSERTS @NO_ASSERTS@ @@ -239,86 +238,8 @@ typedef std::ostream::pos_type ostream_pos_type; #endif #define _f(str) boost::format(_(str)) -#if HAVE_BOOST_SERIALIZATION - -#include <boost/archive/binary_iarchive.hpp> -#include <boost/archive/binary_oarchive.hpp> - -#include <boost/serialization/base_object.hpp> -#include <boost/serialization/binary_object.hpp> -#include <boost/serialization/optional.hpp> -#include <boost/serialization/shared_ptr.hpp> -#include <boost/serialization/variant.hpp> -#include <boost/serialization/utility.hpp> -#include <boost/serialization/export.hpp> -#include <boost/serialization/level.hpp> -#include <boost/serialization/string.hpp> -#include <boost/serialization/vector.hpp> -#include <boost/serialization/deque.hpp> -#include <boost/serialization/list.hpp> -#include <boost/serialization/map.hpp> - -#include <boost/date_time/posix_time/time_serialize.hpp> -#include <boost/date_time/gregorian/greg_serialize.hpp> -#include <boost/ptr_container/serialize_ptr_deque.hpp> - -namespace boost { -namespace serialization { - -template <class Archive> -void serialize(Archive& ar, boost::filesystem::path& p, const unsigned int) -{ - std::string s; - if (Archive::is_saving::value) - s = p.string(); - - ar & s; - - if (Archive::is_loading::value) - p = s; -} - -template <class Archive, class T> -void serialize(Archive& ar, boost::intrusive_ptr<T>& ptr, const unsigned int) -{ - if (Archive::is_saving::value) { - T * p = ptr.get(); - ar & p; - } - else if (Archive::is_loading::value) { - T * p; - ar & p; - ptr.reset(p); - } -} - -template <class Archive> -void serialize(Archive&, boost::any&, const unsigned int) { - // jww (2012-03-29): Should we really ignore any fields entirely? - // These occur inside value_t::storage_t::data's variant. -} - -template <class Archive> -void serialize(Archive&, boost::blank&, const unsigned int) {} - -template <class Archive, class T> -void serialize(Archive&, boost::function<T>&, const unsigned int) {} - -template <class Archive> -void serialize(Archive& ar, istream_pos_type& pos, const unsigned int) -{ - ar & make_binary_object(&pos, sizeof(istream_pos_type)); -} - -} // namespace serialization -} // namespace boost - -#else // HAVE_BOOST_SERIALIZATION - #include <boost/ptr_container/ptr_deque.hpp> -#endif // HAVE_BOOST_SERIALIZATION - #if HAVE_BOOST_PYTHON #include <boost/python.hpp> diff --git a/src/times.h b/src/times.h index c1bfb1cc..421d1462 100644 --- a/src/times.h +++ b/src/times.h @@ -153,20 +153,6 @@ struct date_traits_t has_month == traits.has_month && has_day == traits.has_day); } - -#if HAVE_BOOST_SERIALIZATION -private: - /** Serialization. */ - - friend class boost::serialization::access; - - template<class Archive> - void serialize(Archive& ar, const unsigned int /* version */) { - ar & has_year; - ar & has_month; - ar & has_day; - } -#endif // HAVE_BOOST_SERIALIZATION }; struct date_duration_t @@ -247,19 +233,6 @@ struct date_duration_t } static date_t find_nearest(const date_t& date, skip_quantum_t skip); - -#if HAVE_BOOST_SERIALIZATION -private: - /** Serialization. */ - - friend class boost::serialization::access; - - template<class Archive> - void serialize(Archive& ar, const unsigned int /* version */) { - ar & quantum; - ar & length; - } -#endif // HAVE_BOOST_SERIALIZATION }; class date_specifier_t @@ -343,21 +316,6 @@ public: return out.str(); } - -#if HAVE_BOOST_SERIALIZATION -private: - /** Serialization. */ - - friend class boost::serialization::access; - - template<class Archive> - void serialize(Archive& ar, const unsigned int /* version */) { - ar & year; - ar & month; - ar & day; - ar & wday; - } -#endif // HAVE_BOOST_SERIALIZATION }; class date_range_t @@ -420,20 +378,6 @@ public: return out.str(); } - -#if HAVE_BOOST_SERIALIZATION -private: - /** Serialization. */ - - friend class boost::serialization::access; - - template<class Archive> - void serialize(Archive& ar, const unsigned int /* version */) { - ar & range_begin; - ar & range_end; - ar & end_inclusive; - } -#endif // HAVE_BOOST_SERIALIZATION }; class date_specifier_or_range_t @@ -490,18 +434,6 @@ public: return out.str(); } - -#if HAVE_BOOST_SERIALIZATION -private: - /** Serialization. */ - - friend class boost::serialization::access; - - template<class Archive> - void serialize(Archive& ar, const unsigned int /* version */) { - ar & specifier_or_range; - } -#endif // HAVE_BOOST_SERIALIZATION }; class date_interval_t : public equality_comparable<date_interval_t> @@ -594,24 +526,6 @@ public: date_interval_t& operator++(); void dump(std::ostream& out); - -#if HAVE_BOOST_SERIALIZATION -private: - /** Serialization. */ - - friend class boost::serialization::access; - - template<class Archive> - void serialize(Archive& ar, const unsigned int /* version */) { - ar & range; - ar & start; - ar & finish; - ar & aligned; - ar & next; - ar & duration; - ar & end_of_duration; - } -#endif // HAVE_BOOST_SERIALIZATION }; void times_initialize(); diff --git a/src/value.h b/src/value.h index c224ce04..810d34f9 100644 --- a/src/value.h +++ b/src/value.h @@ -227,20 +227,6 @@ public: data = false; type = VOID; } - -#if HAVE_BOOST_SERIALIZATION - private: - /** Serialization. */ - - friend class boost::serialization::access; - - template<class Archive> - void serialize(Archive& ar, const unsigned int /* version */) { - ar & data; - ar & type; - ar & refc; - } -#endif // HAVE_BOOST_SERIALIZATION }; private: @@ -965,20 +951,6 @@ public: * Debugging methods. */ bool valid() const; - -#if HAVE_BOOST_SERIALIZATION -private: - /** Serialization. */ - - friend class boost::serialization::access; - - template<class Archive> - void serialize(Archive& ar, const unsigned int /* version */) { - ar & true_value; - ar & false_value; - ar & storage; - } -#endif // HAVE_BOOST_SERIALIZATION }; #define NULL_VALUE (value_t()) @@ -87,20 +87,6 @@ public: virtual bool valid() const { return true; } - -#if 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<item_t>(*this); - ar & journal; - ar & posts; - } -#endif // HAVE_BOOST_SERIALIZATION }; class xact_t : public xact_base_t @@ -142,20 +128,6 @@ public: const string& name); virtual bool valid() const; - -#if 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<xact_base_t>(*this); - ar & code; - ar & payee; - } -#endif // HAVE_BOOST_SERIALIZATION }; class auto_xact_t : public xact_base_t @@ -176,21 +148,6 @@ public: bool _overwrite_existing) : tag_data(_tag_data), overwrite_existing(_overwrite_existing), apply_to_post(NULL) {} - -#if HAVE_BOOST_SERIALIZATION -private: - /** Serialization. */ - deferred_tag_data_t() : apply_to_post(NULL) {} - - friend class boost::serialization::access; - - template<class Archive> - void serialize(Archive& ar, const unsigned int /* version */) { - ar & tag_data; - ar & overwrite_existing; - ar & apply_to_post; - } -#endif // HAVE_BOOST_SERIALIZATION }; typedef std::list<deferred_tag_data_t> deferred_notes_list; @@ -236,21 +193,6 @@ private: } virtual void extend_xact(xact_base_t& xact, parse_context_t& context); - -#if 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<xact_base_t>(*this); - ar & predicate; - ar & check_exprs; - ar & deferred_notes; - } -#endif // HAVE_BOOST_SERIALIZATION }; class period_xact_t : public xact_base_t @@ -284,20 +226,6 @@ class period_xact_t : public xact_base_t return string(_("generated periodic transaction")); } } - -#if 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<xact_base_t>(*this); - ar & period; - ar & period_string; - } -#endif // HAVE_BOOST_SERIALIZATION }; typedef std::list<xact_t *> xacts_list; |