lime
Lime is a C++ library implementing Open Whisper System Signal protocol
static_field.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 T >
12  class StaticField
13  {
14  private:
15  jfieldID& field;
16 
17  public:
18  using TagType = TheTag;
19  using FieldType = T;
20 
21  StaticField(JNIEnv& env, const Class<TagType>& clazz, const char* name)
22  : field(GetStaticFieldID(env, *clazz, name, TypeSignature<T>()()))
23  {}
24 
25  operator jfieldID&() const { return field; }
26  };
27  }
T FieldType
Definition: static_field.hpp:19
TheTag TagType
Definition: static_field.hpp:18
Definition: advanced_ownership.hpp:5
StaticField(JNIEnv &env, const Class< TagType > &clazz, const char *name)
Definition: static_field.hpp:21
Definition: class.hpp:17
std::pointer_traits< ::jfieldID >::element_type jfieldID
Definition: types.hpp:55
jfieldID & GetStaticFieldID(JNIEnv &env, jclass &clazz, const char *name, const char *sig)
Definition: functions.hpp:343
Definition: tagging.hpp:13