From 7865f8e7f214848d6ed035e8b054ab25e9a07e9d Mon Sep 17 00:00:00 2001 From: Bjorn Fahller Date: Sat, 9 Apr 2016 21:09:45 +0200 Subject: [PATCH] Keep ModulePtr kompatible functions Since use of (one of) the functions in bootstrap_stl.hpp is in a sample, chances are there are people using them in real world application code. Thus the backwards compatible versions. --- .../chaiscript/dispatchkit/bootstrap_stl.hpp | 115 +++++++++++++++++- 1 file changed, 113 insertions(+), 2 deletions(-) diff --git a/include/chaiscript/dispatchkit/bootstrap_stl.hpp b/include/chaiscript/dispatchkit/bootstrap_stl.hpp index d7f82f0..3c5f52b 100644 --- a/include/chaiscript/dispatchkit/bootstrap_stl.hpp +++ b/include/chaiscript/dispatchkit/bootstrap_stl.hpp @@ -236,6 +236,13 @@ namespace chaiscript detail::input_range_type_impl >("Const_" + type, m); return m; } + template + ModulePtr input_range_type(const std::string &type) + { + auto m = std::make_shared(); + input_range_type(type, *m); + return m; + } /// Add random_access_container concept to the given ContainerType @@ -263,6 +270,14 @@ namespace chaiscript return m; } + template + ModulePtr random_access_container_type(const std::string &type) + { + auto m = std::make_shared(); + random_access_container_type(type, *m); + return m; + } + /// Add assignable concept to the given ContainerType @@ -274,6 +289,13 @@ namespace chaiscript operators::assign(m); return m; } + template + ModulePtr assignable_type(const std::string &type) + { + auto m = std::make_shared(); + assignable_type(type, *m); + return m; + } /// Add container concept to the given ContainerType @@ -286,6 +308,13 @@ namespace chaiscript m.add(fun([](ContainerType *a) { a->clear(); } ), "clear"); return m; } + template + ModulePtr container_type(const std::string& type) + { + auto m = std::make_shared(); + container_type(type, *m); + return m; + } /// Add default constructable concept to the given Type @@ -296,7 +325,13 @@ namespace chaiscript m.add(constructor(), type); return m; } - + template + ModulePtr default_constructible_type(const std::string& type) + { + auto m = std::make_shared(); + default_constructible_type(type, *m); + return m; + } @@ -318,7 +353,13 @@ namespace chaiscript return m; } - + template + ModulePtr sequence_type(const std::string &type) + { + auto m = std::make_shared(); + sequence_type(type, *m); + return m; + } /// Add back insertion sequence concept to the given ContainerType /// http://www.sgi.com/tech/stl/BackInsertionSequence.html @@ -356,6 +397,13 @@ namespace chaiscript m.add(fun(&ContainerType::pop_back), "pop_back"); return m; } + template + ModulePtr back_insertion_sequence_type(const std::string &type) + { + auto m = std::make_shared(); + back_insertion_sequence_type(type, *m); + return m; + } @@ -396,6 +444,13 @@ namespace chaiscript m.add(fun(static_cast(&ContainerType::pop_front)), "pop_front"); return m; } + template + ModulePtr front_insertion_sequence_type(const std::string &type) + { + auto m = std::make_shared(); + front_insertion_sequence_type(type, *m); + return m; + } /// bootstrap a given PairType @@ -417,6 +472,13 @@ namespace chaiscript return m; } + template + ModulePtr pair_type(const std::string &type) + { + auto m = std::make_shared(); + pair_type(type, *m); + return m; + } @@ -430,6 +492,13 @@ namespace chaiscript return m; } + template + ModulePtr pair_associative_container_type(const std::string &type) + { + auto m = std::make_shared(); + pair_associative_container_type(type, *m); + return m; + } /// Add unique associative container concept to the given ContainerType @@ -457,6 +526,13 @@ namespace chaiscript return m; } + template + ModulePtr unique_associative_container_type(const std::string &type) + { + auto m = std::make_shared(); + unique_associative_container_type(type, *m); + return m; + } /// Add a MapType container @@ -507,6 +583,13 @@ namespace chaiscript return m; } + template + ModulePtr map_type(const std::string &type) + { + auto m = std::make_shared(); + map_type(type, *m); + return m; + } /// hopefully working List type @@ -526,6 +609,13 @@ namespace chaiscript return m; } + template + ModulePtr list_type(const std::string &type) + { + auto m = std::make_shared(); + list_type(type, m); + return m; + } /// Create a vector type with associated concepts @@ -576,6 +666,13 @@ namespace chaiscript return m; } + template + ModulePtr vector_type(const std::string &type) + { + auto m = std::make_shared(); + vector_type(type, *m); + return m; + } /// Add a String container /// http://www.sgi.com/tech/stl/basic_string.html @@ -621,6 +718,13 @@ namespace chaiscript return m; } + template + ModulePtr string_type(const std::string &type) + { + auto m = std::make_shared(); + string_type(type, *m); + return m; + } @@ -635,6 +739,13 @@ namespace chaiscript m.add(fun(&FutureType::get), "get"); m.add(fun(&FutureType::wait), "wait"); + return m; + } + template + ModulePtr future_type(const std::string &type) + { + auto m = std::make_shared(); + future_type(type, *m); return m; } }