yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
dock_tree_json.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_LAYOUT_LAYOUT_DESIGNER_DOCK_TREE_JSON_H_
2#define YAZE_APP_EDITOR_LAYOUT_LAYOUT_DESIGNER_DOCK_TREE_JSON_H_
3
4#include "absl/status/statusor.h"
6#include "nlohmann/json.hpp"
7
8namespace yaze {
9namespace editor {
10namespace layout_designer {
11
12// Serialize a DockTree to its canonical JSON shape. Infallible — any
13// in-memory tree round-trips. Does not validate, since callers have
14// already done so via DockTree::Validate or are explicitly persisting
15// a partially-constructed tree.
16nlohmann::json DockTreeToJson(const DockTree& tree);
17
18// Parse a JSON object into a DockTree. Returns an InvalidArgument status
19// on malformed input. Unknown fields are silently ignored (forward-
20// compat). The returned tree is NOT Validate()d — callers can do so if
21// they want to reject otherwise-parseable-but-semantically-invalid
22// shapes (e.g. ratios out of range).
23//
24// Optional fields and their defaults:
25// schema_version: 1
26// description: ""
27// leaf panels[].display_name / .icon: ""
28// active_tab_index: 0
29absl::StatusOr<DockTree> DockTreeFromJson(const nlohmann::json& j);
30
31} // namespace layout_designer
32} // namespace editor
33} // namespace yaze
34
35#endif // YAZE_APP_EDITOR_LAYOUT_LAYOUT_DESIGNER_DOCK_TREE_JSON_H_
absl::StatusOr< DockTree > DockTreeFromJson(const nlohmann::json &j)
nlohmann::json DockTreeToJson(const DockTree &tree)