gnucash master: Implement KvpValue in c++ using boost::variant

John Ralls jralls at
Tue Oct 7 11:07:38 EDT 2014

Updated	 via (commit)
	from (commit)

commit 8a7f426f3b37def46f5ecccc05bdb5b459791737
Author: lmat <dartme18 at>
Date:   Fri Sep 19 16:35:03 2014 -0400

    Implement KvpValue in c++ using boost::variant
    KvpValue is now instantiated as a boost::variant and passed around as an opaque
    pointer in C. The C interface is basically unchanged and a c++ interface exists
    in kvp-value.hpp
    The c++ implementation for KvpValue is called KvpValueImpl and is in kvp-value.cpp.
    We don't use structured exception handling at this point, so c++ functions are
    marked 'noexcept'.
    The logic is within the c++ implementations. C wrapper functions do little besides
    ensure that the pointer is not nullptr before calling into c++.
    The logic in kvp_value_glist_to_string was moved to the c++ class. It's an
    implementation detail, but unfortunately, it was being exposed through a pointer,
    so I had to modify the test just a bit to not use it directly.
    In order to work around what seems to be a bug in an Apple compiler, it was decided
    to create an header file private to kvp-value and kvp_frame that holds the definition
    of KvpFrame so that it was visible to both translation units.

Summary of changes:
 src/engine/engine.i                  |   2 +-
 src/libqof/qof/           |   3 +-
 src/libqof/qof/kvp-util.cpp          |   2 +-
 src/libqof/qof/kvp-value.cpp         | 322 ++++++++++++++++++++
 src/libqof/qof/kvp-value.hpp         | 127 ++++++++
 src/libqof/qof/kvp_frame-p.hpp       |  14 +
 src/libqof/qof/kvp_frame.cpp         | 561 +++++++----------------------------
 src/libqof/qof/kvp_frame.h           |   8 +-
 src/libqof/qof/test/test-kvp_frame.c |  25 +-
 9 files changed, 591 insertions(+), 473 deletions(-)
 create mode 100644 src/libqof/qof/kvp-value.cpp
 create mode 100644 src/libqof/qof/kvp-value.hpp
 create mode 100644 src/libqof/qof/kvp_frame-p.hpp

More information about the gnucash-patches mailing list