lime
Lime is a C++ library implementing Open Whisper System Signal protocol
static_method.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <jni/functions.hpp>
4 #include <jni/class.hpp>
5 #include <jni/object.hpp>
6 #include <jni/type_signature.hpp>
7 #include <jni/tagging.hpp>
8 
9 namespace jni
10  {
11  template < class TheTag, class >
12  class StaticMethod;
13 
14  template < class TheTag, class R, class... Args >
15  class StaticMethod< TheTag, R (Args...) >
16  {
17  private:
18  jmethodID& method;
19 
20  public:
21  using TagType = TheTag;
22  using MethodType = R (Args...);
23  using ReturnType = R;
24 
25  StaticMethod(JNIEnv& env, const Class<TagType>& clazz, const char* name)
26  : method(GetStaticMethodID(env, *clazz, name, TypeSignature<R (Args...)>()()))
27  {}
28 
29  operator jmethodID&() const { return method; }
30  };
31  }
R(Args...) MethodType
Definition: static_method.hpp:22
Definition: advanced_ownership.hpp:5
TheTag TagType
Definition: static_method.hpp:21
StaticMethod(JNIEnv &env, const Class< TagType > &clazz, const char *name)
Definition: static_method.hpp:25
Definition: class.hpp:17
R ReturnType
Definition: static_method.hpp:23
jmethodID & GetStaticMethodID(JNIEnv &env, jclass &clazz, const char *name, const char *sig)
Definition: functions.hpp:320
std::pointer_traits< ::jmethodID >::element_type jmethodID
Definition: types.hpp:56
Definition: class.hpp:14
Definition: tagging.hpp:13