Ditto 2.0.0-alpha1
Public Member Functions | List of all members
ditto::MutableRga Class Reference
Inheritance diagram for ditto::MutableRga:
ditto::Rga

Public Member Functions

void set (std::size_t index, nlohmann::json value)
 
void remove (std::size_t index)
 
void insert (std::size_t index, nlohmann::json value)
 Inserts a value into an array at the index defined by the preceding subscripting. This will only succeed if the value at the subscripting-defined key is an index into an array. More...
 
void push (nlohmann::json value)
 Push a value on to the end of an array at the document's key defined by the preceding subscripting. This will only succeed if the value at the subscripting-defined key is an array. More...
 
nlohmann::json pop ()
 Pop a value off the end of an array at the document's key defined by the preceding subscripting. This will only succeed if the value at the subscripting-defined key is an array. More...
 
- Public Member Functions inherited from ditto::Rga
 Rga (const nlohmann::json &info)
 
 Rga (std::vector< nlohmann::json > value=std::vector< nlohmann::json >())
 Construct a new Rga object than can be used as part of a document's context. More...
 
DittoCrdtType get_type () const
 
std::vector< nlohmann::jsonget_value () const
 Return the array representation of the RGA. More...
 

Additional Inherited Members

- Protected Member Functions inherited from ditto::Rga
size_t size () const
 
- Protected Attributes inherited from ditto::Rga
std::vector< nlohmann::jsonvalue
 

Member Function Documentation

◆ insert()

void ditto::MutableRga::insert ( std::size_t  index,
nlohmann::json  value 
)

Inserts a value into an array at the index defined by the preceding subscripting. This will only succeed if the value at the subscripting-defined key is an index into an array.

Parameters
[in]valuethe value to insert into the array.
Exceptions
DittoErrorthrown if trying to update the document at an invalid key.

◆ pop()

nlohmann::json ditto::MutableRga::pop ( )

Pop a value off the end of an array at the document's key defined by the preceding subscripting. This will only succeed if the value at the subscripting-defined key is an array.

Returns
the value popped off from the end of the array.
Exceptions
DittoErrorthrown if trying to update the document at an invalid key.

◆ push()

void ditto::MutableRga::push ( nlohmann::json  value)

Push a value on to the end of an array at the document's key defined by the preceding subscripting. This will only succeed if the value at the subscripting-defined key is an array.

Parameters
[in]valuethe value to push on to the array.
Exceptions
DittoErrorthrown if trying to update the document at an invalid key.