Libical API Documentation
3.0
|
Functions for working with iCal periods (of time). More...
Go to the source code of this file.
Data Structures | |
struct | icalperiodtype |
Struct to represent a period in time. More... | |
Macros | |
#define | ICALPERIODTYPE_INITIALIZER |
Functions | |
const char * | icalperiodtype_as_ical_string (struct icalperiodtype p) |
Converts an icalperiodtype into an iCal-formatted string. More... | |
char * | icalperiodtype_as_ical_string_r (struct icalperiodtype p) |
Converts an icalperiodtype into an iCal-formatted string. More... | |
struct icalperiodtype | icalperiodtype_from_string (const char *str) |
Constructs a new icalperiodtype from str. More... | |
int | icalperiodtype_is_null_period (struct icalperiodtype p) |
int | icalperiodtype_is_valid_period (struct icalperiodtype p) |
struct icalperiodtype | icalperiodtype_null_period (void) |
Functions for working with iCal periods (of time).
#define ICALPERIODTYPE_INITIALIZER |
const char* icalperiodtype_as_ical_string | ( | struct icalperiodtype | p | ) |
Converts an icalperiodtype into an iCal-formatted string.
p | The time period to convert |
free()
by the caller.```c // create icalperiodtype const char *period_string = "20170606T090000/20170607T090000"; struct icalperiodtype period = icalperiodtype_from_string(period_string);
// print period in iCal format printf("%s\n", icalperiodtype_as_ical_string(period));
char* icalperiodtype_as_ical_string_r | ( | struct icalperiodtype | p | ) |
Converts an icalperiodtype into an iCal-formatted string.
p | The time period to convert |
```c // create icalperiodtype const char *period_string = "20170606T090000/20170607T090000"; struct icalperiodtype period = icalperiodtype_from_string(period_string);
// print period in iCal format const char *period_string_gen = icalperiodtype_as_ical_string_r(period); printf("%s\n", period_string_gen); icalmemory_free_buffer(period_string_gen);
struct icalperiodtype icalperiodtype_from_string | ( | const char * | str | ) |
Constructs a new icalperiodtype from str.
str | The string from which to construct a time period |
<STARTTIME>/<ENDTIME>
<STARTTIME>/<DURATION>
The format for the times is the same as those used by icaltime_from_string(), and the format for the duration is the same as that used by icaldurationtype_from_string().
```c // create icalperiodtype const char *period_string = "20170606T090000/20170607T090000"; struct icalperiodtype period = icalperiodtype_from_string(period_string);
// print period in iCal format printf("%s\n", icalperiodtype_as_ical_string(period));
int icalperiodtype_is_null_period | ( | struct icalperiodtype | p | ) |
Checks if a given icalperiodtype is a null period.
p | The time period to check |
```c // creates null period struct icalperiodtype period = icalperiodtype_null_period();
// checks if it's a null period assert(icalperiodtype_is_null_period(period));
int icalperiodtype_is_valid_period | ( | struct icalperiodtype | p | ) |
Checks if a given icalperiodtype is a valid period.
p | The time period to check |
```c // creates null period struct icalperiodtype period = icalperiodtype_null_period();
// a null period isn't a valid period assert(icalperiodtype_is_valid_period(period) == 0);
struct icalperiodtype icalperiodtype_null_period | ( | void | ) |
Creates a null period icalperiodtype.
```c // creates null period struct icalperiodtype period = icalperiodtype_null_period();
// verifies start, end and length assert(icaltime_is_null_time(period.start)); assert(icaltime_is_null_time(period.end)); assert(icaldurationtype_is_null_duratino(period.duration));