Libical API Documentation 4.0 UNRELEASED Go to the stable 3.0 documentation
Loading...
Searching...
No Matches
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)
#define IS_CTRL(ch)
#define MAKE(X, Y)
#define NOTESTART()
#define PUTC(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.

Detailed Description

Line-oriented parsing vCard format.

Definition in file vcardparser.c.

Macro Definition Documentation

◆ BUF_GROW

#define BUF_GROW   128

Definition at line 95 of file vcardparser.c.

◆ BUF_INITIALIZER

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

Definition at line 66 of file vcardparser.c.

◆ DEBUG

#define DEBUG   0

Definition at line 33 of file vcardparser.c.

◆ HANDLECTRL

#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.

◆ INC

#define INC ( I)
Value:
state->p += I

Definition at line 192 of file vcardparser.c.

◆ IS_CTRL

#define IS_CTRL ( ch)
Value:
((ch) > 0 && (ch) <= 0x1f && (ch) != '\r' && (ch) != '\n' && (ch) != '\t')

Definition at line 193 of file vcardparser.c.

◆ MAKE

#define MAKE ( X,
Y )
Value:
X = icalmemory_new_buffer(sizeof(struct Y))
void * icalmemory_new_buffer(size_t size)
Creates new buffer with the specified size.
Definition icalmemory.c:313

Definition at line 190 of file vcardparser.c.

◆ NOTESTART

#define NOTESTART ( )
Value:
state->itemstart = state->p

Definition at line 189 of file vcardparser.c.

◆ PUTC

#define PUTC ( C)
Value:
buf_putc(&state->buf, C)

Definition at line 191 of file vcardparser.c.

Enumeration Type Documentation

◆ parse_error

enum parse_error

Definition at line 38 of file vcardparser.c.

Function Documentation

◆ buf_init()

void buf_init ( struct buf * buf,
size_t size )

Definition at line 97 of file vcardparser.c.

◆ vcardparser_errstr()

const char * vcardparser_errstr ( int err)

Definition at line 960 of file vcardparser.c.

◆ vcardparser_parse_string()

vcardcomponent * vcardparser_parse_string ( const char * str)

Definition at line 1003 of file vcardparser.c.

◆ vcardparser_set_xprop_value_kind()

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 1030 of file vcardparser.c.