Loading...
Searching...
No Matches
static_field.hpp
Go to the documentation of this file.
#pragma once
#include <jni/functions.hpp>
#include <jni/class.hpp>
#include <jni/object.hpp>
#include <jni/type_signature.hpp>
#include <jni/tagging.hpp>
namespace jni
{
template < class TheTag, class T >
class StaticField
{
private:
jfieldID& field;
public:
using TagType = TheTag;
using FieldType = T;
StaticField(JNIEnv& env, const Class<TagType>& clazz, const char* name)
: field(GetStaticFieldID(env, *clazz, name, TypeSignature<T>()()))
{}
operator jfieldID&() const { return field; }
};
}
class.hpp
jni::Class
Definition class.hpp:18
jni::StaticField::FieldType
T FieldType
Definition static_field.hpp:19
jni::StaticField::TagType
TheTag TagType
Definition static_field.hpp:18
jni::StaticField::StaticField
StaticField(JNIEnv &env, const Class< TagType > &clazz, const char *name)
Definition static_field.hpp:21
functions.hpp
jni
Definition advanced_ownership.hpp:6
jni::jfieldID
std::pointer_traits< ::jfieldID >::element_type jfieldID
Definition types.hpp:55
jni::GetStaticFieldID
jfieldID & GetStaticFieldID(JNIEnv &env, jclass &clazz, const char *name, const char *sig)
Definition functions.hpp:343
object.hpp
jni::TypeSignature
Definition tagging.hpp:13
tagging.hpp
type_signature.hpp