From 036dd57524083f9d196f06a553aaeaaf1a17492d Mon Sep 17 00:00:00 2001 From: King_DuckZ Date: Sat, 14 May 2022 18:06:35 +0200 Subject: [PATCH] Allow chaining calls to add_class_maker() --- include/wrenpp/class_manager.hpp | 2 +- src/class_manager.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/wrenpp/class_manager.hpp b/include/wrenpp/class_manager.hpp index d3345fb..457108b 100644 --- a/include/wrenpp/class_manager.hpp +++ b/include/wrenpp/class_manager.hpp @@ -79,7 +79,7 @@ namespace wren { ClassManager(); ~ClassManager() noexcept; - void add_class_maker (std::string_view module_name, std::string_view class_name, make_foreign_class_t); + ClassManager& add_class_maker (std::string_view module_name, std::string_view class_name, make_foreign_class_t); foreign_class_t make_class(std::string_view module_name, std::string_view class_name); private: diff --git a/src/class_manager.cpp b/src/class_manager.cpp index f0499c3..859f6ef 100644 --- a/src/class_manager.cpp +++ b/src/class_manager.cpp @@ -74,7 +74,7 @@ namespace wren { ClassManager::ClassManager() = default; ClassManager::~ClassManager() noexcept = default; - void ClassManager::add_class_maker (std::string_view module_name, std::string_view class_name, make_foreign_class_t maker) { + ClassManager& ClassManager::add_class_maker (std::string_view module_name, std::string_view class_name, make_foreign_class_t maker) { using detail::TempClassName; using detail::ClassNameOwning; @@ -83,6 +83,8 @@ namespace wren { m_classes.insert(it_found, std::make_pair(ClassNameOwning{module_name, class_name}, maker)); else it_found->second = maker; + + return *this; } foreign_class_t ClassManager::make_class (std::string_view module_name, std::string_view class_name) {