$darkmode
Libical API Documentation 4.0 STABLE VERSION Visit the v3.0 documentation
vcardparser.c File Reference

Line-oriented parsing vCard format. More...

Go to the source code of this file.

Macros

#define BUF_GROW   128
 
#define BUF_INITIALIZER
 
#define DEBUG   0
 
#define HANDLECTRL(state)
 
#define INC(I)   state->p += I
 
#define IS_CTRL(ch)   ((ch) > 0 && (ch) <= 0x1f && (ch) != '\r' && (ch) != '\n' && (ch) != '\t')
 
#define MAKE(X, Y)   X = icalmemory_new_buffer(sizeof(struct Y))
 
#define NOTESTART()   state->itemstart = state->p
 
#define PUTC(C)   buf_putc(&state->buf, C)
 

Enumerations

enum  parse_error {
  PE_OK = 0, PE_BACKQUOTE_EOF, PE_BEGIN_PARAMS, PE_PROP_MULTIGROUP,
  PE_FINISHED_EARLY, PE_KEY_EOF, PE_KEY_EOL, PE_MISMATCHED_CARD,
  PE_NAME_EOF, PE_NAME_EOL, PE_NAME_INVALID, PE_PARAMVALUE_EOF,
  PE_PARAMVALUE_EOL, PE_QSTRING_EOF, PE_QSTRING_EOL, PE_QSTRING_EOV,
  PE_VALUE_INVALID, PE_ILLEGAL_CHAR, PE_NUMERR
}
 

Functions

void buf_init (struct buf *buf, size_t size)
 
const char * vcardparser_errstr (int err)
 
vcardcomponent * vcardparser_parse_string (const char *str)
 
void vcardparser_set_xprop_value_kind (vcard_xprop_value_kind_func func, void *data)
 Registers a parser callback to override the default value type of an x-property. More...
 

Detailed Description

Line-oriented parsing vCard format.

Definition in file vcardparser.c.

Macro Definition Documentation

#define BUF_INITIALIZER
Value:
{ \
NULL, 0, 0}

Definition at line 66 of file vcardparser.c.

#define HANDLECTRL (   state)
Value:
{ \
if (IS_CTRL(*(state)->p)) { \
while (IS_CTRL(*(state)->p)) \
(state)->p++; \
} \
if ((*(state)->p) == 0) \
break; \
}

Definition at line 195 of file vcardparser.c.

Function Documentation

void vcardparser_set_xprop_value_kind ( vcard_xprop_value_kind_func  func,
void *  data 
)

Registers a parser callback to override the default value type of an x-property.

Extended properties ("x-properties") in vCard do not have a default value type. Instead, they are parsed as unknown values and preserved verbatim. This function allows to register a callback to define the default value type for some x-property. Any VALUE parameter set on the property overrides the default value.

Parameters
funcThe function pointer to the callback. Use NULL to disable a previously registered callback.
dataSome callback-specific data. Can be NULL.

For example, the callback might return VCARD_TEXT_VALUE when parsing an x-property named "X-ABLabel".

This function is not reentrant. Depending on libical is built, the callback either is registered as a process-global or thread-local variable.

Definition at line 1035 of file vcardparser.c.