diff options
| author | SulfurNitride <SulfurNitride@users.noreply.github.com> | 2026-02-11 02:37:39 -0600 |
|---|---|---|
| committer | SulfurNitride <SulfurNitride@users.noreply.github.com> | 2026-02-11 02:37:39 -0600 |
| commit | 7ee008e150bc5bcf76082d726f719ee0fdfda982 (patch) | |
| tree | 27fb39be241fdb5ac2734c574de678977d1856d0 /libs/plugin_python/tests/python/test_argument_wrapper.cpp | |
Fluorine Manager: full Linux port of Mod Organizer 2
Complete native Linux port with FUSE-based virtual filesystem,
Proton/umu-run integration, and Flatpak packaging.
Key features:
- FUSE VFS replacing Windows USVFS (in-process + standalone helper for Flatpak)
- Proton/GE-Proton/umu-run launcher with env var forwarding
- Flatpak support (sandbox-aware VFS, NXM handler, umu-run)
- Wine prefix management UI
- Case-insensitive path resolution for Linux filesystems
- QSettings-safe INI handling (avoids Bethesda INI corruption)
- Portable instance support with auto-generated launcher scripts
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'libs/plugin_python/tests/python/test_argument_wrapper.cpp')
| -rw-r--r-- | libs/plugin_python/tests/python/test_argument_wrapper.cpp | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/libs/plugin_python/tests/python/test_argument_wrapper.cpp b/libs/plugin_python/tests/python/test_argument_wrapper.cpp new file mode 100644 index 0000000..e87f516 --- /dev/null +++ b/libs/plugin_python/tests/python/test_argument_wrapper.cpp @@ -0,0 +1,61 @@ +#include "pybind11_utils/smart_variant_wrapper.h" + +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +#include <string> + +namespace mo2::python::detail { + + template <> + struct smart_variant_converter<std::string> { + static std::string from(int const& value) { return std::to_string(value); } + }; + + template <> + struct smart_variant_converter<int> { + static int from(std::string const& value) { return std::stoi(value); } + }; + +} // namespace mo2::python::detail + +// wrapper that can be constructed from +using Wrapper = mo2::python::smart_variant<int, std::string>; + +template <std::size_t... Is, class Fn> +auto wrap(Fn&& fn) +{ + return mo2::python::wrap_arguments<Wrapper, Is...>(std::forward<Fn>(fn)); +} + +std::string fn1(std::string const& value) +{ + return value + "-" + value; +} + +int fn2(int value) +{ + return value * 2; +} + +std::string fn3(int value, std::vector<int> values, std::string const& name) +{ + return name + "-" + std::to_string(value + values.size()); +} + +PYBIND11_MODULE(argument_wrapper, m) +{ + m.def("fn1_raw", &fn1); + m.def("fn1_wrap", wrap(&fn1)); + m.def("fn1_wrap_0", wrap<0>(&fn1)); + + m.def("fn2_raw", &fn2); + m.def("fn2_wrap", wrap(&fn2)); + m.def("fn2_wrap_0", wrap<0>(&fn2)); + + m.def("fn3_raw", &fn3); + m.def("fn3_wrap", wrap(&fn3)); + m.def("fn3_wrap_0", wrap<0>(&fn3)); + m.def("fn3_wrap_2", wrap<2>(&fn3)); + m.def("fn3_wrap_0_2", wrap<0, 2>(&fn3)); +} |
