FDL Core Library
ASC Framing Decision List — C/C++ Reference Implementation
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions
fdl::detail::Document Class Reference

Internal document class wrapping the JSON data tree. More...

#include <fdl_doc.h>

Public Member Functions

 Document (ojson data)
 Construct from an existing JSON tree.
 
const ojson & data () const
 Access the internal JSON data (const).
 
ojson & data ()
 Access the internal JSON data (mutable).
 
std::string get_uuid () const
 Get UUID from the document.
 
std::string get_fdl_creator () const
 Get fdl_creator from the document.
 
std::string to_canonical_json (int indent=constants::kDefaultJsonIndent) const
 Canonical JSON serialization.
 

Static Public Member Functions

static Document parse (const char *json_str, size_t json_len)
 Parse JSON string.
 

Detailed Description

Internal document class wrapping the JSON data tree.

Constructor & Destructor Documentation

◆ Document()

fdl::detail::Document::Document ( ojson  data)
inlineexplicit

Construct from an existing JSON tree.

Parameters
dataJSON data (moved into the document).

Member Function Documentation

◆ parse()

Document fdl::detail::Document::parse ( const char *  json_str,
size_t  json_len 
)
static

Parse JSON string.

Throws jsoncons::ser_error on failure.

Parameters
json_strPointer to JSON text.
json_lenLength of JSON text in bytes.
Returns
Parsed Document.

◆ data() [1/2]

const ojson & fdl::detail::Document::data ( ) const
inline

Access the internal JSON data (const).

Returns
Const reference to the ojson tree.

◆ data() [2/2]

ojson & fdl::detail::Document::data ( )
inline

Access the internal JSON data (mutable).

Returns
Mutable reference to the ojson tree.

◆ get_uuid()

std::string fdl::detail::Document::get_uuid ( ) const

Get UUID from the document.

Returns
UUID string, or empty string if missing.

◆ get_fdl_creator()

std::string fdl::detail::Document::get_fdl_creator ( ) const

Get fdl_creator from the document.

Returns
Creator string, or empty string if missing.

◆ to_canonical_json()

std::string fdl::detail::Document::to_canonical_json ( int  indent = constants::kDefaultJsonIndent) const

Canonical JSON serialization.

Reorders keys per FDL type-specific tables and strips null values.

Parameters
indentSpaces per indent level (default 2, 0 for compact).
Returns
Formatted JSON string.

The documentation for this class was generated from the following files: