10#ifndef FDL_DOC_INTERNAL_H
11#define FDL_DOC_INTERNAL_H
13#include <jsoncons/json.hpp>
19namespace fdl::detail {
22using ojson = jsoncons::ojson;
47 [[nodiscard]]
const ojson&
data()
const {
return data_; }
58 [[nodiscard]] std::string
get_uuid()
const;
73 [[nodiscard]] std::string
to_canonical_json(
int indent = constants::kDefaultJsonIndent)
const;
85 mutable std::mutex
mtx;
95 std::unique_lock<std::mutex>
lock_;
102 if (doc !=
nullptr) {
103 lock_ = std::unique_lock<std::mutex>(doc->
mtx);
Internal document class wrapping the JSON data tree.
Definition fdl_doc.h:25
std::string get_fdl_creator() const
Get fdl_creator from the document.
Definition fdl_doc.cpp:27
Document(ojson data)
Construct from an existing JSON tree.
Definition fdl_doc.h:33
std::string get_uuid() const
Get UUID from the document.
Definition fdl_doc.cpp:20
ojson & data()
Access the internal JSON data (mutable).
Definition fdl_doc.h:52
const ojson & data() const
Access the internal JSON data (const).
Definition fdl_doc.h:47
std::string to_canonical_json(int indent=constants::kDefaultJsonIndent) const
Canonical JSON serialization.
Definition fdl_doc.cpp:34
static Document parse(const char *json_str, size_t json_len)
Parse JSON string.
Definition fdl_doc.cpp:15
jsoncons::ojson ojson
Alias for ordered JSON type.
Definition fdl_accessors_api.cpp:23
jsoncons::ojson ojson
Use ojson (ordered JSON) to preserve key insertion order for canonical serialization.
Definition fdl_builder.h:22
Internal handle types and handle cache for opaque FDL sub-objects.
RAII lock helper for per-document synchronization.
Definition fdl_doc.h:94
doc_lock(const fdl_doc *doc)
Acquire the document's mutex.
Definition fdl_doc.h:101
std::unique_lock< std::mutex > lock_
Held lock (empty if doc was null).
Definition fdl_doc.h:95
Opaque handle definition — shared across ABI translation units.
Definition fdl_doc.h:82
fdl::detail::Document doc
Document data tree.
Definition fdl_doc.h:83
fdl_handle_cache handles
Cache of sub-object handles.
Definition fdl_doc.h:84
std::mutex mtx
Per-document mutex for thread safety.
Definition fdl_doc.h:85
Cache container for all handle types — lives on fdl_doc.
Definition fdl_handles.h:121