JniApi.hpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2023-04-07
  6. * Changed: 2024-09-11
  7. *
  8. * */
  9. #ifndef LS_STD_JNI_API_HPP
  10. #define LS_STD_JNI_API_HPP
  11. #include <ls-std/core/interface/IJniApi.hpp>
  12. #include <ls-std/os/dynamic-goal.hpp>
  13. /*
  14. * @doc: class(name: 'JniApi', package: 'core')
  15. * @doc: core.JniApi.description('This class represents an API for the Java Native Interface (JNI) wrapping basic JNI end points.')
  16. * */
  17. namespace ls::std::core::experimental
  18. {
  19. class LS_STD_DYNAMIC_GOAL JniApi : public ls::std::core::experimental::interface_type::IJniApi
  20. {
  21. public:
  22. explicit JniApi(JNIEnv *_environment);
  23. ~JniApi() noexcept override;
  24. jboolean callBooleanMethod(jobject _javaObject, jmethodID _methodId) override;
  25. jbyte callByteMethod(jobject _javaObject, jmethodID _methodId) override;
  26. jchar callCharMethod(jobject _javaObject, jmethodID _methodId) override;
  27. jdouble callDoubleMethod(jobject _javaObject, jmethodID _methodId) override;
  28. jfloat callFloatMethod(jobject _javaObject, jmethodID _methodId) override;
  29. jint callIntMethod(jobject _javaObject, jmethodID _methodId) override;
  30. jlong callLongMethod(jobject _javaObject, jmethodID _methodId) override;
  31. jshort callShortMethod(jobject _javaObject, jmethodID _methodId) override;
  32. jclass findClass(const ::std::string &_classPath) override;
  33. jmethodID getMethodId(jclass _javaClass, const char *_methodIdentifier, const char *_methodSignature) override;
  34. private:
  35. JNIEnv *environment{};
  36. };
  37. }
  38. #endif