summaryrefslogtreecommitdiff
path: root/src/java/jniICalDurationType_cxx.cpp
blob: d7bb9d971df89207b1a9d5fa8aade0fa0bdcd5ef (plain)
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/*======================================================================
 FILE: jniICalDurationType_cxx.cpp
 CREATOR: structConverter
 (C) COPYRIGHT 2002, Critical Path

 This library is free software; you can redistribute it and/or modify
 it under the terms of either:

    The LGPL as published by the Free Software Foundation, version
    2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html

 Or:

    The Mozilla Public License Version 2.0. You may obtain a copy of
    the License at https://www.mozilla.org/MPL/
======================================================================*/

#include <jni.h>

#include "jniICalDurationType_cxx.h"

static jfieldID ICalDurationType_Is_neg_FID;
static jfieldID ICalDurationType_Days_FID;
static jfieldID ICalDurationType_Weeks_FID;
static jfieldID ICalDurationType_Hours_FID;
static jfieldID ICalDurationType_Minutes_FID;
static jfieldID ICalDurationType_Seconds_FID;


void initICalDurationTypeFieldIDs(JNIEnv* env, jclass clazz)
{
    ICalDurationType_Is_neg_FID = env->GetFieldID(clazz, "is_neg", "I");
    ICalDurationType_Days_FID = env->GetFieldID(clazz, "days", "J");
    ICalDurationType_Weeks_FID = env->GetFieldID(clazz, "weeks", "J");
    ICalDurationType_Hours_FID = env->GetFieldID(clazz, "hours", "J");
    ICalDurationType_Minutes_FID = env->GetFieldID(clazz, "minutes", "J");
    ICalDurationType_Seconds_FID = env->GetFieldID(clazz, "seconds", "J");
}

void  jni_SetIs_neg_in_ICalDurationType(struct ICalDurationType* __ICalDurationType_, JNIEnv *env, jobject thisICalDurationType)
{
    env->SetIntField(thisICalDurationType, ICalDurationType_Is_neg_FID, (jint) __ICalDurationType_->is_neg);
}

void jni_GetIs_neg_from_ICalDurationType(struct ICalDurationType* __ICalDurationType_, JNIEnv *env, jobject thisICalDurationType)
{
    __ICalDurationType_->is_neg = env->GetIntField(thisICalDurationType, ICalDurationType_Is_neg_FID);
}

void  jni_SetDays_in_ICalDurationType(struct ICalDurationType* __ICalDurationType_, JNIEnv *env, jobject thisICalDurationType)
{
    env->SetLongField(thisICalDurationType, ICalDurationType_Days_FID, (jlong) __ICalDurationType_->days);
}

void jni_GetDays_from_ICalDurationType(struct ICalDurationType* __ICalDurationType_, JNIEnv *env, jobject thisICalDurationType)
{
    __ICalDurationType_->days = env->GetLongField(thisICalDurationType, ICalDurationType_Days_FID);
}

void  jni_SetWeeks_in_ICalDurationType(struct ICalDurationType* __ICalDurationType_, JNIEnv *env, jobject thisICalDurationType)
{
    env->SetLongField(thisICalDurationType, ICalDurationType_Weeks_FID, (jlong) __ICalDurationType_->weeks);
}

void jni_GetWeeks_from_ICalDurationType(struct ICalDurationType* __ICalDurationType_, JNIEnv *env, jobject thisICalDurationType)
{
    __ICalDurationType_->weeks = env->GetLongField(thisICalDurationType, ICalDurationType_Weeks_FID);
}

void  jni_SetHours_in_ICalDurationType(struct ICalDurationType* __ICalDurationType_, JNIEnv *env, jobject thisICalDurationType)
{
    env->SetLongField(thisICalDurationType, ICalDurationType_Hours_FID, (jlong) __ICalDurationType_->hours);
}

