Couchbase Lite C
Couchbase Lite C API
Macros | Enumerations | Variables
FLValue.h File Reference
#include "FLBase.h"

Go to the source code of this file.

Macros

#define _FLVALUE_H
 

Enumerations

enum  FLValueType {
  kFLUndefined = -1 , kFLNull = 0 , kFLBoolean , kFLNumber ,
  kFLString , kFLData , kFLArray , kFLDict
}
 Types of Fleece values. More...
 

Functions

Accessors
FLEECE_PUBLIC FLValueType FLValue_GetType (FLValue FL_NULLABLE) FLPURE
 Returns the data type of an arbitrary value. More...
 
FLEECE_PUBLIC bool FLValue_IsInteger (FLValue FL_NULLABLE) FLPURE
 Returns true if the value is non-NULL and represents an integer. More...
 
FLEECE_PUBLIC bool FLValue_IsUnsigned (FLValue FL_NULLABLE) FLPURE
 Returns true if the value is non-NULL and represents an integer >= 2^63. More...
 
FLEECE_PUBLIC bool FLValue_IsDouble (FLValue FL_NULLABLE)
 Returns true if the value is non-NULL and represents a 64-bit floating-point number. More...
 
FLEECE_PUBLIC bool FLValue_AsBool (FLValue FL_NULLABLE) FLPURE
 Returns a value coerced to boolean. More...
 
FLEECE_PUBLIC int64_t FLValue_AsInt (FLValue FL_NULLABLE) FLPURE
 Returns a value coerced to an integer. More...
 
FLEECE_PUBLIC uint64_t FLValue_AsUnsigned (FLValue FL_NULLABLE) FLPURE
 Returns a value coerced to an unsigned integer. More...
 
FLEECE_PUBLIC float FLValue_AsFloat (FLValue FL_NULLABLE) FLPURE
 Returns a value coerced to a 32-bit floating point number. More...
 
FLEECE_PUBLIC double FLValue_AsDouble (FLValue FL_NULLABLE) FLPURE
 Returns a value coerced to a 32-bit floating point number. More...
 
FLEECE_PUBLIC FLString FLValue_AsString (FLValue FL_NULLABLE) FLPURE
 Returns the exact contents of a string value, or null for all other types. More...
 
FLEECE_PUBLIC FLTimestamp FLValue_AsTimestamp (FLValue FL_NULLABLE) FLPURE
 Converts a value to a timestamp, in milliseconds since Unix epoch, or INT64_MIN on failure. More...
 
FLEECE_PUBLIC FLSlice FLValue_AsData (FLValue FL_NULLABLE) FLPURE
 Returns the exact contents of a data value, or null for all other types. More...
 
FLEECE_PUBLIC FLArray FL_NULLABLE FLValue_AsArray (FLValue FL_NULLABLE) FLPURE
 If a FLValue represents an array, returns it cast to FLArray, else NULL. More...
 
FLEECE_PUBLIC FLDict FL_NULLABLE FLValue_AsDict (FLValue FL_NULLABLE) FLPURE
 If a FLValue represents a dictionary, returns it as an FLDict, else NULL. More...
 
FLEECE_PUBLIC FLStringResult FLValue_ToString (FLValue FL_NULLABLE)
 Returns a string representation of any scalar value. More...
 
FLEECE_PUBLIC bool FLValue_IsEqual (FLValue FL_NULLABLE v1, FLValue FL_NULLABLE v2) FLPURE
 Compares two values for equality. More...
 
FLEECE_PUBLIC bool FLValue_IsMutable (FLValue FL_NULLABLE) FLPURE
 Returns true if the value is mutable. More...
 
Reference-Counting

Retaining a value extends its lifespan (and that of any values contained in it) until at least such time that it's released.

  • If the value comes from an FLDoc, the doc's ref-count will be incremented.
  • If the value is mutable (heap-based), it has its own ref-count that will be incremented.
    Warning
    Values obtained from FLValue_FromData don't match either of those critera. Their lifespan is entirely determined by the caller-provided data pointer, so the retain call can't do anything about it. In this situation Fleece will throw an exception like "Can't retain immutable Value that's not part of a Doc."
FLEECE_PUBLIC FLValue FL_NULLABLE FLValue_Retain (FLValue FL_NULLABLE)
 Increments the ref-count of a mutable value, or of an immutable value's FLDoc. More...
 
FLEECE_PUBLIC void FLValue_Release (FLValue FL_NULLABLE)
 Decrements the ref-count of a mutable value, or of an immutable value's FLDoc. More...
 
static FLArray FL_NULLABLE FLArray_Retain (FLArray FL_NULLABLE v)
 
static void FLArray_Release (FLArray FL_NULLABLE v)
 
static FLDict FL_NULLABLE FLDict_Retain (FLDict FL_NULLABLE v)
 
static void FLDict_Release (FLDict FL_NULLABLE v)
 

Variables

FLEECE_PUBLIC const FLValue kFLNullValue
 A constant null value (like a JSON null, not a NULL pointer!) More...
 
FLEECE_PUBLIC const FLValue kFLUndefinedValue
 A constant undefined value. More...
 

Macro Definition Documentation

◆ _FLVALUE_H

#define _FLVALUE_H