Couchbase Lite C++
Couchbase Lite C++ API
Loading...
Searching...
No Matches
cbl::Encryptable Class Reference

A reference to an encryptable value associated with a document. More...

#include <cbl++/Encryptable.hh>

Inheritance diagram for cbl::Encryptable:

Public Member Functions

 Encryptable (fleece::Value value)
 Creates an Encryptable wrapping an arbitrary Fleece value.
 Encryptable (std::string_view value)
 Creates an Encryptable wrapping a string value.
fleece::Value value () const
 Returns the value to be encrypted by the push replicator.
fleece::Dict properties () const
 Returns the Encryptable's underlying dictionary representation (its persistent form).
void setInto (fleece::MutableDict dict, fleece::slice key) const
 Sets this encryptable value into dict under key.
 Encryptable () noexcept
 Constructs a null reference (one that points to no object).
Encryptableoperator= (std::nullptr_t)
 Releases the underlying object and resets this to a null reference.
bool valid () const
 Returns true if this references an object, or false if it is a null reference.
 operator bool () const
 Returns true if this references an object (same as valid).
bool operator== (const Encryptable &other) const
 Returns true if both sides reference the same object, or are both null references.
bool operator!= (const Encryptable &other) const
 Returns true if the two sides reference different objects.
CBLEncryptable *_Nullable ref () const
 Returns a pointer to the underlying C object (CBLEncryptable), or NULL if this is a null reference.
 Encryptable (const Encryptable &other) noexcept
 Copy constructor: creates another reference to the same object as other.
 Encryptable (Encryptable &&other) noexcept
 Move constructor: takes over the reference from other, leaving it a null reference.
Encryptableoperator= (const Encryptable &other) noexcept
 Copy assignment: replaces this reference with a reference to other's object.
Encryptableoperator= (Encryptable &&other) noexcept
 Move assignment: replaces this reference with other's, leaving other a null reference.

Static Public Member Functions

static Encryptable createWithNull ()
 Creates an Encryptable wrapping a null value.
static Encryptable createWithBool (bool value)
 Creates an Encryptable wrapping a boolean value.
static Encryptable createWithInt (int64_t value)
 Creates an Encryptable wrapping a signed integer value.
static Encryptable createWithUInt (uint64_t value)
 Creates an Encryptable wrapping an unsigned integer value.
static Encryptable createWithFloat (float value)
 Creates an Encryptable wrapping a float value.
static Encryptable createWithDouble (double value)
 Creates an Encryptable wrapping a double value.
static bool isEncryptableValue (fleece::Dict dict)
 Returns true if the given dictionary is the persistent form of an Encryptable.
static Encryptable getEncryptableValue (fleece::Value value)
 Returns the Encryptable that the given value represents, if any.

Protected Member Functions

 Encryptable (CBLEncryptable *_Nullable ref)
 (Internal) Constructs a reference wrapping, and retaining, a C object pointer.

Detailed Description

A reference to an encryptable value associated with a document.

An Encryptable wraps a value (null, bool, number, string, array, dict) that should be encrypted by the push replicator and decrypted by the pull replicator. Its persistent form is a special dictionary in the document properties; construct an Encryptable from such a dictionary via Encryptable::getEncryptableValue.

Note
ENTERPRISE EDITION ONLY

Constructor & Destructor Documentation

◆ Encryptable() [1/6]

cbl::Encryptable::Encryptable ( fleece::Value value)
inlineexplicit

Creates an Encryptable wrapping an arbitrary Fleece value.

Parameters
valueThe value to be encrypted.

◆ Encryptable() [2/6]

cbl::Encryptable::Encryptable ( std::string_view value)
inlineexplicit

Creates an Encryptable wrapping a string value.

Parameters
valueThe string to be encrypted.

◆ Encryptable() [3/6]

cbl::Encryptable::Encryptable ( )
inlinenoexcept

Constructs a null reference (one that points to no object).

◆ Encryptable() [4/6]

cbl::Encryptable::Encryptable ( CBLEncryptable *_Nullable ref)
inlineexplicitprotected

(Internal) Constructs a reference wrapping, and retaining, a C object pointer.

◆ Encryptable() [5/6]

cbl::Encryptable::Encryptable ( const Encryptable & other)
inlinenoexcept

