bump to 1.0.0 and clean up spec file
[platform/upstream/libical.git] / src / java / VComponent.java
1 /*======================================================================
2  FILE: VComponent.java
3  CREATOR: gnorman 01/11/02
4  (C) COPYRIGHT 2002, Critical Path
5 ======================================================================*/
6
7 package net.cp.jlibical;
8
9 public class VComponent
10 {
11         /** It's not typesafe, but it's simple to understand! */
12         public interface ICalComponentKind
13         {
14                 // icalcomponent_kind
15                 int ICAL_NO_COMPONENT = 0;
16                 int ICAL_ANY_COMPONENT = 1;
17                 int ICAL_XROOT_COMPONENT = 2;
18                 int ICAL_XATTACH_COMPONENT = 3;
19                 int ICAL_VEVENT_COMPONENT = 4;
20                 int ICAL_VTODO_COMPONENT = 5;
21                 int ICAL_VJOURNAL_COMPONENT = 6;
22                 int ICAL_VCALENDAR_COMPONENT = 7;
23                 int ICAL_VAGENDA_COMPONENT = 8;
24                 int ICAL_VFREEBUSY_COMPONENT = 9;
25                 int ICAL_VALARM_COMPONENT = 10;
26                 int ICAL_XAUDIOALARM_COMPONENT = 11;
27                 int ICAL_XDISPLAYALARM_COMPONENT = 12;
28                 int ICAL_XEMAILALARM_COMPONENT = 13;
29                 int ICAL_XPROCEDUREALARM_COMPONENT = 14;
30                 int ICAL_VTIMEZONE_COMPONENT = 15;
31                 int ICAL_XSTANDARD_COMPONENT = 16;
32                 int ICAL_XDAYLIGHT_COMPONENT = 17;
33                 int ICAL_X_COMPONENT = 18;
34                 int ICAL_VSCHEDULE_COMPONENT = 19;
35                 int ICAL_VQUERY_COMPONENT = 20;
36                 int ICAL_VCOMMAND_COMPONENT = 21;
37                 int ICAL_XLICINVALID_COMPONENT = 22;
38                 int ICAL_XLICMIMEPART_COMPONENT = 23;
39                 int ICAL_XPREFERENCES_COMPONENT = 24;
40         }
41
42         /**
43          * Constructor for VComponent
44          * @param obj c++ pointer
45          */
46         protected VComponent(long obj)
47         {
48                 init(obj);
49         }
50
51         public VComponent()
52         {
53                 init();
54         }
55
56         public VComponent(/* ICalComponentKind */ int kind)
57         {
58                 init(kind);
59         }
60
61         public VComponent(String str)
62         {
63                 init(str);
64         }
65
66         public native String as_ical_string();
67         //public native boolean is_valid();
68         public native /* ICalComponentKind */ int isa();
69         public native boolean isa_component(Object component);
70
71         /* Working with properties */
72         public native void add_property(ICalProperty property);
73         public native void remove_property(ICalProperty property);
74         public native int count_properties(/* ICalPropertyKind */ int kind);
75
76         /* Iterate through the properties */
77         public native ICalProperty get_current_property();
78         public native ICalProperty get_first_property(/* ICalPropertyKind */ int kind);
79         public native ICalProperty get_next_property(/* ICalPropertyKind */ int kind);
80
81         /* Working with components */
82
83         /* Return the first VEVENT, VTODO or VJOURNAL sub-component if it is one of those types */
84         public native VComponent get_inner();
85
86         public native void add_component(VComponent child);
87         public native void remove_component(VComponent child);
88         public native int count_components(/* ICalComponentKind */ int kind);
89
90         /* Iteration Routines. There are two forms of iterators, internal and
91            external. The internal ones came first, and are almost completely
92            sufficient, but they fail badly when you want to construct a loop that
93            removes components from the container.
94         */
95
96         /* Iterate through components */
97         public native VComponent get_current_component();
98         public native VComponent get_first_component(/* ICalComponentKind */ int kind);
99         public native VComponent get_next_component(/* ICalComponentKind */ int kind);
100
101         /* Using external iterators */
102         //public native icalcompiter begin_component(/* ICalComponentKind */ int kind);
103         //public native icalcompiter end_component(/* ICalComponentKind */ int kind);
104         //public native VComponent next(icalcompiter i);
105         //public native VComponent prev(icalcompiter i);
106         //public native VComponent current(icalcompiter i);
107
108         /* Working with embedded error properties */
109         //public native int count_errors();
110
111         /* Remove all X-LIC-ERROR properties*/
112         //public native void strip_errors();
113
114         /* Convert some X-LIC-ERROR properties into RETURN-STATUS properties*/
115         //public native void convert_errors();
116
117         /* Kind conversion routines */
118         //public native static /* ICalComponentKind */ int string_to_kind(String str);
119         //public native static String kind_to_string(/* ICalComponentKind */ int kind);
120
121         public native ICalTimeType get_dtstart();
122         public native void set_dtstart(ICalTimeType v);
123
124         /* For the icalcomponent routines only, dtend and duration are tied
125            together. If you call the set routine for one and the other exists,
126            the routine will calculate the change to the other. That is, if
127            there is a DTEND and you call set_duration, the routine will modify
128            DTEND to be the sum of DTSTART and the duration. If you call a get
129            routine for one and the other exists, the routine will calculate
130            the return value. If you call a set routine and neither exists, the
131            routine will create the apcompriate comperty */
132
133         public native ICalTimeType get_dtend();
134         public native void set_dtend(ICalTimeType v);
135
136         public native ICalDurationType get_duration();
137         public native void set_duration(ICalDurationType v);
138
139         public native /* ICalPropertyMethod */ int get_method();
140         public native void set_method(/* ICalPropertyMethod */ int method);
141
142         public native ICalTimeType get_dtstamp();
143         public native void set_dtstamp(ICalTimeType v);
144
145         public native String get_summary();
146         public native void set_summary(String v);
147
148         public native String get_location();
149         public native void set_location(String v);
150
151         public native String get_description();
152         public native void set_description(String v);
153
154         //public native String get_comment();
155         //public native void set_comment(String v);
156
157         public native String get_uid();
158         public native void set_uid(String v);
159
160         public native String get_relcalid();
161         public native void set_relcalid(String v);
162
163         public native ICalTimeType get_recurrenceid();
164         public native void set_recurrenceid(ICalTimeType v);
165
166         /* For VCOMPONENT: Return a reference to the first VEVENT, VTODO, or VJOURNAL */
167         public native VComponent get_first_real_component();
168
169         /* For VEVENT, VTODO, VJOURNAL and VTIMEZONE: report the start and end
170            times of an event in UTC */
171         //public native virtual struct icaltime_span get_span();
172
173         /**
174          * init the native class
175          */
176         private void init(long obj)
177         {
178                 m_Obj = obj;
179         }
180
181         private native void init();
182         private native void init(String str);
183         private native void init(/* ICalComponentKind */ int kind);
184
185         /**
186          * load the jni library for this class
187          */
188         static {
189                 System.loadLibrary("ical_jni");
190         }
191
192         public static void main(String[] args)
193         {
194                 System.out.println("*** VComponent main called ok.");
195         }
196
197         /** pointer to C++ object  */
198         private long    m_Obj = 0;
199 }