#include "fson/Document.hh"
A complete FSON file: header comments + a never-null root Value + footer comments. Non-copyable, non-movable. Through v0.8.0.0 the root was always an Object; since v0.9.0.0 it may be any value.
| Member | Description |
|---|---|
Document() | empty root object |
getRoot() → Object& | throws std::out_of_range when the root is not an Object (kept for source-compat with object-rooted documents) |
getRootObject() → Object* | nullptr when the root is not an Object, instead of throwing |
getRootValue() → Value& | the root, whatever its type |
setRoot(std::unique_ptr<Value>) | throws std::invalid_argument on null; a unique_ptr<Object> converts implicitly |
getHeaderComments() → CommentList& | trivia before the value |
getFooterComments() → CommentList& | trivia after the value |
Forwarded path API
Every Object path method and typed getter is forwarded on Document through getRootObject(). When the root is not an object: findPath / setPath return nullptr, containsPath / removePath return false, the typed getters return their fallback, and atPath throws std::out_of_range.
Document& doc = *result.document;
long long port = doc.getInteger( "database.port", 5432 ); // forwarded
Object* root = doc.getRootObject(); // may be null

