DittoSharp  0.3.1-alpha1
Public Member Functions | Protected Member Functions | Properties | List of all members
DittoSharp.DittoMutableDocumentPath Class Reference

Provides an interface to specify a path to a key in a document that you can then call various update functions on. You obtain a DittoMutableDocumentPath by subscripting a DittoMutableDocument and you can then further subscript a DittoMutableDocumentPath to further specify the key of the document that you want to update. More...

Inheritance diagram for DittoSharp.DittoMutableDocumentPath:
DittoSharp.DocumentPath

Public Member Functions

unsafe void Set (object value, bool isDefault=false)
 Set a value at the document's key defined by the preceding subscripting. More...
 
unsafe void Remove ()
 Remove a value at the document's key defined by the preceding subscripting. If removing an index from an array, any subsequent indexes will be shifted left to fill the gap. More...
 
void ReplaceWithCounter (bool isDefault=false)
 Replace a value at the document's key defined by the preceding subscripting with a counter. More...
 
void Increment (double amount)
 Increment a counter at the document's key defined by the preceding subscripting. More...
 
unsafe void Push (object value)
 Push a value on to the end of an array at the document's key defined by the preceding subscripting. More...
 
unsafe object Pop ()
 Pop a value off the end of an array at the document's key defined by the preceding subscripting. More...
 
unsafe void Insert (object value)
 Inserts a value into an array at the index defined by the preceding subscripting. More...
 

Protected Member Functions

override unsafe CBORObject GetCborObjectAtCurrentPath ()
 

Properties

DittoMutableDocumentPath this[string key] [get]
 Used to specify a path to a key in the document that you can subscript further to access a nested key in the document and eventually perform an update operation on. More...
 
DittoMutableDocumentPath this[int index] [get]
 Used to specify an index in the array at the preceding key-path specified through the subscripting defined previously. You can subscript the return value further to access a further nested key in the document and eventually perform an update operation. More...
 
- Properties inherited from DittoSharp.DocumentPath
string String [get]
 Gets the value at the previously specified key in the document as a string if possible, otherwise the return value will be null. More...
 
string?? StringValue [get]
 Gets the value at the previously specified key in the document as a string if possible, otherwise the return value will be "" (an empty string). More...
 
int Int32Value [get]
 Gets the value at the previously specified key in the document as an Int32 if possible, otherwise the return value will be 0. More...
 
long Int64Value [get]
 Gets the value at the previously specified key in the document as an Int64 if possible, otherwise the return value will be 0. More...
 
uint UInt32Value [get]
 Gets the value at the previously specified key in the document as a UInt32 if possible, otherwise the return value will be 0. More...
 
ulong UInt64Value [get]
 Gets the value at the previously specified key in the document as a UInt64 if possible, otherwise the return value will be 0. More...
 
float FloatValue [get]
 Gets the value at the previously specified key in the document as a Float if possible, otherwise the return value will be 0.0. More...
 
double DoubleValue [get]
 Gets the value at the previously specified key in the document as a UInt32 if possible, otherwise the return value will be 0. More...
 
bool BooleanValue [get]
 Gets the value at the previously specified key in the document as a bool if possible, otherwise the return value will be false. More...
 
List< object > List [get]
 Gets the value at the previously specified key in the document as a List<object> if possible, otherwise the return value will be null. More...
 
List< object >?? ListValue [get]
 Gets the value at the previously specified key in the document as a List<object> if possible, otherwise the return value will be [] (an empty list). More...
 
Dictionary< string, object > Dictionary [get]
 Gets the value at the previously specified key in the document as a Dictionary<string, object> if possible, otherwise the return value will be null. More...
 
Dictionary< string, object >?? DictionaryValue [get]
 Gets the value at the previously specified key in the document as a Dictionary<string, object> if possible, otherwise the return value will be {} (an empty dictionary). More...
 
DittoAttachmentToken AttachmentToken [get]
 Gets the value at the previously specified key in the document as a DittoAttachmentToken if possible, otherwise the return value will be null. More...
 

Detailed Description

Provides an interface to specify a path to a key in a document that you can then call various update functions on. You obtain a DittoMutableDocumentPath by subscripting a DittoMutableDocument and you can then further subscript a DittoMutableDocumentPath to further specify the key of the document that you want to update.

Member Function Documentation

◆ Increment()

void DittoSharp.DittoMutableDocumentPath.Increment ( double  amount)
inline

Increment a counter at the document's key defined by the preceding subscripting.

This will only succeed if the value at the subscripting-defined key is a counter.

Parameters
amountThe amount to increment the counter by. This can be a positive or a negative value.

◆ Insert()

unsafe void DittoSharp.DittoMutableDocumentPath.Insert ( object  value)
inline

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 array.

Parameters
valueThe value to insert into the array.

◆ Pop()

unsafe object DittoSharp.DittoMutableDocumentPath.Pop ( )
inline

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.

◆ Push()

unsafe void DittoSharp.DittoMutableDocumentPath.Push ( object  value)
inline

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
valueThe value to push on to the array.

◆ Remove()

unsafe void DittoSharp.DittoMutableDocumentPath.Remove ( )
inline

Remove a value at the document's key defined by the preceding subscripting. If removing an index from an array, any subsequent indexes will be shifted left to fill the gap.

◆ ReplaceWithCounter()

void DittoSharp.DittoMutableDocumentPath.ReplaceWithCounter ( bool  isDefault = false)
inline

Replace a value at the document's key defined by the preceding subscripting with a counter.

Parameters
isDefaultRepresents whether or not the value is being replaced with a counter that should serve as a default value. Set this to true if you want to set a default value that you expect to be overwritten by other devices in the network. The default value is false.

◆ Set()

unsafe void DittoSharp.DittoMutableDocumentPath.Set ( object  value,
bool  isDefault = false 
)
inline

Set a value at the document's key defined by the preceding subscripting.

Parameters
valueThe value to set at the subscripting-defined document key.
isDefaultRepresents whether or not the value should be set as a default value. Set this to true if you want to set a default value that you expect to be overwritten by other devices in the network. The default value is false.

Property Documentation

◆ this[int index]

DittoMutableDocumentPath DittoSharp.DittoMutableDocumentPath.this[int index]
get

Used to specify an index in the array at the preceding key-path specified through the subscripting defined previously. You can subscript the return value further to access a further nested key in the document and eventually perform an update operation.

Parameters
indexThe index of the array that you wish to access in the key previously specified with the preceding subscripting.
Returns
A DittoMutableDocumentPath with the provided index incorporated into the path.

◆ this[string key]

DittoMutableDocumentPath DittoSharp.DittoMutableDocumentPath.this[string key]
get

Used to specify a path to a key in the document that you can subscript further to access a nested key in the document and eventually perform an update operation on.

Parameters
keyThe next part of the path needed to get to the key in the document you wish to update.
Returns
A DittoMutableDocumentPath with the provided key incorporated into the path.