rjp/rjp++/include/value.hpp
2020-03-06 16:13:28 -08:00

44 lines
807 B
C++

#ifndef RJP_VALUE_HPP
#define RJP_VALUE_HPP
#include <rjp.h>
#include "string.hpp"
namespace rjp{
class value
{
protected:
RJP_value* m_value;
bool m_managed = true;
public:
value(void);
explicit value(RJP_value* val, bool managed);
value(const value& val);
value(value&& val);
~value(void);
value& operator=(const value& val);
value& operator=(value&& val);
const RJP_value* raw(void)const;
RJP_value* raw(void);
RJP_data_type type(void)const;
value parent(void)const;
bool is_child_of(const value&)const;
string to_json(int flags = RJP_FORMAT_PRETTY);
protected:
static value create_unmanaged(RJP_value* val);
static value create_managed(RJP_value* val);
static void remove_management(value& val);
static void add_management(value& val);
};
}
#endif