diff --git a/src/db/db/dbArray.h b/src/db/db/dbArray.h index b8b892650..a4f51760f 100644 --- a/src/db/db/dbArray.h +++ b/src/db/db/dbArray.h @@ -2482,6 +2482,14 @@ struct array return a; } + /** + * @brief A dummy implementation of the "scaled" function for API compatibility + */ + array scaled (double f) const + { + return transformed (db::complex_trans (f)); + } + /** * @brief Transformation of an array into a new system * diff --git a/src/db/db/dbObjectWithProperties.h b/src/db/db/dbObjectWithProperties.h index 3e95394cf..03242ac61 100644 --- a/src/db/db/dbObjectWithProperties.h +++ b/src/db/db/dbObjectWithProperties.h @@ -203,7 +203,8 @@ public: /** * @brief Returns the scaled object */ - auto scaled (double f) const + db::object_with_properties::type> + scaled (double f) const { return make_object_with_properties (Obj::scaled (f), m_id); } @@ -212,7 +213,8 @@ public: * @brief Returns the transformed object */ template - auto transformed (const Trans &tr) const + db::object_with_properties)>::type> + transformed (const Trans &tr) const { return make_object_with_properties (Obj::transformed (tr), m_id); } @@ -304,20 +306,11 @@ typedef object_with_properties > DCellInstAr * @return t * obj */ -template -struct result_of_method; - -template -struct result_of_method -{ - typedef R type; -}; - template -inline db::object_with_properties)>::type> +inline db::object_with_properties)>::type> operator* (const Tr &t, const db::object_with_properties &obj) { - return db::object_with_properties)>::type> (obj.Obj::transformed (t), obj.properties_id ()); + return db::object_with_properties)>::type> (obj.Obj::transformed (t), obj.properties_id ()); } /** @@ -329,10 +322,10 @@ operator* (const Tr &t, const db::object_with_properties &obj) * @return The scaled object */ template -inline db::object_with_properties::type> +inline db::object_with_properties::type> operator* (const db::object_with_properties &obj, double s) { - return db::object_with_properties::type> (obj * s, obj.properties_id ()); + return db::object_with_properties::type> (obj * s, obj.properties_id ()); } /** diff --git a/src/db/db/dbPath.h b/src/db/db/dbPath.h index e7a4f16c6..ba70fd7dd 100644 --- a/src/db/db/dbPath.h +++ b/src/db/db/dbPath.h @@ -1079,6 +1079,15 @@ struct path_ref pref.transform (t); return pref; } + + /** + * @brief A dummy implementation of the "scaled" function for API compatibility + */ + path_ref scaled (double) const + { + tl_assert (false); // not implemented + return *this; + } }; /** diff --git a/src/db/db/dbPolygon.h b/src/db/db/dbPolygon.h index 170d22e80..134412e8e 100644 --- a/src/db/db/dbPolygon.h +++ b/src/db/db/dbPolygon.h @@ -3522,6 +3522,15 @@ public: pref.transform (t); return pref; } + + /** + * @brief A dummy implementation of the "scaled" function for API compatibility + */ + polygon_ref scaled (double) const + { + tl_assert (false); // not implemented + return *this; + } }; /** diff --git a/src/db/db/dbText.h b/src/db/db/dbText.h index e74a72e16..6cab218ef 100644 --- a/src/db/db/dbText.h +++ b/src/db/db/dbText.h @@ -946,6 +946,15 @@ struct text_ref tref.transform (t); return tref; } + + /** + * @brief A dummy implementation of the "scaled" function for API compatibility + */ + text_ref scaled (double) const + { + tl_assert (false); // not implemented + return *this; + } }; /** diff --git a/src/db/db/gsiDeclDbPropertiesSupport.h b/src/db/db/gsiDeclDbPropertiesSupport.h index 3ced65ae0..a97b687bc 100644 --- a/src/db/db/gsiDeclDbPropertiesSupport.h +++ b/src/db/db/gsiDeclDbPropertiesSupport.h @@ -24,6 +24,7 @@ #define HDR_dbPropertiesSupport #include "gsiDecl.h" +#include "tlTypeTraits.h" #include "dbPropertiesRepository.h" #include "dbObjectWithProperties.h" #include "dbTrans.h" @@ -75,10 +76,10 @@ static tl::Variant get_properties_meth_impl (const T *s) } template -static typename db::result_of_method::type +static typename tl::result_of_method::type scaled_meth_impl (const T *s, double scale) { - typename db::result_of_method::type res (s->scaled (scale), s->properties_id ()); + typename tl::result_of_method::type res (s->scaled (scale), s->properties_id ()); return res; } @@ -90,18 +91,18 @@ transformed_meth_impl0 (const T *s, const db::simple_trans -static typename db::result_of_method >)>::type +static typename tl::result_of_method >)>::type transformed_meth_impl1 (const T *s, const db::complex_trans &tr) { - typename db::result_of_method >)>::type res (s->transformed (tr), s->properties_id ()); + typename tl::result_of_method >)>::type res (s->transformed (tr), s->properties_id ()); return res; } template -static typename db::result_of_method >)>::type +static typename tl::result_of_method >)>::type transformed_meth_impl2 (const T *s, const db::complex_trans &tr) { - typename db::result_of_method >)>::type res (s->transformed (tr), s->properties_id ()); + typename tl::result_of_method >)>::type res (s->transformed (tr), s->properties_id ()); return res; } diff --git a/src/tl/tl/tlTypeTraits.h b/src/tl/tl/tlTypeTraits.h index a4f1c7acd..604a0211f 100644 --- a/src/tl/tl/tlTypeTraits.h +++ b/src/tl/tl/tlTypeTraits.h @@ -155,6 +155,43 @@ struct has_swap static constexpr bool value = sizeof (__test_swap_func (nullptr)) == sizeof (__yes_type); }; + +/** + * @brief Delivers the return type for a method + * + * class Foo { + * int func(const std::string &s); + * }; + * + * typedef typename tl::result_of_method::type return_type; // int + */ +template +struct result_of_method; + +template +struct result_of_method +{ + typedef R type; +}; + +template +struct result_of_method +{ + typedef R type; +}; + +template +struct result_of_method +{ + typedef R type; +}; + +template +struct result_of_method +{ + typedef R type; +}; + } #endif