Skip to content

Commit

Permalink
♻️ Continue moving all the bits of code that need "cereal/archives/js…
Browse files Browse the repository at this point in the history
…on.hpp" in the same file
  • Loading branch information
JulesFouchy committed Sep 30, 2023
1 parent 2a5d64f commit 57db3c9
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/Module_Nodes/NodesCategoryConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ namespace Lab {

void NodesCategoryConfig::save_to_json() const
{
do_serialize(*this, _path_to_json);
do_save(*this, _path_to_json);
}

void NodesCategoryConfig::load_from_json()
{
do_deserialize(*this, _path_to_json)
do_load(*this, _path_to_json)
.send_error_if_any([&](std::string const& message) {
return Cool::Message{
.category = "Nodes Category",
Expand Down
2 changes: 1 addition & 1 deletion src/ProjectManager/Command_OpenProject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Lab {
void Command_OpenProject::execute(CommandExecutionContext_Ref const& ctx) const
{
auto project = Project{};
auto const error = do_deserialize(project, path);
auto const error = do_load(project, path);
if (error)
{
error.send_error_if_any(
Expand Down
2 changes: 1 addition & 1 deletion src/ProjectManager/internal_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void set_current_project(CommandExecutionContext_Ref const& ctx, Project&& proje

auto save_project_to(CommandExecutionContext_Ref const& ctx, std::filesystem::path const& path) -> bool
{
bool const success = do_serialize(ctx.project(), path);
bool const success = do_save(ctx.project(), path);
if (success)
{
if (!ctx.project_path().has_value() && path != Path::untitled_project())
Expand Down
4 changes: 2 additions & 2 deletions src/Serialization/SNodesCategoryConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Lab {

auto do_serialize(NodesCategoryConfig const&, std::filesystem::path const&) -> bool;
auto do_deserialize(NodesCategoryConfig&, std::filesystem::path const&) -> Cool::OptionalErrorMessage;
auto do_save(NodesCategoryConfig const&, std::filesystem::path const&) -> bool;
auto do_load(NodesCategoryConfig&, std::filesystem::path const&) -> Cool::OptionalErrorMessage;

} // namespace Lab
4 changes: 2 additions & 2 deletions src/Serialization/SProject.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Lab {

auto do_serialize(Project const&, std::filesystem::path const&) -> bool;
auto do_deserialize(Project&, std::filesystem::path const&) -> Cool::OptionalErrorMessage;
auto do_save(Project const&, std::filesystem::path const&) -> bool;
auto do_load(Project&, std::filesystem::path const&) -> Cool::OptionalErrorMessage;

} // namespace Lab
8 changes: 4 additions & 4 deletions src/Serialization/impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@

namespace Lab {

auto do_serialize(Project const& project, std::filesystem::path const& path) -> bool
auto do_save(Project const& project, std::filesystem::path const& path) -> bool
{
return Cool::Serialization::save<Project, cereal::JSONOutputArchive>(project, path, "Project");
}
auto do_deserialize(Project& project, std::filesystem::path const& path) -> Cool::OptionalErrorMessage
auto do_load(Project& project, std::filesystem::path const& path) -> Cool::OptionalErrorMessage
{
return Cool::Serialization::load<Project, cereal::JSONInputArchive>(project, path);
}

auto do_serialize(NodesCategoryConfig const& config, std::filesystem::path const& path) -> bool
auto do_save(NodesCategoryConfig const& config, std::filesystem::path const& path) -> bool
{
return Cool::Serialization::save<NodesCategoryConfig, cereal::JSONOutputArchive>(config, path);
}
auto do_deserialize(NodesCategoryConfig& config, std::filesystem::path const& path) -> Cool::OptionalErrorMessage
auto do_load(NodesCategoryConfig& config, std::filesystem::path const& path) -> Cool::OptionalErrorMessage
{
return Cool::Serialization::load<NodesCategoryConfig, cereal::JSONInputArchive>(config, path);
}
Expand Down

0 comments on commit 57db3c9

Please sign in to comment.