Commit Graph
6 Commits
Author SHA1 Message Date
Stephan Bergmann 5429ad357b Fix loplugin warnings in --enable-rust-uno code
...an assortment of loplugin:staticmethods, loplugin:stringadd, and
loplugin:stringviewparam

Change-Id: Iaa62c0162014a31de7d1f910199f241747f2feea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193167
Reviewed-by: Stephan Bergmann <stephan.bergmann@collabora.com>
Tested-by: Jenkins
2025-10-29 22:37:20 +01:00
Mohamed Ali 86ade63863 Rust Bindings: Use typed parameters instead of void* in UNO bindings
Replace generic void* parameters with proper types (strings, primitives, structs) for better type safety and more idiomatic Rust code.

Change-Id: Iced1c2de96564be7ec599f14bf1a685eaede2768
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191477
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@collabora.com>
2025-09-29 09:57:43 +02:00
Michael Weghorn 5ecb0b6f95 rustmaker: Use more string_view params, address loplugin:unnecessarygetstr
Switch some params from const std::string& to std::string_view
and drop the then unnecessery calls to OString::getStr in
callers.

This fixes the following clang plugin errors seen in an
--enable-rust-uno build:

    /home/michi/development/git/libreoffice/codemaker/source/rustmaker/cpproduce.cxx:1070:88: error: unnecessary call to 'getStr' when passing to string constructor [loplugin:unnecessarygetstr]
     1070 |     generateStructSourceBasicFunctions(file, functionPrefix, handleTypeName, className.getStr());
          |                                                                              ~~~~~~~~~~^~~~~~~~
    /home/michi/development/git/libreoffice/codemaker/source/rustmaker/cpproduce.cxx:1073:85: error: unnecessary call to 'getStr' when passing to string constructor [loplugin:unnecessarygetstr]
     1073 |     generateStructSourceBaseMembers(file, functionPrefix, handleTypeName, className.getStr(),
          |                                                                           ~~~~~~~~~~^~~~~~~~
    /home/michi/development/git/libreoffice/codemaker/source/rustmaker/cpproduce.cxx:1077:87: error: unnecessary call to 'getStr' when passing to string constructor [loplugin:unnecessarygetstr]
     1077 |     generateStructSourceDirectMembers(file, functionPrefix, handleTypeName, className.getStr(),
          |                                                                             ~~~~~~~~~~^~~~~~~~

Change-Id: Ia0ad68dd2dfed3a9b807c284e474ae0f2e42b2b1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190853
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2025-09-12 13:57:10 +02:00
Michael Weghorn 292f5fe5d5 rustmaker: Use string_view params (loplugin:stringviewparam)
Fix clang plugin errors like the following seen in an
--enable-rust-uno build:

    /home/michi/development/git/libreoffice/codemaker/source/rustmaker/cpproduce.cxx:207:77: error: replace function parameter of type 'const OString &' with 'std::string_view' [loplugin:stringviewparam]
      207 | void CppProducer::generateCBridgeConstructors(CppFile& file, const OString& className,
          |                                                              ~~~~~~~~~~~~~~~^~~~~~~~~
    /home/michi/development/git/libreoffice/codemaker/source/rustmaker/cpproduce.hxx:177:75: note: previous declaration is here [loplugin:stringviewparam]
      177 |     static void generateCBridgeConstructors(CppFile& file, const OString& className,
          |                                                            ~~~~~~~~~~~~~~~^~~~~~~~~

Change-Id: I5d5fa38d735a63438395848d6038f9d0e8e40401
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190852
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2025-09-12 13:57:03 +02:00
Michael Weghorn cc9c0bac1f rustmaker: Make methods static (loplugin:staticmethods)
Fix clang plugin errors like the following seen in an
--enable-rust-uno build:

    In file included from /home/michi/development/git/libreoffice/codemaker/source/rustmaker/cpproduce.cxx:10:
    /home/michi/development/git/libreoffice/codemaker/source/rustmaker/cpproduce.hxx:177:10: error: this member function can be declared static [loplugin:staticmethods]
      177 |     void generateCBridgeConstructors(CppFile& file, const OString& className,
          |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      178 |                                      const OString& functionPrefix, const OString& handleTypeName);
          |                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Change-Id: I7d2ae9ba71da8a6db73101e177610e9ec0df7616
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190850
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
2025-09-12 13:56:56 +02:00
Mohamed Ali d9f05dc007 Rust Bindings: Add rustmaker (Rust codemaker)
The rustmaker provides comprehensive support for converting UNO type definitions into idiomatic Rust code with proper memory safety and type system integration.

Also adds the RustFile, RustOptions, and RustProducer classes to handle
Rust code generation, file management, and command line option parsing
for various UNO type kinds such as enums, structs, and interfaces.

Change-Id: Iaf87af13352c55e81c1745ef7a8f591c3e61e0a4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188088
Reviewed-by: Stephan Bergmann <stephan.bergmann@collabora.com>
Tested-by: Jenkins
2025-09-11 21:38:59 +02:00