Skip to content

Release v0.5.1: IECStringVar / IECWStringVar read-through proxies#157

Merged
thiagoralves merged 1 commit into
mainfrom
development
Jun 2, 2026
Merged

Release v0.5.1: IECStringVar / IECWStringVar read-through proxies#157
thiagoralves merged 1 commit into
mainfrom
development

Conversation

@thiagoralves
Copy link
Copy Markdown
Contributor

Summary

Release v0.5.1 with the read-through proxy methods added to IECStringVar / IECWStringVar (from #156).

What's new since v0.5.0

  • length(), c_str(), operator[] proxies on IECStringVar<MaxLen> and IECWStringVar<MaxLen>, force-aware (route through forced_value_ when forcing is active, value_ otherwise).
  • Lets user C/C++ POU code in openplc-editor / openplc-web read STRING / WSTRING pins with plain name.length() / name.c_str() / name[i] syntax instead of name.get().length() etc.
  • Comparison operators intentionally NOT proxied (free-function overloads already cover every cross-class compare path; adding member ops would risk ST overload ambiguity).

Unlocks downstream

  • openplc-editor PR #831 (c_blocks STRING/WSTRING standardization)
  • openplc-web mirror PR (to follow)

Test plan

  • Full local CI-equivalent gates passed on the dev tip: lint (0 errors), prettier clean, typecheck clean, 1913/1920 tests pass (7 pre-existing skips).
  • CI (which fires on this PR — unlike dev-targeted PRs) reports green.
  • After merge: tag v0.5.1 from main to trigger the release build.

🤖 Generated with Claude Code

…ar (#156)

Without these proxies, user code reading a STRING / WSTRING pin has to
write `name.get().c_str()` / `name.get().length()` / `name.get()[i]`
for every read — `IECStringVar` would otherwise expose nothing but
`get()` / `set()` / `operator=` to its consumers.

Add `length()`, `c_str()`, and `operator[]` (read-only — returns char
by value) on both `IECStringVar<MaxLen>` and `IECWStringVar<MaxLen>`,
routed through the force-aware value (`forced_value_` when forcing is
active, `value_` otherwise).  This mirrors how `IECVar<T>::operator T()`
already exposes the underlying numeric for force-respecting reads on
numeric pins.

Comparison operators (`operator==` / `operator!=`) are intentionally
NOT proxied — the free-function overloads at the bottom of each
header already cover every cross-class compare path, and adding
member operators would risk overload ambiguity at ST call sites that
currently bind to the free functions.

Unlocks the openplc-editor / openplc-web c_blocks STRING/WSTRING
standardization PRs — user C/C++ POU code can now read pins via
plain `name.length()` / `name.c_str()` / `name[i]`.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@thiagoralves thiagoralves merged commit 8d3ae69 into main Jun 2, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant