///
/// JFunc_void.hpp
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
/// https://github.com/mrousavy/nitro
/// Copyright © 2024 Marc Rousavy @ Margelo
///

#pragma once

#include <fbjni/fbjni.h>
#include <functional>

#include <functional>

namespace margelo::nitro::nitrotexttospeech {

  using namespace facebook;

  /**
   * C++ representation of the callback Func_void.
   * This is a Kotlin `() -> Unit`, backed by a `std::function<...>`.
   */
  struct JFunc_void final: public jni::HybridClass<JFunc_void> {
  public:
    static jni::local_ref<JFunc_void::javaobject> fromCpp(const std::function<void()>& func) {
      return JFunc_void::newObjectCxxArgs(func);
    }

  public:
    void call() {
      _func();
    }

  public:
    static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/nitrotexttospeech/Func_void;";
    static void registerNatives() {
      registerHybrid({makeNativeMethod("call", JFunc_void::call)});
    }

  private:
    explicit JFunc_void(const std::function<void()>& func): _func(func) { }

  private:
    friend HybridBase;
    std::function<void()> _func;
  };

} // namespace margelo::nitro::nitrotexttospeech
