Skip to content

[22850] Fix python code generation for bounded strings (backport #440) #442

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

Merged
merged 1 commit into from
Feb 26, 2025

Conversation

mergify[bot]
Copy link

@mergify mergify bot commented Feb 25, 2025

Description

This PR introduces the following improvements on the code generated for SWIG interfaces:

  1. A setter for fixed_string members receiving a standard string is added.
  2. A %template for each fixed_string member is generated.

This allows setting bounded string members with either of the following alternatives:

  1. struct_name.member_name("string value")
  2. fixed_str = fixed_string_16("string value")
    struct_name.member_name(fixed_str)
    

@Mergifyio backport 4.0.x

Contributor Checklist

  • Commit messages follow the project guidelines.

  • Tests that thoroughly check the new feature have been added/Regression tests checking the bug and its fix have been added; the added tests pass locally

  • N/A: New feature has been documented/Current behavior is correctly described in the documentation.

  • Applicable backports have been included in the description.

Reviewer Checklist

  • The PR has a milestone assigned.
  • The title and description correctly express the PR's purpose.
  • Check contributor checklist is correct.
  • Check CI results: changes do not issue any warning.
  • Check CI results: failing tests are unrelated with the changes.

This is an automatic backport of pull request #440 done by [Mergify](https://mergify.com).

* Refs #22835. SWIG extend to set fixed_string from std::string.

Signed-off-by: Miguel Company <[email protected]>

* Refs #22835. SWIG export template for fixed_string members.

Signed-off-by: Miguel Company <[email protected]>

* Refs #22835. Fix access to typecode.

Signed-off-by: Miguel Company <[email protected]>

* Refs #22835. Fix max size typo.

Signed-off-by: Miguel Company <[email protected]>

* Refs #22835. Fix exported template name.

Signed-off-by: Miguel Company <[email protected]>

* Refs #22835. Fix extend code.

Signed-off-by: Miguel Company <[email protected]>

* Refs #22850. Apply suggestions from review.

Signed-off-by: Miguel Company <[email protected]>

---------

Signed-off-by: Miguel Company <[email protected]>
(cherry picked from commit 8eaca9a)
@MiguelCompany MiguelCompany self-requested a review February 25, 2025 11:09
@MiguelCompany MiguelCompany added this to the v4.0.4 milestone Feb 25, 2025
@github-actions github-actions bot added the ci-pending PR which CI is running label Feb 25, 2025
@MiguelCompany MiguelCompany self-requested a review February 25, 2025 15:16
@MiguelCompany MiguelCompany requested review from richiprosima and removed request for richiprosima February 25, 2025 15:19
@MiguelCompany MiguelCompany merged commit 7ffd80e into 4.0.x Feb 26, 2025
4 of 8 checks passed
@MiguelCompany MiguelCompany deleted the mergify/bp/4.0.x/pr-440 branch February 26, 2025 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci-pending PR which CI is running
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant