Files
logos-cpp-sdk/cpp-generator/legacy
Dario LipicarandClaude Opus 5 99a2bffeb3 refactor(generator): drop the dead event-source surface from consumer wrappers (#120)
* fix(generator): one Qt type mapper, and it knows about void; LpClient takes a timeout

Two near-duplicate LIDL->Qt type mappers existed — legacy/main.cpp's
lidlTypeExprToQtTypeName and experimental/lidl_emit_common.cpp's lidlTypeToQt —
and they disagreed. The legacy one had no `void` case, so a `-> void` method
arriving as Primitive("void") from the impl-header parser fell through to
QVariant. (The .lidl parser spells it Named("void"), which survived only by
accident, through mapReturnType's `base == "void"` early-out.)

That was not a Qt-consumer bug: the std/lp tables are DERIVED from this name, so
the same method generated `LogosMap doVoid(...)` on the Qt-free surface too.
Measured, from `void doVoid();` in a .h interface:

    QVariant  doVoid(...)   --api-style qt   before
    void      doVoid(...)   --api-style qt   after
    LogosMap  doVoid(...)   --api-style lp   before
    void      doVoid(...)   --api-style lp   after

lidlTypeExprToQtTypeName is now a delegation, so there is one table to disagree
with. This changes the generated signature for any module consuming a `-> void`
method through a .h interface; the two in-tree call sites discard the value and
are unaffected.

logos::LpClient::invoke/invokeAsync gain a timeout_ms parameter, defaulted to
the C ABI's "use the default" (0) so no existing caller changes. The Qt-typed
consumer surface takes a Timeout on every async overload and had nowhere to put
it — a wrapper delegating to the lp path silently dropped it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* refactor(generator): drop the dead event-source surface from consumer wrappers

Generated consumer wrappers carried setEventSource / eventSource / trigger — an
author-facing way to SOURCE events through a wrapper whose job is to CONSUME
them. Both emitters (legacy and experimental) shipped it.

Nothing used it. Zero call sites across every repo in the workspace including
the vendored SDK copies; the only `trigger(` in the tree is a QML Action's own
method. The generated code did not use it internally either — m_eventSource was
written only by its own setter and read only by trigger, so calling trigger()
without a prior setEventSource() warned and returned.

It was not free. `trigger` routes through m_client->onEventResponse, which has
no lp equivalent — lp_* offers only lp_provider_emit_event, on a handle a
consumer wrapper does not own. That single call was the reason a Qt wrapper had
to keep a LogosAPIClient alongside its lp client, carrying two clients and two
lots of token state per wrapper. Removing an unused surface removes a real
constraint on the veneer.

Worth noting what it would have taken otherwise: either widening the C ABI with
a consumer-side emit (softening a provider/consumer split the ABI currently
enforces), or rerouting through the module's own provider handle. Neither is
needed if nobody is asking.

Pinned by a test rather than left to convention — the emitters are the kind of
code where a convenience accessor grows back.

181/181.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-07-30 23:54:03 -03:00
..