diff --git a/include/chaiscript/dispatchkit/bootstrap_stl.hpp b/include/chaiscript/dispatchkit/bootstrap_stl.hpp index 88fed35..ff5cbf1 100644 --- a/include/chaiscript/dispatchkit/bootstrap_stl.hpp +++ b/include/chaiscript/dispatchkit/bootstrap_stl.hpp @@ -625,6 +625,9 @@ namespace chaiscript typedef typename String::size_type (String::*find_func_ptr)(const String &, typename String::size_type) const; typedef boost::function find_func; + typedef String (String::*substr_ptr)(typename String::size_type, typename String::size_type) const; + typedef boost::function substr_func; + m->add(fun(find_func(detail::return_int(static_cast(&String::find)))), "find"); m->add(fun(find_func(detail::return_int(static_cast(&String::rfind)))), "rfind"); m->add(fun(find_func(detail::return_int(static_cast(&String::find_first_of)))), "find_first_of"); @@ -632,6 +635,8 @@ namespace chaiscript m->add(fun(find_func(detail::return_int(static_cast(&String::find_first_not_of)))), "find_first_not_of"); m->add(fun(find_func(detail::return_int(static_cast(&String::find_last_not_of)))), "find_last_not_of"); + m->add(fun(substr_func(static_cast(&String::substr))), "substr"); + m->add(fun(&String::c_str), "c_str"); m->add(fun(&String::data), "data"); diff --git a/unittests/number_suffixes.chai b/unittests/number_suffixes.chai new file mode 100644 index 0000000..99ac03f --- /dev/null +++ b/unittests/number_suffixes.chai @@ -0,0 +1,11 @@ +assert_equal(true, int_type.bare_equal(1.get_type_info())) +assert_equal(true, unsigned_int_type.bare_equal(1u.get_type_info())) +assert_equal(true, unsigned_long_type.bare_equal(1lu.get_type_info())) +assert_equal(true, long_type.bare_equal(1l.get_type_info())) +assert_equal(true, int64_t_type.bare_equal(1ll.get_type_info())) +assert_equal(true, uint64_t_type.bare_equal(1ull.get_type_info())) + +assert_equal(true, double_type.bare_equal(1.6.get_type_info())) +assert_equal(true, float_type.bare_equal(1.6f.get_type_info())) +assert_equal(true, long_double_type.bare_equal(1.6l.get_type_info())) + diff --git a/unittests/string_substr.chai b/unittests/string_substr.chai new file mode 100644 index 0000000..19128bc --- /dev/null +++ b/unittests/string_substr.chai @@ -0,0 +1 @@ +assert_equal("3ab", "123abab".substr(2,3))