void jni_GetHours_from_ICalDurationType(struct ICalDurationType* __ICalDurationType_, JNIEnv *env, jobject thisICalDurationType)
{
    __ICalDurationType_->hours = env->GetLongField(thisICalDurationType, ICalDurationType_Hours_FID);
}

void  jni_SetMinutes_in_ICalDurationType(struct ICalDurationType* __ICalDurationType_, JNIEnv *env, jobject thisICalDurationType)
{
    env->SetLongField(thisICalDurationType, ICalDurationType_Minutes_FID, (jlong) __ICalDurationType_->minutes);
}

void jni_GetMinutes_from_ICalDurationType(struct ICalDurationType* __ICalDurationType_, JNIEnv *env, jobject thisICalDurationType)
{
    __ICalDurationType_->minutes = env->GetLongField(thisICalDurationType, ICalDurationType_Minutes_FID);
}

void  jni_SetSeconds_in_ICalDurationType(struct ICalDurationType* __ICalDurationType_, JNIEnv *env, jobject thisICalDurationType)
{
    env->SetLongField(thisICalDurationType, ICalDurationType_Seconds_FID, (jlong) __ICalDurationType_->seconds);
}

void jni_GetSeconds_from_ICalDurationType(struct ICalDurationType* __ICalDurationType_, JNIEnv *env, jobject thisICalDurationType)
{
    __ICalDurationType_->seconds = env->GetLongField(thisICalDurationType, ICalDurationType_Seconds_FID);
}

// copy all fields from the c struct (ICalDurationType) to the java object (thisICalDurationType).
void jni_SetAll_in_ICalDurationType(struct ICalDurationType* __ICalDurationType_, JNIEnv* env, jobject thisICalDurationType)
{
    jni_SetIs_neg_in_ICalDurationType(__ICalDurationType_, env, thisICalDurationType);
    jni_SetDays_in_ICalDurationType(__ICalDurationType_, env, thisICalDurationType);
    jni_SetWeeks_in_ICalDurationType(__ICalDurationType_, env, thisICalDurationType);
    jni_SetHours_in_ICalDurationType(__ICalDurationType_, env, thisICalDurationType);
    jni_SetMinutes_in_ICalDurationType(__ICalDurationType_, env, thisICalDurationType);
    jni_SetSeconds_in_ICalDurationType(__ICalDurationType_, env, thisICalDurationType);
}

// copy all fields from the java object (thisICalDurationType) to the c struct (__ICalDurationType_).
void jni_GetAll_from_ICalDurationType(struct ICalDurationType* __ICalDurationType_, JNIEnv* env, jobject thisICalDurationType)
{
    jni_GetIs_neg_from_ICalDurationType(__ICalDurationType_, env, thisICalDurationType);
    jni_GetDays_from_ICalDurationType(__ICalDurationType_, env, thisICalDurationType);
    jni_GetWeeks_from_ICalDurationType(__ICalDurationType_, env, thisICalDurationType);
    jni_GetHours_from_ICalDurationType(__ICalDurationType_, env, thisICalDurationType);
    jni_GetMinutes_from_ICalDurationType(__ICalDurationType_, env, thisICalDurationType);
    jni_GetSeconds_from_ICalDurationType(__ICalDurationType_, env, thisICalDurationType);
}
/*
 * Class:     net_cp_jlibical_ICalDurationType
 * Method:    init
 * Signature: (J)V
 */
JNIEXPORT void JNICALL Java_net_cp_jlibical_ICalDurationType_init__J
  (JNIEnv *env, jobject thisICalDurationType, jlong data)
{
    // copy all fields from the c struct (data) to the java object (thisICalDurationType).
    jni_SetAll_in_ICalDurationType((ICalDurationType*)data,env,thisICalDurationType);
}

/*
 * Class:     net_cp_jlibical_ICalDurationType
 * Method:    initFIDs
 * Signature: ()V
 */
JNIEXPORT void JNICALL Java_net_cp_jlibical_ICalDurationType_initFIDs(JNIEnv *env, jclass clazz) {
    initICalDurationTypeFieldIDs(env, clazz);
}