Libical API Documentation 3.0

Typedefs | Enumerations | Functions
icalrestriction.h File Reference

Functions to check if an ::icalcomponent meets the restrictions imposed by the standard. More...

Go to the source code of this file.

## Typedefs
typedef enum icalrestriction_kind | icalrestriction_kind
| The kinds of icalrestrictions there are. More...

## Enumerations
enum | icalrestriction_kind { ICAL_RESTRICTION_NONE = 0 , ICAL_RESTRICTION_ZERO , ICAL_RESTRICTION_ONE , ICAL_RESTRICTION_ZEROPLUS , ICAL_RESTRICTION_ONEPLUS , ICAL_RESTRICTION_ZEROORONE , ICAL_RESTRICTION_ONEEXCLUSIVE , ICAL_RESTRICTION_ONEMUTUAL , ICAL_RESTRICTION_UNKNOWN }
| The kinds of icalrestrictions there are. More...

## Functions
int | icalrestriction_check (icalcomponent *comp)
| Checks if a given `VCALENDAR` meets all the restrictions imposed by the standard. More...
int | icalrestriction_compare (icalrestriction_kind restr, int count)
| Checks if the given count is in accordance with the given restriction, restr. More...

## Detailed Description

Functions to check if an ::icalcomponent meets the restrictions imposed by the standard.

## Typedef Documentation

## ◆ icalrestriction_kind

typedef enum icalrestriction_kind icalrestriction_kind

The kinds of icalrestrictions there are.

These must stay in this order for icalrestriction_compare to work

## Enumeration Type Documentation

## ◆ icalrestriction_kind

enum icalrestriction_kind

The kinds of icalrestrictions there are.

These must stay in this order for icalrestriction_compare to work

Enumerator
ICAL_RESTRICTION_NONE | No restriction.
ICAL_RESTRICTION_ZERO | Zero.
ICAL_RESTRICTION_ONE | One.
ICAL_RESTRICTION_ZEROPLUS | Zero or more.
ICAL_RESTRICTION_ONEPLUS | One or more.
ICAL_RESTRICTION_ZEROORONE | Zero or one.
ICAL_RESTRICTION_ONEEXCLUSIVE | Zero or one, exclusive with another property.
ICAL_RESTRICTION_ONEMUTUAL | Zero or one, mutual with another property.
ICAL_RESTRICTION_UNKNOWN | Unknown.

## Function Documentation

## ◆ icalrestriction_check()

int icalrestriction_check | ( | icalcomponent * | comp | ) |

Checks if a given `VCALENDAR` meets all the restrictions imposed by the standard.

Parameters

  comp | The `VCALENDAR` component to check

Returns
  1 if the restrictions are met, 0 if not

Error handling
  Returns 0 and sets icalerrno if `NULL` is passed as comp, or if the component is not a `VCALENDAR`.

### Example

icalcomponent *component = // ...
// check component
assert(icalrestriction_check(component) == true);
icalrestriction_check
int icalrestriction_check(icalcomponent *comp)
Checks if a given VCALENDAR meets all the restrictions imposed by the standard.
icalcomponent_impl
Definition: icalcomponent.c:36

## ◆ icalrestriction_compare()

int icalrestriction_compare | ( | icalrestriction_kind | restr,
|  | int | count
| ) |  |

Checks if the given count is in accordance with the given restriction, restr.

Parameters

  restr | The restriction to apply to the count
  count | The amount present that is to be checked against the restriction

Returns
  1 if the restriction is met, 0 if not

### Example

assert(icalrestriction_compare(ICALRESTRICTION_ONEPLUS, 5) == true);
assert(icalrestriction_compare(ICALRESTRICTION_NONE, 3) == false);
icalrestriction_compare
int icalrestriction_compare(icalrestriction_kind restr, int count)
Checks if the given count is in accordance with the given restriction, restr.