LiteCore
Couchbase Lite cross-platform core implementation
Loading...
Searching...
No Matches
Miscellaneous Functions

Macros

#define kC4EnvironmentTimezoneKey   "tz"
 
#define kC4EnvironmentSupportedLocales   "supported_locales"
 

Functions

CBL_CORE_API C4StringResult c4_getBuildInfo (void)
 A string describing the version of LiteCore.
 
CBL_CORE_API C4StringResult c4_getVersion (void)
 A short version string.
 
C4SliceResult c4_getEnvironmentInfo (void)
 Returns information about LiteCore's view of the environment in the following format:
 
CBL_CORE_API C4Timestamp c4_now (void)
 Returns the current time, in milliseconds since 1/1/1970.
 
NODISCARD CBL_CORE_API bool c4_setTempDir (C4String path, C4Error *err)
 Wiring call for platforms without discoverable temporary directories.
 
CBL_CORE_API void c4_runAsyncTask (void(*task)(void *), void *context)
 Schedules a function to be called asynchronously on a background thread.
 

Detailed Description

Macro Definition Documentation

◆ kC4EnvironmentSupportedLocales

#define kC4EnvironmentSupportedLocales   "supported_locales"

◆ kC4EnvironmentTimezoneKey

#define kC4EnvironmentTimezoneKey   "tz"

Function Documentation

◆ c4_getBuildInfo()

CBL_CORE_API C4StringResult c4_getBuildInfo ( void )

A string describing the version of LiteCore.

Currently this just describes the Git branch and commit, in the form "Built from master branch, commit 0bc68f0d".

◆ c4_getEnvironmentInfo()

C4SliceResult c4_getEnvironmentInfo ( void )

Returns information about LiteCore's view of the environment in the following format:

Fleece Encoded Dictionary { kC4EnvironmentTimezoneKey: numeric offset from UTC in seconds kC4EnvironmentSupportedLocales: string array of locale identifiers }

◆ c4_getVersion()

CBL_CORE_API C4StringResult c4_getVersion ( void )

A short version string.

◆ c4_now()

CBL_CORE_API C4Timestamp c4_now ( void )

Returns the current time, in milliseconds since 1/1/1970.

◆ c4_runAsyncTask()

CBL_CORE_API void c4_runAsyncTask ( void(* task )(void *),
void * context )

Schedules a function to be called asynchronously on a background thread.

Parameters
taskA pointer to the function to run. It must take a single void* argument and return void. If it needs to return a value, it should call some other function you define and pass that value as a parameter.
contextAn arbitrary pointer that will be passed to the function. You can use this to provide state. Obviously, whatever this points to must remain valid until the future time when task is called.

◆ c4_setTempDir()

NODISCARD CBL_CORE_API bool c4_setTempDir ( C4String path,
C4Error * err )

Wiring call for platforms without discoverable temporary directories.

Simply sets the SQLite temp directory so that it can write its temporary files without error. Several platforms need to do this, but not all need to use this API.

Note
This function is not thread-safe.
Parameters
pathThe path to a writable directory for temporary files for SQLite
errIf an error happens (e.g. it is an error to call this function twice), this parameter records it.
Note
If you do call this function, you should call it before opening any databases.
Needless to say, the directory must already exist.