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;
147 compare(const
KvpValueImpl *, const KvpValue *) noexcept;
149 template <typename T>
155 template <
typename T> T
156 KvpValueImpl::get() const noexcept
158 if (this->datastore.type() != boost::typeindex::type_id<T>())
return {};
159 return boost::get<T>(datastore);
162 template <
typename T>
const T*
163 KvpValueImpl::get_ptr() const noexcept
165 if (this->datastore.type() !=
typeid(T))
return nullptr;
166 return boost::get<T>(&datastore);
169 template <
typename T>
void 170 KvpValueImpl::set(T val) noexcept
172 this->datastore = val;
void gvalue_from_kvp_value(const KvpValue *kval, GValue *val)
Convert a kvp_value into a GValue.
KvpValue * kvp_value_from_gvalue(const GValue *gval)
Convert a gvalue into a kvpvalue.
KvpValueImpl * add(KvpValueImpl *) noexcept
Adds another value to this KvpValueImpl.
Implements KvpValue using boost::variant.
KvpValueImpl(KvpValueImpl const &) noexcept
Performs a deep copy.
~KvpValueImpl() noexcept
Performs a deep delete.
The type used to store guids in C.