In fleece, what is the difference between class Value defined in API/fleece/Fleece.hh and class Value defined in Fleece/Core.Value.hh

In fleece, what is the difference between class Value defined in API/fleece/Fleece.hh and class Value defined in Fleece/Core.Value.hh?

The short answer: fleece/Fleece.hh is public API, Core/Value.hh is internal implementation. Please use the public API.

Fleece is implemented in C++, but C++ classes can’t be used as public APIs for a number of reasons. So the public API consists of C functions that wrap the C++ (that’s fleece/Fleece.h). Then for the convenience of C++ clients there are C++ classes that wrap the C API (that’s fleece/Fleece.hh.)

(The confusing part is that much of the implementation of LiteCore uses the internal Fleece APIs. It can do this because it’s statically linked with Fleece. This was done before Fleece needed to be exposed as public API, so the C and C++ wrappers hadn’t been created yet. The replicator code, however, does use the public API.)

1 Like