Libical API Documentation 4.0 UNRELEASED Go to the stable 3.0 documentation
Loading...
Searching...
No Matches
vcardrestriction.h File Reference

Functions to check if a vcardcomponent meets the restrictions imposed by the standard. More...

Go to the source code of this file.

Enumerations

enum  vcardrestriction_kind {
  VCARD_RESTRICTION_NONE = 0 , VCARD_RESTRICTION_ZERO , VCARD_RESTRICTION_ONE , VCARD_RESTRICTION_ZEROPLUS ,
  VCARD_RESTRICTION_ONEPLUS , VCARD_RESTRICTION_ZEROORONE , VCARD_RESTRICTION_ONEEXCLUSIVE , VCARD_RESTRICTION_ONEMUTUAL ,
  VCARD_RESTRICTION_UNKNOWN
}
 The kinds of vcardrestrictions there are. More...

Functions

bool vcardrestriction_check (vcardcomponent *comp)
 Checks if a given VCARD meets all the restrictions imposed by the standard.
int vcardrestriction_compare (vcardrestriction_kind restr, int count)
 Checks if the given count is in accordance with the given restriction, restr.

Detailed Description

Functions to check if a vcardcomponent meets the restrictions imposed by the standard.

Definition in file vcardrestriction.h.

Enumeration Type Documentation

◆ vcardrestriction_kind

The kinds of vcardrestrictions there are.

These must stay in this order for vcardrestriction_compare to work

Enumerator
VCARD_RESTRICTION_NONE 

No restriction.

VCARD_RESTRICTION_ZERO 

Zero.

VCARD_RESTRICTION_ONE 

One.

VCARD_RESTRICTION_ZEROPLUS 

Zero or more.

VCARD_RESTRICTION_ONEPLUS 

One or more.

VCARD_RESTRICTION_ZEROORONE 

Zero or one.

VCARD_RESTRICTION_ONEEXCLUSIVE 

Zero or one, exclusive with another property.

VCARD_RESTRICTION_ONEMUTUAL 

Zero or one, mutual with another property.

VCARD_RESTRICTION_UNKNOWN 

Unknown.

Definition at line 27 of file vcardrestriction.h.

Function Documentation

◆ vcardrestriction_check()

bool vcardrestriction_check ( vcardcomponent * comp)

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

Parameters
compThe VCARD/XROOT component to check
Returns
true if the restrictions are met, false if not
Error handling
Returns false and sets ::vcarderrno if NULL is passed as comp, or if the component is not a VCARD.
Example
vcardcomponent *component = // ...
// check component
assert(vcardrestriction_check(component) == true);
bool vcardrestriction_check(vcardcomponent *comp)
Checks if a given VCARD meets all the restrictions imposed by the standard.

◆ vcardrestriction_compare()

int vcardrestriction_compare ( vcardrestriction_kind restr,
int count )

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

Parameters
restrThe restriction to apply to the count
countThe amount present that is to be checked against the restriction
Returns
1 if the restriction is met, 0 if not
Example
assert(vcardrestriction_compare(VCARDRESTRICTION_ONEPLUS, 5) == true);
assert(vcardrestriction_compare(VCARDRESTRICTION_NONE, 3) == false);
int vcardrestriction_compare(vcardrestriction_kind restr, int count)
Checks if the given count is in accordance with the given restriction, restr.