mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:47:35 +00:00
HexEditor: Save and load annotations to/from JSON files
This is a fairly simple JSON format: A single array, containing objects, with the Annotation fields as key:value pairs. When reading a file, we let invalid or missing keys fall back to the default values. This is mostly intended to set a pattern so that if we add new fields in the future, we won't fail to load old annotations files. If loading the file fails though, we keep the previously loaded set of annotations.
This commit is contained in:
parent
b2bb7d919d
commit
56caee44e3
4 changed files with 110 additions and 0 deletions
|
@ -65,6 +65,9 @@ public:
|
|||
void delete_annotation(Annotation const&);
|
||||
Optional<Annotation&> closest_annotation_at(size_t position);
|
||||
|
||||
ErrorOr<void> save_to_file(Core::File&) const;
|
||||
ErrorOr<void> load_from_file(Core::File&);
|
||||
|
||||
private:
|
||||
Vector<Annotation> m_annotations;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue