bump to 1.0.0 and clean up spec file
[platform/upstream/libical.git] / src / java / net_cp_jlibical_VComponent_cxx.cpp
1 /* -*- Mode: C -*- */
2 /*======================================================================
3  FILE: net_cp_jlibical_VComponent_cxx.cpp
4  CREATOR: gnorman 1/10/02
5  (C) COPYRIGHT 2002, Critical Path
6 ======================================================================*/
7
8 #ifndef NET_CP_JLIBICAL_VCOMPONENT_CXX_H
9 #include "net_cp_jlibical_VComponent_cxx.h"
10 #endif
11
12 #ifndef JLIBICAL_CONSTS_CXX_H
13 #include "jlibical_consts_cxx.h"
14 #endif
15
16 #ifndef JLIBICAL_UTILS_CXX_H
17 #include "jlibical_utils_cxx.h"
18 #endif
19
20 #ifndef VCOMPONENT_CXX_H
21 #include "vcomponent.h"
22 #endif
23
24 #ifndef ICALPROPERTY_CXX_H
25 #include "icalproperty_cxx.h"
26 #endif
27
28 /*
29  * Class:     net_cp_jlibical_VComponent
30  * Method:    as_ical_string
31  * Signature: ()Ljava/lang/String;
32  */
33 JNIEXPORT jstring JNICALL Java_net_cp_jlibical_VComponent_as_1ical_1string
34   (JNIEnv *env, jobject jobj)
35 {
36         jstring result = NULL;
37         // get the VComponent c++ object from jobj
38         VComponent* cObj = getSubjectAsVComponent(env,jobj,JLIBICAL_ERR_CLIENT_INTERNAL);
39
40         if (cObj != NULL)
41         {
42                 char* icalStr = cObj->as_ical_string();
43
44                 if (icalStr == NULL)
45                 {
46                         icalStr = "";
47                 }
48
49                 result = env->NewStringUTF(icalStr);
50         }
51
52         return(result);
53 }
54
55 /*
56  * Class:     net_cp_jlibical_VComponent
57  * Method:    isa
58  * Signature: ()I
59  */
60 JNIEXPORT jint JNICALL Java_net_cp_jlibical_VComponent_isa
61   (JNIEnv *env, jobject jobj)
62 {
63         jint result = 0;
64         // get the VComponent c++ object from jobj
65         VComponent* cObj = getSubjectAsVComponent(env,jobj,JLIBICAL_ERR_CLIENT_INTERNAL);
66
67         if (cObj != NULL)
68         {
69                 result = cObj->isa();
70         }
71
72         return(result);
73 }
74
75 /*
76  * Class:     net_cp_jlibical_VComponent
77  * Method:    isa_component
78  * Signature: (Ljava/lang/Object;)Z
79  */
80 JNIEXPORT jboolean JNICALL Java_net_cp_jlibical_VComponent_isa_1component
81   (JNIEnv *env, jobject jobj, jobject candidateObj)
82 {
83         jboolean result = 0;
84
85         // get the VComponent c++ object from jobj
86         VComponent* cObj = getSubjectAsVComponent(env,jobj,JLIBICAL_ERR_CLIENT_INTERNAL);
87         if (cObj != NULL)
88         {
89                 void* candidateValue = 0;
90
91                 if (candidateObj != NULL)
92                 {
93                         // get the c++ object from candidateObj (as long)
94                         candidateValue = getCObjectPtr(env,candidateObj);
95                 }
96
97                 // get the result from the c++ object (candidateValue can be 0, it's cObj's responsibility to handle this if an error).
98                 result = cObj->isa_component(candidateValue) != 0;
99         }
100
101         return(result);
102 }
103
104 /*
105  * Class:     net_cp_jlibical_VComponent
106  * Method:    add_property
107  * Signature: (Lnet/cp/jlibical/ICalProperty;)V
108  */
109 JNIEXPORT void JNICALL Java_net_cp_jlibical_VComponent_add_1property
110   (JNIEnv *env, jobject jobj, jobject jprop)
111 {
112         // get the VComponent c++ object from jobj
113         VComponent* cObj = getSubjectAsVComponent(env,jobj,JLIBICAL_ERR_CLIENT_INTERNAL);
114         if (cObj != NULL)
115         {
116                 // get the ICalProperty c++ object from jprop
117                 ICalProperty* icalProperty = getSubjectAsICalProperty(env,jprop,JLIBICAL_ERR_ILLEGAL_ARGUMENT);
118
119                 if (icalProperty != NULL)
120                 {
121                         cObj->add_property(icalProperty);
122                 }
123         }
124 }
125
126 /*
127  * Class:     net_cp_jlibical_VComponent
128  * Method:    remove_property
129  * Signature: (Lnet/cp/jlibical/ICalProperty;)V
130  */
131 JNIEXPORT void JNICALL Java_net_cp_jlibical_VComponent_remove_1property
132   (JNIEnv *env, jobject jobj, jobject jprop)
133 {
134         // get the VComponent c++ object from jobj
135         VComponent* cObj = getSubjectAsVComponent(env,jobj,JLIBICAL_ERR_CLIENT_INTERNAL);
136         if (cObj != NULL)
137         {
138                 // get the ICalProperty c++ object from jprop
139                 ICalProperty* icalProperty = getSubjectAsICalProperty(env,jprop,JLIBICAL_ERR_ILLEGAL_ARGUMENT);
140
141                 if (icalProperty != NULL)
142                 {
143                         cObj->remove_property(icalProperty);
144                 }
145         }
146 }
147
148 /*
149  * Class:     net_cp_jlibical_VComponent
150  * Method:    count_properties
151  * Signature: (I)I
152  */
153 JNIEXPORT jint JNICALL Java_net_cp_jlibical_VComponent_count_1properties
154   (JNIEnv *env, jobject jobj, jint kind)
155 {
156         jint result = 0;
157
158         // get the VComponent c++ object from jobj
159         VComponent* cObj = getSubjectAsVComponent(env,jobj,JLIBICAL_ERR_CLIENT_INTERNAL);
160         if (cObj != NULL)
161         {
162                 result = cObj->count_properties((icalproperty_kind)kind);
163         }
164
165         return(result);
166 }
167
168 /*
169  * Class:     net_cp_jlibical_VComponent
170  * Method:    get_current_property
171  * Signature: ()Lnet/cp/jlibical/ICalProperty;
172  */
173 JNIEXPORT jobject JNICALL Java_net_cp_jlibical_VComponent_get_1current_1property
174   (JNIEnv *env, jobject jobj)
175 {
176         jobject result = 0;
177         // get the VComponent c++ object from jobj
178         VComponent* cObj = getSubjectAsVComponent(env,jobj,JLIBICAL_ERR_CLIENT_INTERNAL);
179
180         if (cObj != NULL)
181         {
182                 // get the current property from CObj
183                 ICalProperty* aProperty = cObj->get_current_property();
184
185                 // create a new surrogate, using aProperty as the subject (returns NULL if subject is NULL).
186                 result = createNewICalPropertySurrogate(env,aProperty);
187         }
188
189         return(result);
190 }
191
192 /*
193  * Class:     net_cp_jlibical_VComponent
194  * Method:    get_first_property
195  * Signature: (I)Lnet/cp/jlibical/ICalProperty;
196  */
197 JNIEXPORT jobject JNICALL Java_net_cp_jlibical_VComponent_get_1first_1property
198   (JNIEnv *env, jobject jobj, jint kind)
199 {
200         jobject result = 0;
201         // get the VComponent c++ object from jobj
202         VComponent* cObj = getSubjectAsVComponent(env,jobj,JLIBICAL_ERR_CLIENT_INTERNAL);
203
204         if (cObj != NULL)
205         {
206                 // get the first property from CObj
207                 ICalProperty* aProperty = cObj->get_first_property((icalproperty_kind)kind);
208
209                 // create a new surrogate, using aProperty as the subject (returns NULL if subject is NULL).
210                 result = createNewICalPropertySurrogate(env,aProperty);
211         }
212
213         return(result);
214 }
215
216 /*
217  * Class:     net_cp_jlibical_VComponent
218  * Method:    get_next_property
219  * Signature: (I)Lnet/cp/jlibical/ICalProperty;
220  */
221 JNIEXPORT jobject JNICALL Java_net_cp_jlibical_VComponent_get_1next_1property
222   (JNIEnv *env, jobject jobj, jint kind)
223 {
224         jobject result = 0;
225         VComponent* cObj = getSubjectAsVComponent(env,jobj,JLIBICAL_ERR_CLIENT_INTERNAL);
226
227         if (cObj != NULL)
228         {
229                 // get the next property from CObj
230                 ICalProperty* aProperty = cObj->get_next_property((icalproperty_kind)kind);
231
232                 // create a new surrogate, using aProperty as the subject (returns NULL if subject is NULL).
233                 result = createNewICalPropertySurrogate(env,aProperty);
234         }
235
236         return(result);
237 }
238
239 /*
240  * Class:     net_cp_jlibical_VComponent
241  * Method:    get_inner
242  * Signature: ()Lnet/cp/jlibical/VComponent;
243  */
244 JNIEXPORT jobject JNICALL Java_net_cp_jlibical_VComponent_get_1inner
245   (JNIEnv *env, jobject jobj)
246 {
247         jobject result = 0;
248         VComponent* cObj = getSubjectAsVComponent(env,jobj,JLIBICAL_ERR_CLIENT_INTERNAL);
249
250         if (cObj != NULL)
251         {
252                 // get the next property from CObj
253                 VComponent* inner = cObj->get_inner();
254
255                 // create a new surrogate, using inner as the subject (returns NULL if subject is NULL).
256                 result = createNewVComponentSurrogate(env,inner);
257         }
258
259         return(result);
260 }
261
262 /*
263  * Class:     net_cp_jlibical_VComponent
264  * Method:    add_component
265  * Signature: (Lnet/cp/jlibical/VComponent;)V
266  */
267 JNIEXPORT void JNICALL Java_net_cp_jlibical_VComponent_add_1component
268   (JNIEnv *env, jobject jobj, jobject jcomp)
269 {
270         // get the VComponent c++ object from jobj
271         VComponent* cObj = getSubjectAsVComponent(env,jobj,JLIBICAL_ERR_CLIENT_INTERNAL);
272         if (cObj != NULL)
273         {
274                 // get the VComponent c++ object from jcomp
275                 VComponent* aComponent = getSubjectAsVComponent(env,jcomp,JLIBICAL_ERR_ILLEGAL_ARGUMENT);
276
277                 if (aComponent != NULL)
278                 {
279                         cObj->add_component(aComponent);
280                 }
281         }
282 }
283
284 /*
285  * Class:     net_cp_jlibical_VComponent
286  * Method:    remove_component
287  * Signature: (Lnet/cp/jlibical/VComponent;)V
288  */
289 JNIEXPORT void JNICALL Java_net_cp_jlibical_VComponent_remove_1component
290   (JNIEnv *env, jobject jobj, jobject jcomp)
291 {
292         // get the VComponent c++ object from jobj
293         VComponent* cObj = getSubjectAsVComponent(env,jobj,JLIBICAL_ERR_CLIENT_INTERNAL);
294         if (cObj != NULL)
295         {
296                 // get the VComponent c++ object from jcomp
297                 VComponent* aComponent = getSubjectAsVComponent(env,jcomp,JLIBICAL_ERR_ILLEGAL_ARGUMENT);
298
299                 if (aComponent != NULL)
300                 {
301                         cObj->remove_component(aComponent);
302                 }
303         }
304 }
305
306 /*
307  * Class:     net_cp_jlibical_VComponent
308  * Method:    count_components
309  * Signature: (I)I
310  */
311 JNIEXPORT jint JNICALL Java_net_cp_jlibical_VComponent_count_1components
312   (JNIEnv *env, jobject jobj, jint kind)
313 {
314         jint result = 0;
315
316         // get the VComponent c++ object from jobj
317         VComponent* cObj = getSubjectAsVComponent(env,jobj,JLIBICAL_ERR_CLIENT_INTERNAL);
318         if (cObj != NULL)
319         {
320                 result = cObj->count_components((icalcomponent_kind)kind);
321         }
322
323         return(result);
324 }
325
326 /*
327  * Class:     net_cp_jlibical_VComponent
328  * Method:    get_current_component
329  * Signature: ()Lnet/cp/jlibical/VComponent;
330  */
331 JNIEXPORT jobject JNICALL Java_net_cp_jlibical_VComponent_get_1current_1component
332   (JNIEnv *env, jobject jobj)
333 {
334         jobject result = 0;
335         VComponent* cObj = getSubjectAsVComponent(env,jobj,JLIBICAL_ERR_CLIENT_INTERNAL);
336
337         if (cObj != NULL)
338         {
339                 // get the next property from CObj
340                 VComponent* aComponent = cObj->get_current_component();
341
342                 // create a new surrogate, using aComponent as the subject (returns NULL if subject is NULL).
343                 result = createNewVComponentSurrogate(env,aComponent);
344         }
345
346         return(result);
347 }
348
349 /*
350  * Class:     net_cp_jlibical_VComponent
351  * Method:    get_first_component
352  * Signature: (I)Lnet/cp/jlibical/VComponent;
353  */
354 JNIEXPORT jobject JNICALL Java_net_cp_jlibical_VComponent_get_1first_1component
355   (JNIEnv *env, jobject jobj, jint kind)
356 {
357         jobject result = 0;
358         // get the VComponent c++ object from jobj
359         VComponent* cObj = getSubjectAsVComponent(env,jobj,JLIBICAL_ERR_CLIENT_INTERNAL);
360
361         if (cObj != NULL)
362         {
363                 // get the first component from CObj
364                 VComponent* aComponent = cObj->get_first_component((icalcomponent_kind)kind);
365
366                 // create a new surrogate, using aComponent as the subject (returns NULL if subject is NULL).
367                 result = createNewVComponentSurrogate(env,aComponent);
368         }
369
370         return(result);
371 }
372
373 /*
374  * Class:     net_cp_jlibical_VComponent
375  * Method:    get_next_component
376  * Signature: (I)Lnet/cp/jlibical/VComponent;
377  */
378 JNIEXPORT jobject JNICALL Java_net_cp_jlibical_VComponent_get_1next_1component
379   (JNIEnv *env, jobject jobj, jint kind)
380 {
381         jobject result = 0;
382         // get the VComponent c++ object from jobj
383         VComponent* cObj = getSubjectAsVComponent(env,jobj,JLIBICAL_ERR_CLIENT_INTERNAL);
384
385         if (cObj != NULL)
386         {
387                 // get the first component from CObj
388                 VComponent* aComponent = cObj->get_next_component((icalcomponent_kind)kind);
389
390                 // create a new surrogate, using aComponent as the subject (returns NULL if subject is NULL).
391                 result = createNewVComponentSurrogate(env,aComponent);
392         }
393
394         return(result);
395 }
396
397 /*
398  * Class:     net_cp_jlibical_VComponent
399  * Method:    get_dtstart
400  * Signature: ()Lnet/cp/jlibical/ICalTimeType;
401  */
402 JNIEXPORT jobject JNICALL Java_net_cp_jlibical_VComponent_get_1dtstart
403   (JNIEnv *env, jobject jobj)
404 {
405         jobject result = 0;
406         // get the VComponent c++ object from jobj
407         VComponent* cObj = getSubjectAsVComponent(env,jobj,JLIBICAL_ERR_CLIENT_INTERNAL);
408
409         if (cObj != NULL)
410         {
411                 // get the dtstart time from CObj
412                 icaltimetype aTime = cObj->get_dtstart();
413
414                 // create a new surrogate, using aTime as the subject.
415                 result = createNewICalTimeType(env,&aTime);
416         }
417
418         return(result);
419 }
420
421 /*
422  * Class:     net_cp_jlibical_VComponent
423  * Method:    set_dtstart
424  * Signature: (Lnet/cp/jlibical/ICalTimeType;)V
425  */
426 JNIEXPORT void JNICALL Java_net_cp_jlibical_VComponent_set_1dtstart
427   (JNIEnv *env, jobject jobj, jobject dtstart)
428 {
429         jobject result = 0;
430         // get the VComponent c++ object from jobj
431         VComponent* cObj = getSubjectAsVComponent(env,jobj,JLIBICAL_ERR_CLIENT_INTERNAL);
432
433         if (cObj != NULL)
434         {
435                 icaltimetype aStartTime;
436
437                 if (copyObjToicaltimetype(env,dtstart,&aStartTime))
438                 {
439                         cObj->set_dtstart(aStartTime);
440                 }
441         }
442 }
443
444 /*
445  * Class:     net_cp_jlibical_VComponent
446  * Method:    get_dtend
447  * Signature: ()Lnet/cp/jlibical/ICalTimeType;
448  */
449 JNIEXPORT jobject JNICALL Java_net_cp_jlibical_VComponent_get_1dtend
450   (JNIEnv *env, jobject jobj)
451 {
452         jobject result = 0;
453         // get the VComponent c++ object from jobj
454         VComponent* cObj = getSubjectAsVComponent(env,jobj,JLIBICAL_ERR_CLIENT_INTERNAL);
455
456         if (cObj != NULL)
457         {
458                 // get the dtend time from CObj
459                 icaltimetype aTime = cObj->get_dtend();
460
461                 // create a new surrogate, using aTime as the subject.
462                 result = createNewICalTimeType(env,&aTime);
463
464         }
465
466         return(result);
467 }
468
469 /*
470  * Class:     net_cp_jlibical_VComponent
471  * Method:    set_dtend
472  * Signature: (Lnet/cp/jlibical/ICalTimeType;)V
473  */
474 JNIEXPORT void JNICALL Java_net_cp_jlibical_VComponent_set_1dtend
475   (JNIEnv *env, jobject jobj, jobject dtend)
476 {
477         jobject result = 0;
478         // get the VComponent c++ object from jobj
479         VComponent* cObj = getSubjectAsVComponent(env,jobj,JLIBICAL_ERR_CLIENT_INTERNAL);
480
481         if (cObj != NULL)
482         {
483                 icaltimetype anEndTime;
484
485                 if (copyObjToicaltimetype(env,dtend,&anEndTime))
486                 {
487                         cObj->set_dtend(anEndTime);
488                 }
489         }
490 }
491
492 /*
493  * Class:     net_cp_jlibical_VComponent
494  * Method:    get_duration
495  * Signature: ()Lnet/cp/jlibical/ICalDurationType;
496  */
497 JNIEXPORT jobject JNICALL Java_net_cp_jlibical_VComponent_get_1duration
498   (JNIEnv *env, jobject jobj)
499 {
500         jobject result = 0;
501         // get the VComponent c++ object from jobj
502         VComponent* cObj = getSubjectAsVComponent(env,jobj,JLIBICAL_ERR_CLIENT_INTERNAL);
503
504         if (cObj != NULL)
505         {
506                 // get the duration time from CObj
507                 icaldurationtype aDuration = cObj->get_duration();
508
509                 // create a new surrogate, using aDuration as the subject.
510                 result = createNewICalDurationType(env,&aDuration);
511         }
512
513         return(result);
514 }
515
516 /*
517  * Class:     net_cp_jlibical_VComponent
518  * Method:    set_duration
519  * Signature: (Lnet/cp/jlibical/ICalDurationType;)V
520  */
521 JNIEXPORT void JNICALL Java_net_cp_jlibical_VComponent_set_1duration
522   (JNIEnv *env, jobject jobj, jobject duration)
523 {
524         jobject result = 0;
525         // get the VComponent c++ object from jobj
526         VComponent* cObj = getSubjectAsVComponent(env,jobj,JLIBICAL_ERR_CLIENT_INTERNAL);
527
528         if (cObj != NULL)
529         {
530                 icaldurationtype aDuration;
531
532                 if (copyObjToicaldurationtype(env,duration,&aDuration))
533                 {
534                         cObj->set_duration(aDuration);
535                 }
536         }
537 }
538
539 /*
540  * Class:     net_cp_jlibical_VComponent
541  * Method:    get_method
542  * Signature: ()I
543  */
544 JNIEXPORT jint JNICALL Java_net_cp_jlibical_VComponent_get_1method
545   (JNIEnv *env, jobject jobj)
546 {
547         jint result = 0;
548         VComponent* cObj = getSubjectAsVComponent(env,jobj,JLIBICAL_ERR_CLIENT_INTERNAL);
549
550         if (cObj != NULL)
551         {
552                 result = cObj->get_method();
553         }
554
555         return(result);
556 }
557
558 /*
559  * Class:     net_cp_jlibical_VComponent
560  * Method:    set_method
561  * Signature: (I)V
562  */
563 JNIEXPORT void JNICALL Java_net_cp_jlibical_VComponent_set_1method
564   (JNIEnv *env, jobject jobj, jint value)
565 {
566         VComponent* cObj = getSubjectAsVComponent(env,jobj,JLIBICAL_ERR_CLIENT_INTERNAL);
567
568         if (cObj != NULL)
569         {
570                 cObj->set_method((icalproperty_method)value);
571         }
572 }
573
574 /*
575  * Class:     net_cp_jlibical_VComponent
576  * Method:    get_summary
577  * Signature: ()Ljava/lang/String;
578  */
579 JNIEXPORT jstring JNICALL Java_net_cp_jlibical_VComponent_get_1summary
580   (JNIEnv *env, jobject jobj)
581 {
582         jstring result = NULL;
583         VComponent* cObj = getSubjectAsVComponent(env,jobj,JLIBICAL_ERR_CLIENT_INTERNAL);
584
585         if (cObj != NULL)
586         {
587                 char* icalStr = cObj->get_summary();
588
589                 if (icalStr == NULL)
590                 {
591                         icalStr = "";
592                 }
593
594                 result = env->NewStringUTF(icalStr);
595         }
596
597         return(result);
598 }
599
600 /*
601  * Class:     net_cp_jlibical_VComponent
602  * Method:    set_summary
603  * Signature: (Ljava/lang/String;)V
604  */
605 JNIEXPORT void JNICALL Java_net_cp_jlibical_VComponent_set_1summary
606   (JNIEnv *env, jobject jobj, jstring str)
607 {
608         VComponent* cObj = getSubjectAsVComponent(env,jobj,JLIBICAL_ERR_CLIENT_INTERNAL);
609
610         if (cObj != NULL)
611         {
612                 const char* szTemp = env->GetStringUTFChars(str,NULL);
613
614                 cObj->set_summary((char*)szTemp);
615                 env->ReleaseStringUTFChars(str,szTemp);
616         }
617 }
618
619 /*
620  * Class:     net_cp_jlibical_VComponent
621  * Method:    get_dtstamp
622  * Signature: ()Lnet/cp/jlibical/ICalTimeType;
623  */
624 JNIEXPORT jobject JNICALL Java_net_cp_jlibical_VComponent_get_1dtstamp
625   (JNIEnv *env, jobject jobj)
626 {
627         jobject result = 0;
628         // get the VComponent c++ object from jobj
629         VComponent* cObj = getSubjectAsVComponent(env,jobj,JLIBICAL_ERR_CLIENT_INTERNAL);
630
631         if (cObj != NULL)
632         {
633                 // get the recurrenceid from CObj
634                 icaltimetype aDTStamp = cObj->get_dtstamp();
635
636         // create a new surrogate, using aRecurrenceId as the subject.
637                 result = createNewICalTimeType(env,&aDTStamp);
638         }
639
640         return(result);
641 }
642
643 /*
644  * Class:     net_cp_jlibical_VComponent
645  * Method:    set_dtstamp
646  * Signature: (Lnet/cp/jlibical/ICalTimeType;)V
647  */
648 JNIEXPORT void JNICALL Java_net_cp_jlibical_VComponent_set_1dtstamp
649   (JNIEnv *env, jobject jobj, jobject dtstamp)
650 {
651         // get the VComponent c++ object from jobj
652         VComponent* cObj = getSubjectAsVComponent(env,jobj,JLIBICAL_ERR_CLIENT_INTERNAL);
653
654         if (cObj != NULL)
655         {
656                 icaltimetype aDTStamp;
657
658                 if (copyObjToicaltimetype(env,dtstamp,&aDTStamp))
659                 {
660                         cObj->set_dtstamp(aDTStamp);
661                 }
662         }
663 }
664
665 /*
666  * Class:     net_cp_jlibical_VComponent
667  * Method:    get_location
668  * Signature: ()Ljava/lang/String;
669  */
670 JNIEXPORT jstring JNICALL Java_net_cp_jlibical_VComponent_get_1location
671   (JNIEnv *env, jobject jobj)
672 {
673         jstring result = NULL;
674         VComponent* cObj = getSubjectAsVComponent(env,jobj,JLIBICAL_ERR_CLIENT_INTERNAL);
675
676         if (cObj != NULL)
677         {
678                 char* icalStr = cObj->get_location();
679
680                 if (icalStr == NULL)
681                 {
682                         icalStr = "";
683                 }
684
685                 result = env->NewStringUTF(icalStr);
686         }
687
688         return(result);
689 }
690
691 /*
692  * Class:     net_cp_jlibical_VComponent
693  * Method:    set_location
694  * Signature: (Ljava/lang/String;)V
695  */
696 JNIEXPORT void JNICALL Java_net_cp_jlibical_VComponent_set_1location
697   (JNIEnv *env, jobject jobj, jstring str)
698 {
699         VComponent* cObj = getSubjectAsVComponent(env,jobj,JLIBICAL_ERR_CLIENT_INTERNAL);
700
701         if (cObj != NULL)
702         {
703                 const char* szTemp = env->GetStringUTFChars(str,NULL);
704
705                 cObj->set_summary((char*)szTemp);
706                 env->ReleaseStringUTFChars(str,szTemp);
707         }
708 }
709
710 /*
711  * Class:     net_cp_jlibical_VComponent
712  * Method:    get_description
713  * Signature: ()Ljava/lang/String;
714  */
715 JNIEXPORT jstring JNICALL Java_net_cp_jlibical_VComponent_get_1description
716   (JNIEnv *env, jobject jobj)
717 {
718         jstring result = NULL;
719         VComponent* cObj = getSubjectAsVComponent(env,jobj,JLIBICAL_ERR_CLIENT_INTERNAL);
720
721         if (cObj != NULL)
722         {
723                 char* icalStr = cObj->get_description();
724
725                 if (icalStr == NULL)
726                 {
727                         icalStr = "";
728                 }
729
730                 result = env->NewStringUTF(icalStr);
731         }
732
733         return(result);
734 }
735
736 /*
737  * Class:     net_cp_jlibical_VComponent
738  * Method:    set_description
739  * Signature: (Ljava/lang/String;)V
740  */
741 JNIEXPORT void JNICALL Java_net_cp_jlibical_VComponent_set_1description
742   (JNIEnv *env, jobject jobj, jstring str)
743 {
744         VComponent* cObj = getSubjectAsVComponent(env,jobj,JLIBICAL_ERR_CLIENT_INTERNAL);
745
746         if (cObj != NULL)
747         {
748                 const char* szTemp = env->GetStringUTFChars(str,NULL);
749
750                 cObj->set_summary((char*)szTemp);
751                 env->ReleaseStringUTFChars(str,szTemp);
752         }
753 }
754 /*
755  * Class:     net_cp_jlibical_VComponent
756  * Method:    get_uid
757  * Signature: ()Ljava/lang/String;
758  */
759 JNIEXPORT jstring JNICALL Java_net_cp_jlibical_VComponent_get_1uid
760   (JNIEnv *env, jobject jobj)
761 {
762         jstring result = NULL;
763         VComponent* cObj = getSubjectAsVComponent(env,jobj,JLIBICAL_ERR_CLIENT_INTERNAL);
764
765         if (cObj != NULL)
766         {
767                 char* icalStr = cObj->get_uid();
768
769                 if (icalStr == NULL)
770                 {
771                         icalStr = "";
772                 }
773
774                 result = env->NewStringUTF(icalStr);
775         }
776
777         return(result);
778 }
779
780 /*
781  * Class:     net_cp_jlibical_VComponent
782  * Method:    set_uid
783  * Signature: (Ljava/lang/String;)V
784  */
785 JNIEXPORT void JNICALL Java_net_cp_jlibical_VComponent_set_1uid
786   (JNIEnv *env, jobject jobj, jstring str)
787 {
788         VComponent* cObj = getSubjectAsVComponent(env,jobj,JLIBICAL_ERR_CLIENT_INTERNAL);
789
790         if (cObj != NULL)
791         {
792                 const char* szTemp = env->GetStringUTFChars(str,NULL);
793
794                 cObj->set_uid((char*)szTemp);
795                 env->ReleaseStringUTFChars(str,szTemp);
796         }
797 }
798
799 /*
800  * Class:     net_cp_jlibical_VComponent
801  * Method:    get_first_real_component
802  * Signature: ()Lnet/cp/jlibical/VComponent;
803  */
804 JNIEXPORT jobject JNICALL Java_net_cp_jlibical_VComponent_get_1first_1real_1component
805   (JNIEnv *env, jobject jobj)
806 {
807         jobject result = 0;
808         // get the VComponent c++ object from jobj
809         VComponent* cObj = getSubjectAsVComponent(env,jobj,JLIBICAL_ERR_CLIENT_INTERNAL);
810
811         if (cObj != NULL)
812         {
813                 // get the first component from CObj
814                 VComponent* aComponent = cObj->get_first_real_component();
815
816                 // create a new surrogate, using aComponent as the subject (returns NULL if subject is NULL).
817                 result = createNewVComponentSurrogate(env,aComponent);
818         }
819
820         return(result);
821 }
822
823 /*
824  * Class:     net_cp_jlibical_VComponent
825  * Method:    init
826  * Signature: ()V
827  */
828 JNIEXPORT void JNICALL Java_net_cp_jlibical_VComponent_init__
829   (JNIEnv *env, jobject jobj)
830 {
831         setCObjectPtr(env,jobj,new VComponent());
832 }
833
834 /*
835  * Class:     net_cp_jlibical_VComponent
836  * Method:    init
837  * Signature: (Ljava/lang/String;)V
838  */
839 JNIEXPORT void JNICALL Java_net_cp_jlibical_VComponent_init__Ljava_lang_String_2
840   (JNIEnv *env, jobject jobj, jstring str)
841 {
842         if (str != NULL)
843         {
844                 const char* szTemp = env->GetStringUTFChars(str,NULL);
845
846                 setCObjectPtr(env,jobj,new VComponent((char*)szTemp));
847                 env->ReleaseStringUTFChars(str,szTemp);
848         }
849         else
850         {
851                 throwException( env, JLIBICAL_ERR_ILLEGAL_ARGUMENT );
852         }
853 }
854
855 /*
856  * Class:     net_cp_jlibical_VComponent
857  * Method:    init
858  * Signature: (I)V
859  */
860 JNIEXPORT void JNICALL Java_net_cp_jlibical_VComponent_init__I
861   (JNIEnv *env, jobject jobj, jint kind)
862 {
863         setCObjectPtr(env,jobj,new VComponent((icalcomponent_kind)kind));
864 }
865
866 /*
867  * Class:     net_cp_jlibical_VComponent
868  * Method:    set_relcalid
869  * Signature: (Ljava/lang/String;)V
870  */
871 JNIEXPORT void JNICALL Java_net_cp_jlibical_VComponent_set_1relcalid
872   (JNIEnv *env, jobject jobj, jstring str)
873 {
874         VComponent* cObj = getSubjectAsVComponent(env,jobj,JLIBICAL_ERR_CLIENT_INTERNAL);
875
876         if (cObj != NULL)
877         {
878                 const char* szTemp = env->GetStringUTFChars(str,NULL);
879
880                 cObj->set_relcalid((char*)szTemp);
881                 env->ReleaseStringUTFChars(str,szTemp);
882         }
883 }
884
885 /*
886  * Class:     net_cp_jlibical_VComponent
887  * Method:    get_relcalid
888  * Signature: ()Ljava/lang/String;
889  */
890 JNIEXPORT jstring JNICALL Java_net_cp_jlibical_VComponent_get_1relcalid
891   (JNIEnv *env, jobject jobj)
892 {
893         jstring result = NULL;
894         VComponent* cObj = getSubjectAsVComponent(env,jobj,JLIBICAL_ERR_CLIENT_INTERNAL);
895
896         if (cObj != NULL)
897         {
898                 char* icalStr = cObj->get_relcalid();
899
900                 if (icalStr == NULL)
901                 {
902                         icalStr = "";
903                 }
904
905                 result = env->NewStringUTF(icalStr);
906         }
907
908         return(result);
909 }
910
911 /*
912  * Class:     net_cp_jlibical_VComponent
913  * Method:    get_recurrenceid
914  * Signature: ()Lnet/cp/jlibical/ICalTimeType;
915  */
916 JNIEXPORT jobject JNICALL Java_net_cp_jlibical_VComponent_get_1recurrenceid
917   (JNIEnv *env, jobject jobj)
918 {
919         jobject result = 0;
920         // get the VComponent c++ object from jobj
921         VComponent* cObj = getSubjectAsVComponent(env,jobj,JLIBICAL_ERR_CLIENT_INTERNAL);
922
923         if (cObj != NULL)
924         {
925                 // get the recurrenceid from CObj
926                 icaltimetype aRecurrenceId = cObj->get_recurrenceid();
927
928         // create a new surrogate, using aRecurrenceId as the subject.
929                 result = createNewICalTimeType(env,&aRecurrenceId);
930         }
931
932         return(result);
933 }
934
935 /*
936  * Class:     net_cp_jlibical_VComponent
937  * Method:    set_recurrenceid
938  * Signature: (Lnet/cp/jlibical/ICalTimeType;)V
939  */
940 JNIEXPORT void JNICALL Java_net_cp_jlibical_VComponent_set_1recurrenceid
941   (JNIEnv *env, jobject jobj, jobject recurrenceid)
942 {
943         jobject result = 0;
944         // get the VComponent c++ object from jobj
945         VComponent* cObj = getSubjectAsVComponent(env,jobj,JLIBICAL_ERR_CLIENT_INTERNAL);
946
947         if (cObj != NULL)
948         {
949                 icaltimetype aRecurrenceId;
950
951                 if (copyObjToicaltimetype(env,recurrenceid,&aRecurrenceId))
952                 {
953                         cObj->set_recurrenceid(aRecurrenceId);
954                 }
955         }
956 }