24 #ifndef GNC_KVP_VALUE_TYPE 25 #define GNC_KVP_VALUE_TYPE 30 #include <boost/variant.hpp> 118 std::
string to_string() const noexcept;
119 std::
string to_string(
std::
string const & prefix) const noexcept;
121 template <typename T>
122 T get() const noexcept;
123 template <typename T>
124 const T* get_ptr() const noexcept;
126 template <typename T>
127 void set(T) noexcept;
146 compare(const
KvpValueImpl *, const KvpValue *) noexcept;
148 template <typename T>
154 template <
typename T> T
155 KvpValueImpl::get() const noexcept
157 if (this->datastore.type() != boost::typeindex::type_id<T>())
return {};
158 return boost::get<T>(datastore);
161 template <
typename T>
const T*
162 KvpValueImpl::get_ptr() const noexcept
164 if (this->datastore.type() !=
typeid(T))
return nullptr;
165 return boost::get<T>(&datastore);
168 template <
typename T>
void 169 KvpValueImpl::set(T val) noexcept
171 this->datastore = val;
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.
GValue * gvalue_from_kvp_value(const KvpValue *kval, GValue *val=nullptr)
Convert a kvp_value into a GValue.
~KvpValueImpl() noexcept
Performs a deep delete.
The type used to store guids in C.