You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
#include <ical/Alarm.h>
#include <libical/icalproperty_cxx.h>
namespace ical { Alarm::Alarm(icalcomponent* alarm_component) { parse(alarm_component); }
void Alarm::parse(icalcomponent* alarm_component) { parse_action(alarm_component); parse_description(alarm_component); parse_trigger(alarm_component); DEBUG << "\n" << print(); }
void Alarm::parse_action(icalcomponent* alarm_component) { DEBUG << icalproperty_get_value_as_string(icalcomponent_get_first_property(alarm_component, ICAL_ACTION_PROPERTY)); }
void Alarm::parse_description(icalcomponent* alarm_component) { icalproperty* description_property = icalcomponent_get_first_property(alarm_component, ICAL_DESCRIPTION_PROPERTY); if(description_property != 0) { description = icalproperty_get_value_as_string(description_property); } }
void Alarm::parse_trigger(icalcomponent* alarm_component) { icalproperty* trigger_property = icalcomponent_get_first_property(alarm_component, ICAL_TRIGGER_PROPERTY); struct icaltriggertype tr; if(trigger_property != 0) { tr = icalproperty_get_trigger(trigger_property); if (!icaltime_is_null_time(tr.time)) { trigger = ical::trigger_type::ABSOLUTE; } else { trigger = ical::trigger_type::RELATIVE; } } }
std::string Alarm::print() const { std::string s = ""; s += "DESCRIPTION: " + description + "\n"; s += trigger == ical::trigger_type::ABSOLUTE ? "ABSOLUTE: " : "RELATIVE: "; return s; } }
|