A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://couchbase.github.io/couchbase-lite-core/C/html/group___f_l_value.html below:

LiteCore: Fleece Values

The core Fleece data type is FLValue: a reference to a value in Fleece-encoded data. More...

The core Fleece data type is FLValue: a reference to a value in Fleece-encoded data.

An FLValue can represent any JSON type (plus binary data).

Note
It's safe to pass a NULL pointer to an FLValue, FLArray or FLDict function parameter, except where specifically noted.
Conversion/accessor functions that take FLValue won't complain if the value isn't of the desired subtype; they'll just return some default like 0 or NULL. For example, FLValue_AsInt will return 0 if passed a non-integer value or NULL.
◆ FLValueType

Types of Fleece values.

Basically JSON, with the addition of Data (raw blob).

Enumerator kFLUndefined 

Type of a NULL pointer, i.e.

no such value, like JSON undefined. Also the type of kFLUndefinedValue, and of a value created by FLEncoder_WriteUndefined().

kFLNull 

Equivalent to a JSON 'null'.

kFLBoolean 

A true or false value.

kFLNumber 

A numeric value, either integer or floating-point.

kFLString 

A string.

kFLData 

Binary data (no JSON equivalent)

kFLArray 

An array of values.

kFLDict 

A mapping of strings to values (AKA "object" in JSON.)

◆ FLArray_Release() ◆ FLArray_Retain() ◆ FLDict_Release() ◆ FLDict_Retain() ◆ FLValue_AsArray()

If a FLValue represents an array, returns it cast to FLArray, else NULL.

◆ FLValue_AsBool()

Returns a value coerced to boolean.

This will be true unless the value is NULL (undefined), null, false, or zero.

◆ FLValue_AsData()

Returns the exact contents of a data value, or null for all other types.

◆ FLValue_AsDict()

If a FLValue represents a dictionary, returns it as an FLDict, else NULL.

◆ FLValue_AsDouble()

Returns a value coerced to a 32-bit floating point number.

True and false are returned as 1.0 and 0.0, and integers are converted to float. All other types are returned as 0.0.

Warning
Very large integers (outside approximately +/- 2^50) will lose precision due to the limitations of IEEE 32-bit float format.
◆ FLValue_AsFloat()

Returns a value coerced to a 32-bit floating point number.

True and false are returned as 1.0 and 0.0, and integers are converted to float. All other types are returned as 0.0.

Warning
Large integers (outside approximately +/- 2^23) will lose precision due to the limitations of IEEE 32-bit float format.
◆ FLValue_AsInt()

Returns a value coerced to an integer.

True and false are returned as 1 and 0, and floating-point numbers are rounded. All other types are returned as 0.

Warning
Large 64-bit unsigned integers (2^63 and above) will come out wrong. You can check for these by calling FLValueIsUnsigned.
◆ FLValue_AsString()

Returns the exact contents of a string value, or null for all other types.

◆ FLValue_AsTimestamp()

Converts a value to a timestamp, in milliseconds since Unix epoch, or INT64_MIN on failure.

◆ FLValue_AsUnsigned()

Returns a value coerced to an unsigned integer.

This is the same as FLValueAsInt except that it can't handle negative numbers, but does correctly return large uint64_t values of 2^63 and up.

◆ FLValue_GetType()

Returns the data type of an arbitrary value.

If the parameter is a NULL pointer, returns kFLUndefined.

◆ FLValue_IsDouble()

Returns true if the value is non-NULL and represents a 64-bit floating-point number.

◆ FLValue_IsEqual()

Compares two values for equality.

This is a deep recursive comparison.

◆ FLValue_IsInteger()

Returns true if the value is non-NULL and represents an integer.

◆ FLValue_IsMutable()

Returns true if the value is mutable.

◆ FLValue_IsUnsigned()

Returns true if the value is non-NULL and represents an integer >= 2^63.

Such a value can't be represented in C as an int64_t, only a uint64_t, so you should access it by calling FLValueAsUnsigned, not FLValueAsInt, which would return an incorrect (negative) value.

◆ FLValue_Release()

Decrements the ref-count of a mutable value, or of an immutable value's FLDoc.

If the ref-count reaches zero the corresponding object is freed.

Warning
It is illegal to call this on a value obtained from FLValue_FromData.
◆ FLValue_Retain()

Increments the ref-count of a mutable value, or of an immutable value's FLDoc.

Warning
It is illegal to call this on a value obtained from FLValue_FromData.
◆ FLValue_ToString()

Returns a string representation of any scalar value.

Data values are returned in raw form. Arrays and dictionaries don't have a representation and will return NULL.

◆ kFLNullValue

A constant null value (like a JSON null, not a NULL pointer!)

◆ kFLUndefinedValue

A constant undefined value.

This is not a NULL pointer, but its type is kFLUndefined. It can be stored in an FLMutableArray or FLMutableDict if you really, really need to store an undefined/empty value, not just a JSON null.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4