Traits to convert between C++ and Python types.
Client code will not usually use these traits directly, but rather use the functions pyBuildSimpleObject()
and pyGetSimpleObject()
:
The three type hinting members are used in combination with lass_stubgen to automatically generate Python stub files (.pyi) that provide type hinting information for Python extension modules that use the Lass binding system.
The preamble can also be used to include necessary imports. For example, std::filesystem::path
is mapped to pathlib.Path
in Python, so the pathlib
module needs to be imported. And as parameter, it also accepts str
and bytes
, or anything that implements the os.PathLike
for which the StrOrBytesPath
type alias from the _typeshed
module is used:
When substituing template parameters in the context of function parameters, then py_typing_param
is used if the template argument defines it, even if the top-level PyExportTraits
specialization only defines py_typing
. For example, std::pair<T, U>
only defines py_typing
, but float
defines the alias _Float
as py_typing_param
. So a function taking std::pair<float, float>
as a parameter would have the following type hint:
|
struct | lass::python::PyExportTraitsCallback< CallbackType, PyCallbackImplType, ExportTraits > |
| Helper class to implement PyExportTraits for Callback types. More...
|
|
struct | lass::python::PyExportTraits< util::Callback0 > |
| Bidirectional mapping between util::Callback0 and a Python callable object. More...
|
|
struct | lass::python::PyExportTraits< util::Callback1< P1 > > |
| Bidirectional mapping between util::Callback1 and a Python callable object. More...
|
|
struct | lass::python::PyExportTraits< util::Callback2< P1, P2 > > |
| Bidirectional mapping between util::Callback2 and a Python callable object. More...
|
|
struct | lass::python::PyExportTraits< util::Callback3< P1, P2, P3 > > |
| Bidirectional mapping between util::Callback3 and a Python callable object. More...
|
|
struct | lass::python::PyExportTraits< util::Callback4< P1, P2, P3, P4 > > |
| Bidirectional mapping between util::Callback4 and a Python callable object. More...
|
|
struct | lass::python::PyExportTraits< util::Callback5< P1, P2, P3, P4, P5 > > |
| Bidirectional mapping between util::Callback5 and a Python callable object. More...
|
|
struct | lass::python::PyExportTraits< util::Callback6< P1, P2, P3, P4, P5, P6 > > |
| Bidirectional mapping between util::Callback6 and a Python callable object. More...
|
|
struct | lass::python::PyExportTraits< util::Callback7< P1, P2, P3, P4, P5, P6, P7 > > |
| Bidirectional mapping between util::Callback7 and a Python callable object. More...
|
|
struct | lass::python::PyExportTraits< util::Callback8< P1, P2, P3, P4, P5, P6, P7, P8 > > |
| Bidirectional mapping between util::Callback8 and a Python callable object. More...
|
|
struct | lass::python::PyExportTraits< util::Callback9< P1, P2, P3, P4, P5, P6, P7, P8, P9 > > |
| Bidirectional mapping between util::Callback9 and a Python callable object. More...
|
|
struct | lass::python::PyExportTraits< util::Callback10< P1, P2, P3, P4, P5, P6, P7, P8, P9, P10 > > |
| Bidirectional mapping between util::Callback10 and a Python callable object. More...
|
|
struct | lass::python::PyExportTraits< util::Callback11< P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11 > > |
| Bidirectional mapping between util::Callback11 and a Python callable object. More...
|
|
struct | lass::python::PyExportTraits< util::Callback12< P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12 > > |
| Bidirectional mapping between util::Callback12 and a Python callable object. More...
|
|
struct | lass::python::PyExportTraits< util::Callback13< P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13 > > |
| Bidirectional mapping between util::Callback13 and a Python callable object. More...
|
|
struct | lass::python::PyExportTraits< util::Callback14< P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14 > > |
| Bidirectional mapping between util::Callback14 and a Python callable object. More...
|
|
struct | lass::python::PyExportTraits< util::Callback15< P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15 > > |
| Bidirectional mapping between util::Callback15 and a Python callable object. More...
|
|
struct | lass::python::PyExportTraits< util::CallbackR0< R > > |
| Bidirectional mapping between util::CallbackR0 and a Python callable object. More...
|
|
struct | lass::python::PyExportTraits< util::CallbackR1< R, P1 > > |
| Bidirectional mapping between util::CallbackR1 and a Python callable object. More...
|
|
struct | lass::python::PyExportTraits< util::CallbackR2< R, P1, P2 > > |
| Bidirectional mapping between util::CallbackR2 and a Python callable object. More...
|
|
struct | lass::python::PyExportTraits< util::CallbackR3< R, P1, P2, P3 > > |
| Bidirectional mapping between util::CallbackR3 and a Python callable object. More...
|
|
struct | lass::python::PyExportTraits< util::CallbackR4< R, P1, P2, P3, P4 > > |
| Bidirectional mapping between util::CallbackR4 and a Python callable object. More...
|
|
struct | lass::python::PyExportTraits< util::CallbackR5< R, P1, P2, P3, P4, P5 > > |
| Bidirectional mapping between util::CallbackR5 and a Python callable object. More...
|
|
struct | lass::python::PyExportTraits< util::CallbackR6< R, P1, P2, P3, P4, P5, P6 > > |
| Bidirectional mapping between util::CallbackR6 and a Python callable object. More...
|
|
struct | lass::python::PyExportTraits< util::CallbackR7< R, P1, P2, P3, P4, P5, P6, P7 > > |
| Bidirectional mapping between util::CallbackR7 and a Python callable object. More...
|
|
struct | lass::python::PyExportTraits< util::CallbackR8< R, P1, P2, P3, P4, P5, P6, P7, P8 > > |
| Bidirectional mapping between util::CallbackR8 and a Python callable object. More...
|
|
struct | lass::python::PyExportTraits< util::CallbackR9< R, P1, P2, P3, P4, P5, P6, P7, P8, P9 > > |
| Bidirectional mapping between util::CallbackR9 and a Python callable object. More...
|
|
struct | lass::python::PyExportTraits< util::CallbackR10< R, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10 > > |
| Bidirectional mapping between util::CallbackR10 and a Python callable object. More...
|
|
struct | lass::python::PyExportTraits< util::CallbackR11< R, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11 > > |
| Bidirectional mapping between util::CallbackR11 and a Python callable object. More...
|
|
struct | lass::python::PyExportTraits< util::CallbackR12< R, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12 > > |
| Bidirectional mapping between util::CallbackR12 and a Python callable object. More...
|
|
struct | lass::python::PyExportTraits< util::CallbackR13< R, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13 > > |
| Bidirectional mapping between util::CallbackR13 and a Python callable object. More...
|
|
struct | lass::python::PyExportTraits< util::CallbackR14< R, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14 > > |
| Bidirectional mapping between util::CallbackR14 and a Python callable object. More...
|
|
struct | lass::python::PyExportTraits< util::CallbackR15< R, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15 > > |
| Bidirectional mapping between util::CallbackR15 and a Python callable object. More...
|
|
struct | lass::python::PyExportTraits< T > |
| by copy, general case assumes shadow type or PyObjectPlus based type. More...
|
|
struct | lass::python::PyExportTraits< const T > |
| constant objects can only be build. More...
|
|
struct | lass::python::PyExportTraits< util::SharedPtr< T, S, C > > |
| SharedPtr assumes shadow types or PyObjectPlus types. More...
|
|
struct | lass::python::PyExportTraits< TPyObjPtr > |
| A shared PyObject pointer is mapped to Any in Python. More...
|
|
struct | lass::python::PyExportTraits< std::unique_ptr< T, Deleter > > |
| std::unique_ptr assumes shadow types More...
|
|
struct | lass::python::PyExportTraits< std::shared_ptr< T > > |
| std::shared_ptr assumes shadow types. More...
|
|
struct | lass::python::PyExportTraitsNoNone< T > |
| Helper class to create PyExportTraits for NoNone wrapped types. More...
|
|
struct | lass::python::PyExportTraits< NoNone< T * > > |
| NoNone<T*> type-hints as T and refuses None as value. More...
|
|
struct | lass::python::PyExportTraits< NoNone< util::SharedPtr< T, S, C > > > |
| Type-hints NoNone<util::SharedPtr<T>> as T and refuses None as value. More...
|
|
struct | lass::python::PyExportTraits< NoNone< std::shared_ptr< T > > > |
| NoNone<std::shared_ptr<T>> type-hints as T and refuses None as value. More...
|
|
struct | lass::python::PyExportTraitsMaybeNone< T > |
| Helper class to create PyExportTraits for MaybeNone wrapped types. More...
|
|
struct | lass::python::PyExportTraits< MaybeNone< T * > > |
| MaybeNone<T*> type-hints a type as T | MaybeNone More...
|
|
struct | lass::python::PyExportTraits< MaybeNone< util::SharedPtr< T, S, C > > > |
| MaybeNone<util::SharedPtr<T>> type-hints a type as T | MaybeNone More...
|
|
struct | lass::python::PyExportTraits< MaybeNone< std::shared_ptr< T > > > |
| MaybeNone<std::shared_ptr<T>> type-hints a type as T | MaybeNone More...
|
|
struct | lass::python::PyExportTraits< Self< T > > |
| Self<T> type-hints as Self . More...
|
|
struct | lass::python::PyExportTraitsSigned< Integer > |
| Helper class to create PyExportTraits for signed integers. More...
|
|
struct | lass::python::PyExportTraits< signed char > |
| signed char is mapped to Python int More...
|
|
struct | lass::python::PyExportTraits< signed short > |
| signed short is mapped to Python int More...
|
|
struct | lass::python::PyExportTraits< signed int > |
| signed int is mapped to Python int More...
|
|
struct | lass::python::PyExportTraits< signed long > |
| signed long is mapped to Python int More...
|
|
struct | lass::python::PyExportTraitsUnsigned< Integer > |
| Helper class to create PyExportTraits for unsigned integers. More...
|
|
struct | lass::python::PyExportTraits< unsigned char > |
| unsigned char is mapped to Python int More...
|
|
struct | lass::python::PyExportTraits< unsigned short > |
| unsigned short is mapped to Python int More...
|
|
struct | lass::python::PyExportTraits< unsigned int > |
| unsigned int is mapped to Python int More...
|
|
struct | lass::python::PyExportTraits< unsigned long > |
| unsigned long is mapped to Python int More...
|
|
struct | lass::python::PyExportTraitsFloat< Float > |
| Helper class to create PyExportTraits for floating point numbers. More...
|
|
struct | lass::python::PyExportTraits< float > |
| float is mapped to Python float type, which is a C double . More...
|
|
struct | lass::python::PyExportTraits< double > |
| double is mapped to Python float type, which is also a C double . More...
|
|
struct | lass::python::PyExportTraits< long double > |
| long double is mapped to Python float type, which is a C double . More...
|
|
struct | lass::python::PyExportTraits< std::complex< T > > |
| std::complex<T> is always mapped to Python complex type. More...
|
|
struct | lass::python::PyExportTraits< std::basic_string_view< T > > |
| std::basic_string_view<T> is mapped to Python str More...
|
|
struct | lass::python::PyExportTraits< const char16_t * > |
| UTF-16 const char16_t* string is mapped to Python str | None , as it can be null. More...
|
|
struct | lass::python::PyExportTraits< std::u16string > |
| UTF-16 std::u16string is mapped to str More...
|
|
struct | lass::python::PyExportTraits< const char32_t * > |
| UTF-32 const char32_t* string is mapped to Python str | None , as it can be null. More...
|
|
struct | lass::python::PyExportTraits< std::u32string > |
| UTF-32 std::u32string is mapped to str More...
|
|
struct | lass::python::PyExportTraits< std::chrono::duration< Rep, Period > > |
| std::chrono::duration is mapped on datetime.timedelta by copy. More...
|
|
struct | lass::python::PyExportTraits< std::chrono::time_point< std::chrono::system_clock > > |
| std::chrono::time_point<std::chrono::system_clock> is mapped on a timezone-unaware datetime.datetime instance by copy, in local time. More...
|
|
struct | lass::python::PyExportTraits< std::chrono::utc_clock::time_point > |
| std::chrono::utc_clock::time_point is mapped on a timezone-aware datetime.datetime instance by copy, in UTC. More...
|
|
struct | lass::python::PyExportTraits< std::chrono::gps_clock::time_point > |
| std::chrono::gps_clock::time_point is mapped on a timezone-aware datetime.datetime instance by copy, in UTC. More...
|
|
struct | lass::python::PyExportTraits< std::chrono::tai_clock::time_point > |
| std::chrono::tai_clock::time_point is mapped on a timezone-aware datetime.datetime instance by copy, in UTC. More...
|
|
struct | lass::python::PyExportTraits< std::chrono::file_clock::time_point > |
| std::chrono::file_clock::time_point is mapped on a timezone-aware datetime.datetime instance by copy, in UTC. More...
|
|
struct | lass::python::PyExportTraits< std::chrono::year_month_day > |
| std::chrono::year_month_day is mapped on a datetime.date instance by copy. More...
|
|
struct | lass::python::PyExportTraits< std::function< R(Args...)> > |
| Bidirectional wrapper between Callable objects and std::function. More...
|
|
struct | lass::python::PyExportTraits< std::optional< T > > |
| Uses None to represent a std::optional without value. More...
|
|
struct | lass::python::PyExportTraits< MaybeNone< std::optional< T > > > |
| MaybeNone<std::optional<T>> type-hints a type as T | MaybeNone More...
|
|
struct | lass::python::PyExportTraits< prim::Vector2D< T > > |
| Maps prim::Vector2D<T> to a Python tuple of two elements of type T. More...
|
|
struct | lass::python::PyExportTraits< prim::Vector3D< T > > |
| Maps prim::Vector3D<T> to a Python tuple of three elements of type T. More...
|
|
struct | lass::python::PyExportTraits< prim::Vector4D< T > > |
| Maps prim::Vector4D<T> to a Python tuple of four elements of type T. More...
|
|
struct | lass::python::PyExportTraits< prim::Point2D< T > > |
| Maps prim::Point2D<T> to a Python tuple of two elements of type T. More...
|
|
struct | lass::python::PyExportTraits< prim::Point3D< T > > |
| Maps prim::Point3D<T> to a Python tuple of three elements of type T. More...
|
|
struct | lass::python::PyExportTraits< prim::Aabb2D< T, MMP > > |
| Maps prim::Aabb2D<T> to a Python tuple of two tuples of two elements of type T. More...
|
|
struct | lass::python::PyExportTraits< prim::Aabb3D< T, MMP > > |
| Maps prim::Aabb3D<T> to a Python tuple of two tuples of three elements of type T. More...
|
|
struct | lass::python::PyExportTraits< prim::LineSegment2D< T, PP > > |
| Maps prim::LineSegment2D<T> to a Python tuple of two tuples of two elements of type T. More...
|
|
struct | lass::python::PyExportTraits< prim::LineSegment3D< T, PP > > |
| Maps prim::LineSegment3D<T> to a Python tuple of two tuples of three elements of type T. More...
|
|
struct | lass::python::PyExportTraits< prim::Transformation2D< T > > |
| Maps prim::Transformation2D<T> to a Python tuple of three tuples of three elements of type T. More...
|
|
struct | lass::python::PyExportTraits< prim::Transformation3D< T > > |
| Maps prim::Transformation3D<T> to a Python tuple of four tuples of four elements of type T. More...
|
|
struct | lass::python::PyExportTraits< prim::SimplePolygon2D< T, DP > > |
| Maps prim::SimplePolygon2D<T> to a Python sequence of tuples of two elements of type T. More...
|
|
struct | lass::python::PyExportTraits< prim::SimplePolygon3D< T, DP > > |
| Maps prim::SimplePolygon3D<T> to a Python sequence of tuples of three elements of type T. More...
|
|
struct | lass::python::PyExportTraits< prim::XY > |
| Maps prim::XY to a Python string literal "x" or "y". More...
|
|
struct | lass::python::PyExportTraits< prim::XYZ > |
| Maps prim::XYZ to a Python string literal "x", "y" or "z". More...
|
|
struct | lass::python::PyExportTraits< prim::XYZW > |
| Maps prim::XYZW to a Python string literal "x", "y", "z" or "w". More...
|
|
struct | lass::python::PyExportTraits< prim::ColorRGBA > |
| Maps prim::ColorRGBA to a Python tuple of four elements of type float. More...
|
|
struct | lass::python::PyExportTraits< prim::IndexTriangle > |
| Maps prim::IndexTriangle to a Python tuple of three index vertices. More...
|
|
struct | lass::python::PyExportTraits< std::pair< T1, T2 > > |
| std::pair translates to a tuple by copy. More...
|
|
struct | lass::python::PyExportTraits< std::tuple< T... > > |
| std::tuple translates to a tuple by copy. More...
|
|
struct | lass::python::PyExportTraits< PyIteratorRange * > |
| Passes a PyIteratorRange to Python. More...
|
|
struct | lass::python::PyExportTraits< ContainerRangeView< SelfType, ValueType > > |
| Builds a PyIteratorRange from a ContainerRangeView. More...
|
|
struct | lass::python::PyExportTraits< MemberRangeView< SelfType, ValueType, GetIterator > > |
| Builds a PyIteratorRange from a MemberRangeView. More...
|
|
struct | lass::python::PyExportTraits< FreeRangeView< SelfType, ValueType, GetIterator > > |
| Builds a PyIteratorRange from a FreeRangeView. More...
|
|
struct | lass::python::PyExportTraits< IndexedRangeView< SelfType, ValueType, SizeType, AtMethod, SizeMethod > > |
| Builds a PyIteratorRange from a IndexedRangeView. More...
|
|
struct | lass::python::PyExportTraits< FreeIndexedRangeView< SelfType, ValueType, SizeType, AtFunc, SizeFunc > > |
| Builds a PyIteratorRange from a FreeIndexedRangeView. More...
|
|
struct | lass::python::PyExportTraitsEnum< EnumType, IntegerType > |
| Helper to specialise PyExportTraits for enumerations. More...
|
|