-
Notifications
You must be signed in to change notification settings - Fork 23
Design conversion provider delegation system #243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Design conversion provider delegation system #243
Conversation
This change allows conversion providers (like StdStringUnicodeConverter) to work inside containers (like std::vector) by adding a delegation mechanism. Changes: - Add supports_delegation() method to TypeConverterBase (default: False) - Enable delegation for StdStringUnicodeConverter and StdStringUnicodeOutputConverter - Modify StdVectorConverter to delegate to element converters when supports_delegation() returns True - Add test for UTF-8 string vectors This fixes the limitation where UTF-8 string converters would not be picked up when used inside containers. Now, vectors of libcpp_utf8_string or libcpp_utf8_output_string properly encode/decode UTF-8 strings.
📝 WalkthroughWalkthroughThis PR introduces delegation support for type converters, enabling UTF-8 string converters to handle per-element conversion within container types. A new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (4)
🧰 Additional context used🧬 Code graph analysis (2)tests/test_code_generator.py (2)
autowrap/ConversionProvider.py (2)
🪛 Clang (14.0.6)tests/test_files/libcpp_utf8_string_vector_test.hpp[error] 1-1: 'string' file not found (clang-diagnostic-error) ⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
🔇 Additional comments (9)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Note Docstrings generation - SUCCESS |
Docstrings generation was requested by @timosachsenberg. * #243 (comment) The following files were modified: * `autowrap/ConversionProvider.py`
|
Thanks a lot Timo!! autowrap/autowrap/CodeGenerator.py Line 2211 in 6236c3d
One could probably try to change that but I think it is a global change so you wouldn't be able to change it for some functions but not others. Probably not so important. This PR here looks ok I think but I wonder if it works for further nesting and if not if it's worth to support further nesting. Deep nesting in autowrap is in general very unstable and untested. Especially when mixing containers 😅 |
This change allows conversion providers (like StdStringUnicodeConverter) to work inside containers (like std::vector) by adding a delegation mechanism.
Changes:
This fixes the limitation where UTF-8 string converters would not be picked up when used inside containers. Now, vectors of libcpp_utf8_string or libcpp_utf8_output_string properly encode/decode UTF-8 strings.
Summary by CodeRabbit
Release Notes
New Features
Tests
✏️ Tip: You can customize this high-level summary in your review settings.