yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
layout_serialization.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_LAYOUT_DESIGNER_LAYOUT_SERIALIZATION_H_
2#define YAZE_APP_EDITOR_LAYOUT_DESIGNER_LAYOUT_SERIALIZATION_H_
3
4#include <string>
5
7#include "absl/status/statusor.h"
8
9namespace yaze {
10namespace editor {
11namespace layout_designer {
12
18 public:
24 static std::string ToJson(const LayoutDefinition& layout);
25
31 static absl::StatusOr<LayoutDefinition> FromJson(const std::string& json_str);
32
39 static absl::Status SaveToFile(const LayoutDefinition& layout,
40 const std::string& filepath);
41
47 static absl::StatusOr<LayoutDefinition> LoadFromFile(const std::string& filepath);
48
49 private:
50 // Helper methods for converting individual components
51 static std::string SerializePanel(const LayoutPanel& panel);
52 static std::string SerializeDockNode(const DockNode& node);
53
54 static LayoutPanel DeserializePanel(const std::string& json);
55 static std::unique_ptr<DockNode> DeserializeDockNode(const std::string& json);
56};
57
58} // namespace layout_designer
59} // namespace editor
60} // namespace yaze
61
62#endif // YAZE_APP_EDITOR_LAYOUT_DESIGNER_LAYOUT_SERIALIZATION_H_
63
Handles JSON serialization and deserialization of layouts.
static absl::StatusOr< LayoutDefinition > LoadFromFile(const std::string &filepath)
Load layout from JSON file.
static absl::Status SaveToFile(const LayoutDefinition &layout, const std::string &filepath)
Save layout to JSON file.
static absl::StatusOr< LayoutDefinition > FromJson(const std::string &json_str)
Deserialize a layout from JSON string.
static std::string ToJson(const LayoutDefinition &layout)
Serialize a layout to JSON string.
static std::unique_ptr< DockNode > DeserializeDockNode(const std::string &json)
static LayoutPanel DeserializePanel(const std::string &json)
static std::string SerializeDockNode(const DockNode &node)
static std::string SerializePanel(const LayoutPanel &panel)
Represents a dock node in the layout tree.
Complete layout definition with metadata.
Represents a single panel in a layout.