Util: Add get<T>() functionality with customization points to Value
This commit is contained in:
@@ -13,6 +13,8 @@
|
||||
#include <iostream> // istream, ostream
|
||||
#include <string>
|
||||
|
||||
#include "util/json/fromjson.h"
|
||||
|
||||
namespace Json {
|
||||
|
||||
class Array;
|
||||
@@ -73,6 +75,22 @@ public:
|
||||
|
||||
// --------------------------------------
|
||||
|
||||
template<typename T>
|
||||
T get() const
|
||||
{
|
||||
T type;
|
||||
fromJson(*this, type);
|
||||
return type;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void getTo(T& type) const
|
||||
{
|
||||
fromJson(*this, type);
|
||||
}
|
||||
|
||||
// --------------------------------------
|
||||
|
||||
Type type() const { return m_type; }
|
||||
size_t size() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user