Couchbase Lite C
Couchbase Lite C API
Macros
FLEncoder.h File Reference
#include "FLBase.h"
#include <stdio.h>

Go to the source code of this file.

Macros

#define _FLENCODER_H
 

Functions

Writing to the encoder
Note
The functions that write to the encoder do not return error codes, just a 'false' result on error. The actual error is attached to the encoder and can be accessed by calling FLEncoder_GetError or FLEncoder_End.

After an error occurs, the encoder will ignore all subsequent writes.

FLEECE_PUBLIC bool FLEncoder_WriteNull (FLEncoder)
 Writes a null value to an encoder. More...
 
FLEECE_PUBLIC bool FLEncoder_WriteUndefined (FLEncoder)
 Writes an undefined value to an encoder. More...
 
FLEECE_PUBLIC bool FLEncoder_WriteBool (FLEncoder, bool)
 Writes a boolean value (true or false) to an encoder. More...
 
FLEECE_PUBLIC bool FLEncoder_WriteInt (FLEncoder, int64_t)
 Writes an integer to an encoder. More...
 
FLEECE_PUBLIC bool FLEncoder_WriteUInt (FLEncoder, uint64_t)
 Writes an unsigned integer to an encoder. More...
 
FLEECE_PUBLIC bool FLEncoder_WriteFloat (FLEncoder, float)
 Writes a 32-bit floating point number to an encoder. More...
 
FLEECE_PUBLIC bool FLEncoder_WriteDouble (FLEncoder, double)
 Writes a 64-bit floating point number to an encoder. More...
 
FLEECE_PUBLIC bool FLEncoder_WriteString (FLEncoder, FLString)
 Writes a string to an encoder. More...
 
FLEECE_PUBLIC bool FLEncoder_WriteDateString (FLEncoder encoder, FLTimestamp ts, bool asUTC)
 Writes a timestamp to an encoder, as an ISO-8601 date string. More...
 
FLEECE_PUBLIC bool FLEncoder_WriteData (FLEncoder, FLSlice)
 Writes a binary data value (a blob) to an encoder. More...
 
FLEECE_PUBLIC bool FLEncoder_WriteValue (FLEncoder, FLValue)
 Writes a Fleece Value to an Encoder. More...
 
FLEECE_PUBLIC bool FLEncoder_BeginArray (FLEncoder, size_t reserveCount)
 Begins writing an array value to an encoder. More...
 
FLEECE_PUBLIC bool FLEncoder_EndArray (FLEncoder)
 Ends writing an array value; pops back the previous encoding state. More...
 
FLEECE_PUBLIC bool FLEncoder_BeginDict (FLEncoder, size_t reserveCount)
 Begins writing a dictionary value to an encoder. More...
 
FLEECE_PUBLIC bool FLEncoder_WriteKey (FLEncoder, FLString)
 Specifies the key for the next value to be written to the current dictionary. More...
 
FLEECE_PUBLIC bool FLEncoder_WriteKeyValue (FLEncoder, FLValue)
 Specifies the key for the next value to be written to the current dictionary. More...
 
FLEECE_PUBLIC bool FLEncoder_EndDict (FLEncoder)
 Ends writing a dictionary value; pops back the previous encoding state. More...
 
FLEECE_PUBLIC bool FLEncoder_WriteRaw (FLEncoder, FLSlice)
 Writes raw data directly to the encoded output. More...
 
Finishing up
MUST_USE_RESULT FLEECE_PUBLIC FLDoc FL_NULLABLE FLEncoder_FinishDoc (FLEncoder, FLError *FL_NULLABLE outError)
 Ends encoding; if there has been no error, it returns the encoded Fleece data packaged in an FLDoc. More...
 
MUST_USE_RESULT FLEECE_PUBLIC FLSliceResult FLEncoder_Finish (FLEncoder, FLError *FL_NULLABLE outError)
 Ends encoding; if there has been no error, it returns the encoded data, else null. More...
 
Error handling
FLEECE_PUBLIC FLError FLEncoder_GetError (FLEncoder)
 Returns the error code of an encoder, or NoError (0) if there's no error. More...
 
FLEECE_PUBLIC const char *FL_NULLABLE FLEncoder_GetErrorMessage (FLEncoder)
 Returns the error message of an encoder, or NULL if there's no error. More...
 

Setup and configuration

enum  FLEncoderFormat { kFLEncodeFleece , kFLEncodeJSON , kFLEncodeJSON5 }
 Output formats a FLEncoder can generate. More...
 
FLEECE_PUBLIC FLEncoder FLEncoder_New (void)
 Creates a new encoder, for generating Fleece data. More...
 
FLEECE_PUBLIC FLEncoder FLEncoder_NewWithOptions (FLEncoderFormat format, size_t reserveSize, bool uniqueStrings)
 Creates a new encoder, allowing some options to be customized. More...
 
FLEECE_PUBLIC FLEncoder FLEncoder_NewWritingToFile (FILE *, bool uniqueStrings)
 Creates a new Fleece encoder that writes to a file, not to memory. More...
 
FLEECE_PUBLIC void FLEncoder_Free (FLEncoder FL_NULLABLE)
 Frees the space used by an encoder. More...
 
FLEECE_PUBLIC void FLEncoder_SetSharedKeys (FLEncoder, FLSharedKeys FL_NULLABLE)
 Tells the encoder to use a shared-keys mapping when encoding dictionary keys. More...
 
FLEECE_PUBLIC void FLEncoder_SetExtraInfo (FLEncoder, void *FL_NULLABLE info)
 Associates an arbitrary user-defined value with the encoder. More...
 
FLEECE_PUBLIC void * FLEncoder_GetExtraInfo (FLEncoder)
 Returns the user-defined value associated with the encoder; NULL by default. More...
 
FLEECE_PUBLIC void FLEncoder_Reset (FLEncoder)
 Resets the state of an encoder without freeing it. More...
 
FLEECE_PUBLIC size_t FLEncoder_BytesWritten (FLEncoder)
 Returns the number of bytes encoded so far. More...
 

Macro Definition Documentation

◆ _FLENCODER_H

#define _FLENCODER_H