From fb1865eb91bbd1dd81cce3f24095ee17fb985714 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Mon, 20 Mar 2023 17:43:44 +0100 Subject: [PATCH] sculpt: support for creating small files --- .../model/file_operation_queue.h | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/repos/gems/src/app/sculpt_manager/model/file_operation_queue.h b/repos/gems/src/app/sculpt_manager/model/file_operation_queue.h index 9a50d2345d..a4a391e77e 100644 --- a/repos/gems/src/app/sculpt_manager/model/file_operation_queue.h +++ b/repos/gems/src/app/sculpt_manager/model/file_operation_queue.h @@ -23,6 +23,11 @@ namespace Sculpt { struct File_operation_queue; } struct Sculpt::File_operation_queue : Noncopyable { + /* + * Content for 'new_small_file', as used for creating depot-user meta data + */ + struct Content { String<256> string; }; + struct Operation : Interface { enum class State { @@ -32,16 +37,21 @@ struct Sculpt::File_operation_queue : Noncopyable State state { State::PENDING }; - enum class Type { REMOVE_FILE, COPY_ALL_FILES } type; + enum class Type { REMOVE_FILE, COPY_ALL_FILES, NEW_SMALL_FILE } type; Path const from { }; Path const path; /* destination */ + Content const content { }; + Operation(Type type, Path const &path) : type(type), path(path) { } Operation(Type type, Path const &from, Path const &to) : type(type), from(from), path(to) { } + Operation(Path const &path, Content const &content) + : type(Type::NEW_SMALL_FILE), path(path), content(content) { } + void gen_fs_tool_config(Xml_generator &xml) const { if (state != State::IN_PROGRESS) @@ -59,6 +69,12 @@ struct Sculpt::File_operation_queue : Noncopyable xml.attribute("from", from); xml.attribute("to", path); }); break; + + case Type::NEW_SMALL_FILE: + xml.node("new-file", [&] { + xml.attribute("path", path); + xml.append_sanitized(content.string.string()); }); + break; } } }; @@ -100,6 +116,11 @@ struct Sculpt::File_operation_queue : Noncopyable return result; } + void new_small_file(Path const &path, Content const &content) + { + new (_alloc) Registered(_operations, path, content); + } + bool any_operation_in_progress() const { bool any_in_progress = false;