Copy constructor: creates another reference to the same object as other.

◆ Encryptable() [6/6]

cbl::Encryptable::Encryptable ( Encryptable && other)
inlinenoexcept

Move constructor: takes over the reference from other, leaving it a null reference.

Member Function Documentation

◆ createWithBool()

Encryptable cbl::Encryptable::createWithBool ( bool value)
inlinestatic

Creates an Encryptable wrapping a boolean value.

Parameters
valueThe value to be encrypted.
Note
Use factory method to avoid ambiguity.

◆ createWithDouble()

Encryptable cbl::Encryptable::createWithDouble ( double value)
inlinestatic

Creates an Encryptable wrapping a double value.

Parameters
valueThe value to be encrypted.
Note
Use factory method to avoid ambiguity.

◆ createWithFloat()

Encryptable cbl::Encryptable::createWithFloat ( float value)
inlinestatic

Creates an Encryptable wrapping a float value.

Parameters
valueThe value to be encrypted.
Note
Use factory method to avoid ambiguity.

◆ createWithInt()

Encryptable cbl::Encryptable::createWithInt ( int64_t value)
inlinestatic

Creates an Encryptable wrapping a signed integer value.

Parameters
valueThe value to be encrypted.
Note
Use factory method to avoid ambiguity.

◆ createWithNull()

Encryptable cbl::Encryptable::createWithNull ( )
inlinestatic

Creates an Encryptable wrapping a null value.

Note
Use factory method to avoid ambiguity.

◆ createWithUInt()

Encryptable cbl::Encryptable::createWithUInt ( uint64_t value)
inlinestatic

Creates an Encryptable wrapping an unsigned integer value.

Parameters
valueThe value to be encrypted.
Note
Use factory method to avoid ambiguity.

◆ getEncryptableValue()

Encryptable cbl::Encryptable::getEncryptableValue ( fleece::Value value)
inlinestatic

Returns the Encryptable that the given value represents, if any.

Parameters
valueA value from a document, expected to be an encryptable dictionary.
Returns
The corresponding Encryptable, or a falsy Encryptable if the value is not one.

◆ isEncryptableValue()

bool cbl::Encryptable::isEncryptableValue ( fleece::Dict dict)
inlinestatic

Returns true if the given dictionary is the persistent form of an Encryptable.

Parameters
dictThe dictionary to test.

◆ operator bool()

cbl::Encryptable::operator bool ( ) const
inlineexplicit

Returns true if this references an object (same as valid).

◆ operator!=()

bool cbl::Encryptable::operator!= ( const Encryptable & other) const
inline

Returns true if the two sides reference different objects.

◆ operator=() [1/3]

Encryptable & cbl::Encryptable::operator= ( const Encryptable & other)
inlinenoexcept

Copy assignment: replaces this reference with a reference to other's object.

◆ operator=() [2/3]

Encryptable & cbl::Encryptable::operator= ( Encryptable && other)
inlinenoexcept

Move assignment: replaces this reference with other's, leaving other a null reference.

◆ operator=() [3/3]

Encryptable & cbl::Encryptable::operator= ( std::nullptr_t )
inline

Releases the underlying object and resets this to a null reference.

◆ operator==()

bool cbl::Encryptable::operator== ( const Encryptable & other) const
inline

Returns true if both sides reference the same object, or are both null references.

◆ properties()

fleece::Dict cbl::Encryptable::properties ( ) const
inline

Returns the Encryptable's underlying dictionary representation (its persistent form).

◆ ref()

CBLEncryptable *_Nullable cbl::Encryptable::ref ( ) const
inline

Returns a pointer to the underlying C object (CBLEncryptable), or NULL if this is a null reference.

◆ setInto()

void cbl::Encryptable::setInto ( fleece::MutableDict dict,
fleece::slice key ) const
inline

Sets this encryptable value into dict under key.

Equivalent to the C API FLMutableDict_SetEncryptableValue.

◆ valid()

bool cbl::Encryptable::valid ( ) const
inline

Returns true if this references an object, or false if it is a null reference.

◆ value()

fleece::Value cbl::Encryptable::value ( ) const
inline

Returns the value to be encrypted by the push replicator.


The documentation for this class was generated from the following file: