@@ -1418,6 +1418,8 @@ namespace json
1418
1418
class _Value
1419
1419
{
1420
1420
public:
1421
+ virtual std::unique_ptr<_Value> _copy_value () = 0;
1422
+
1421
1423
virtual bool has_field (const utility::string_t &) const { return false ; }
1422
1424
virtual value get_field (const utility::string_t &) const { throw json_exception (_XPLATSTR (" not an object" )); }
1423
1425
virtual value get_element (array::size_type) const { throw json_exception (_XPLATSTR (" not an array" )); }
@@ -1487,6 +1489,10 @@ namespace json
1487
1489
class _Null : public _Value
1488
1490
{
1489
1491
public:
1492
+ virtual std::unique_ptr<_Value> _copy_value ()
1493
+ {
1494
+ return utility::details::make_unique<_Null>();
1495
+ }
1490
1496
virtual json::value::value_type type () const { return json::value::Null; }
1491
1497
};
1492
1498
@@ -1499,6 +1505,11 @@ namespace json
1499
1505
_Number (int64_t value) : m_number(value) { }
1500
1506
_Number (uint64_t value) : m_number(value) { }
1501
1507
1508
+ virtual std::unique_ptr<_Value> _copy_value ()
1509
+ {
1510
+ return utility::details::make_unique<_Number>(*this );
1511
+ }
1512
+
1502
1513
virtual json::value::value_type type () const { return json::value::Number; }
1503
1514
1504
1515
virtual bool is_integer () const { return m_number.is_integral (); }
@@ -1532,6 +1543,11 @@ namespace json
1532
1543
public:
1533
1544
_Boolean (bool value) : m_value(value) { }
1534
1545
1546
+ virtual std::unique_ptr<_Value> _copy_value ()
1547
+ {
1548
+ return utility::details::make_unique<_Boolean>(*this );
1549
+ }
1550
+
1535
1551
virtual json::value::value_type type () const { return json::value::Boolean; }
1536
1552
1537
1553
virtual bool as_bool () const { return m_value; }
@@ -1577,6 +1593,11 @@ namespace json
1577
1593
{ }
1578
1594
#endif
1579
1595
1596
+ virtual std::unique_ptr<_Value> _copy_value ()
1597
+ {
1598
+ return utility::details::make_unique<_String>(*this );
1599
+ }
1600
+
1580
1601
virtual json::value::value_type type () const { return json::value::String; }
1581
1602
1582
1603
virtual const utility::string_t & as_string () const ;
@@ -1643,6 +1664,11 @@ namespace json
1643
1664
_Object (bool keep_order) : m_object(keep_order) { }
1644
1665
_Object (object::storage_type fields, bool keep_order) : m_object(std::move(fields), keep_order) { }
1645
1666
1667
+ virtual std::unique_ptr<_Value> _copy_value ()
1668
+ {
1669
+ return utility::details::make_unique<_Object>(*this );
1670
+ }
1671
+
1646
1672
virtual json::object& as_object () { return m_object; }
1647
1673
1648
1674
virtual const json::object& as_object () const { return m_object; }
@@ -1749,6 +1775,11 @@ namespace json
1749
1775
_Array (array::size_type size) : m_array(size) {}
1750
1776
_Array (array::storage_type elements) : m_array(std::move(elements)) { }
1751
1777
1778
+ virtual std::unique_ptr<_Value> _copy_value ()
1779
+ {
1780
+ return utility::details::make_unique<_Array>(*this );
1781
+ }
1782
+
1752
1783
virtual json::value::value_type type () const { return json::value::Array; }
1753
1784
1754
1785
virtual json::array& as_array () { return m_array; }
0 commit comments