24#ifndef GNC_KVP_VALUE_TYPE
25#define GNC_KVP_VALUE_TYPE
31#include <boost/variant.hpp>
119 std::
string to_string() const noexcept;
120 std::
string to_string(std::
string const & prefix) const noexcept;
122 template <typename T>
123 T get() const noexcept;
124 template <typename T>
125 const T* get_ptr() const noexcept;
127 template <typename T>
128 void set(T) noexcept;
147compare(const
KvpValueImpl *, const KvpValue *) noexcept;
155template <
typename T> T
156KvpValueImpl::get() const noexcept
158 if (this->datastore.type() != boost::typeindex::type_id<T>())
return {};
159 return boost::get<T>(datastore);
162template <
typename T>
const T*
163KvpValueImpl::get_ptr() const noexcept
165 if (this->datastore.type() !=
typeid(T))
return nullptr;
166 return boost::get<T>(&datastore);
169template <
typename T>
void
170KvpValueImpl::set(T val)
noexcept
172 this->datastore = val;
KvpValue * kvp_value_from_gvalue(const GValue *gval)
Convert a gvalue into a kvpvalue.
void gvalue_from_kvp_value(const KvpValue *kval, GValue *val)
Convert a kvp_value into a GValue.
The type used to store guids in C.
Implements KvpValue using boost::variant.
KvpValueImpl * add(KvpValueImpl *) noexcept
Adds another value to this KvpValueImpl.
~KvpValueImpl() noexcept
Performs a deep delete.
@ INT64
QOF_TYPE_INT64 gint64.
@ STRING
QOF_TYPE_STRING gchar*.
@ GDATE
no QOF equivalent.
@ GLIST
no QOF equivalent.
@ NUMERIC
QOF_TYPE_NUMERIC.
@ FRAME
no QOF equivalent.
@ DOUBLE
QOF_TYPE_DOUBLE gdouble.