-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathJMITest.h
55 lines (50 loc) · 1.88 KB
/
JMITest.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#pragma once
#include "jmi.h"
#include <array>
#include <valarray>
#include <vector>
struct JMITestClassTag : jmi::ClassTag { static constexpr auto name() { return JMISTR("JMITest");} };
class JMITestCached : public jmi::Object<JMITestCached> // or jmi::JObject<JMITestClassTag>
{
public:
static constexpr auto name() { return JMISTR("JMITest");} // required if derive from JObject<JMITestCached>
static void resetStatic();
void setX(jint v);
jint getX() const;
static void setY(jfloat v);
static jfloat getY();
void setStr(const char* v);
std::string getStr() const;
// java array is of fixed size
static void getSStr(std::array<std::string,1>& v);
static std::vector<std::string> getStrArrayS();
static std::string getSub(jint beginIndex, jint endIndex, std::string s);
std::string sub(jint beginIndex, jint endIndex) const;
std::vector<std::string> getStrArray() const;
std::valarray<jint> getIntArray() const;
void getIntArrayAsParam(jint v[2]) const;
void getIntArrayAsParam(std::array<jint, 2>& v) const;
JMITestCached getSelf() const;
void getSelfArray(std::array<JMITestCached,2>& v) const;
};
class JMITestUncached
{
public:
bool create() { return obj.create(); } // DO NOT forget to call it
static void resetStatic();
void setX(jint v);
jint getX() const;
static void setY(jfloat v);
static jfloat getY();
static std::string getSub(jint beginIndex, jint endIndex, std::string s);
std::string sub(jint beginIndex, jint endIndex) const;
void setStr(const std::string& v);
std::string getStr() const;
static std::vector<std::string> getStrArrayS();
std::vector<std::string> getStrArray() const;
std::vector<jint> getIntArray() const;
void getIntArrayAsParam(jint v[2]) const;
void getIntArrayAsParam(std::array<jint, 2>& v) const;
private:
jmi::JObject<JMITestClassTag> obj;
};