Index: src/libical/vcomponent.cpp =================================================================== RCS file: /home/cvs/projects/libical/src/libical/vcomponent.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.4 diff -u -r1.1.1.1 -r1.4 --- src/libical/vcomponent.cpp 12 May 2004 08:53:09 -0000 1.1.1.1 +++ src/libical/vcomponent.cpp 7 Jun 2004 07:09:21 -0000 1.4 @@ -168,6 +173,36 @@ } /* Working with components */ +VComponent* VComponent::clone() { + VComponent* result = NULL; + icalcomponent* t = icalcomponent_new_clone(imp); + if (t != NULL) { + switch (icalcomponent_isa(t)) { + case ICAL_VALARM_COMPONENT: + result = new VAlarm(t); + break; + case ICAL_VCALENDAR_COMPONENT: + result = new VCalendar(t); + break; + case ICAL_VEVENT_COMPONENT: + result = new VEvent(t); + break; + case ICAL_VQUERY_COMPONENT: + result = new VQuery(t); + break; + case ICAL_VTODO_COMPONENT: + result = new VToDo(t); + break; + case ICAL_VAGENDA_COMPONENT: + result = new VAgenda(t); + break; + default: + result = new VComponent(t); + } + } + + return (result); +} /* Return the first VEVENT, VTODO or VJOURNAL sub-component if it is one of those types */ VComponent* VComponent::get_inner(){ return new VComponent(icalcomponent_get_inner(imp)); Index: src/libical/vcomponent.h =================================================================== RCS file: /home/cvs/projects/libical/src/libical/vcomponent.h,v retrieving revision 1.1.1.1 retrieving revision 1.4 diff -u -r1.1.1.1 -r1.4 --- src/libical/vcomponent.h 12 May 2004 08:53:09 -0000 1.1.1.1 +++ src/libical/vcomponent.h 7 Jun 2004 07:09:21 -0000 1.4 @@ -65,6 +66,7 @@ ICalProperty* get_next_property(icalproperty_kind kind); // Working with components + VComponent* clone(); /** * Return the first VEVENT, VTODO or VJOURNAL sub-component if