Files
logos-cpp-sdk/cpp-generator/experimental/lidl_gen_client.h
Dario LipicarandClaude Opus 4.8 1bc101df1f feat: cpp-generator consumes logos-lidl; delete embedded frontend (#89)
* feat: cpp-generator consumes logos-lidl; delete embedded frontend

The canonical LIDL frontend now lives in logos-lidl. cpp-generator links it
and keeps only the C++/Qt-specific parts (impl-header parsing, the gen_client/
gen_cdylib backends, the Qt type-name mapping).

- Delete the embedded lidl_lexer/parser/serializer/validator/ast.
- Add experimental/lidl_compat.h: brings logos-lidl's std AST into the global
  scope the backends use (via `using`), a qs() std::string→QString helper, a
  QTextStream<<std::string overload, and name-compatible shims (lidlParse/
  lidlSerialize/lidlValidate) so the emission code keeps compiling.
- Re-point impl_header_parser, lidl_gen_client (+ Doxygen /// docs on the
  generated client methods), lidl_gen_cdylib, lidl_emit_common, and legacy/
  main at lidl::ModuleDecl.
- CMake: C++17 + find_package(logos-lidl) + link logos-lidl::logos_lidl.
- bin.nix: distribute only the shared C++/Qt backend helpers (compat +
  impl_header_parser + emit_common) under share/lidl-frontend, not the frontend.
- tests: drop the 4 frontend test files (covered by logos-lidl now); the
  backend tests link logos-lidl.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix: pin logos-lidl to the C-ABI commit + lock it

The logos-lidl input was declared in flake.nix but missing from flake.lock,
so override chains that don't reach the nested input (the doctest harness
building a scaffolded module) couldn't resolve it. Pin the branch rev and
lock it so the component is self-contained. Re-point at master once logos-lidl
lands.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* chore: re-point logos-lidl to merged master (#5)

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-16 21:00:42 -03:00

33 lines
1.3 KiB
C

#ifndef LIDL_GEN_CLIENT_H
#define LIDL_GEN_CLIENT_H
#include "lidl_compat.h"
#include "../legacy/generator_lib.h" // BindMode
#include <QString>
#include <QTextStream>
// Map a LIDL TypeExpr to the Qt type string used in generated client stubs
QString lidlTypeToQt(const TypeExpr& te);
// Convert "my_module" to "MyModule"
QString lidlToPascalCase(const QString& name);
// Generate the client API header (.h) from a ModuleDecl.
// `bindMode == Bound` emits an interface wrapper whose ctor takes the
// target module name at runtime (see BindMode in generator_lib.h); the
// default Static keeps the historical fixed-module wrapper.
QString lidlMakeHeader(const ModuleDecl& module, BindMode bindMode = BindMode::Static);
// Generate the client API source (.cpp) from a ModuleDecl
QString lidlMakeSource(const ModuleDecl& module, BindMode bindMode = BindMode::Static);
// Generate metadata.json content from a ModuleDecl
QString lidlGenerateMetadataJson(const ModuleDecl& module);
// Full pipeline: parse .lidl file, generate client stubs + metadata.json + optional umbrella
// Returns 0 on success, non-zero on error
int lidlGenerateClientStubs(const QString& lidlPath, const QString& outputDir,
bool moduleOnly, QTextStream& out, QTextStream& err);
#endif // LIDL_GEN_CLIENT_H