libcsem  0.2
csem_micro_stream.h File Reference
#include "csem_list.h"
#include "csem_url.h"

Go to the source code of this file.

Defines

#define CSEM_NS_C_BEGIN
#define CSEM_NS_C_END

Typedefs

typedef typedefCSEM_NS_C_BEGIN
struct CSEM_Micro_Handlers 
CSEM_Micro_Handlers
 Handlers for HTML5 microdata streaming parser.
typedef CSEM_Bool(* CSEM_Micro_ItemStart )(const void *userdata, const CSEM_Url *id, const CSEM_List *types, const CSEM_List *refs)
 Handler for start scope of an item.
typedef void(* CSEM_Micro_ItemEnd )(const void *userdata)
 Handler for end scope of an item.
typedef CSEM_Bool(* CSEM_Micro_PropStart )(const void *userdata, const char *propName, CSEM_Bool hasUrlValue)
 Handler for start scope of a property.
typedef void(* CSEM_Micro_PropValue )(const void *userdata, const char *value, int len)
 Handler for property value.
typedef void(* CSEM_Micro_PropEnd )(const void *userdata)
 Handler for end scope of a property.
typedef CSEM_Bool(* CSEM_Micro_IdStart )(const void *userdata, const char *id)
 Handler for start scope of an id referenced by @itemref.
typedef void(* CSEM_Micro_IdEnd )(const void *userdata)
 Handler for end scope of an id.

Functions

CSEM_Error CSEM_Micro_CreateHandler (CSEM_Micro_Handlers **handler)
 Create a handler manager for microdata.
void CSEM_Micro_DisposeHandler (CSEM_Micro_Handlers *handler)
 Dispose a handler manager.
void CSEM_Micro_SetItemStart (CSEM_Micro_Handlers *handler, CSEM_Micro_ItemStart startScope)
 Set item start handler to the handler manager.
void CSEM_Micro_SetItemEnd (CSEM_Micro_Handlers *handler, CSEM_Micro_ItemEnd endScope)
 Set item end handler to the handler manager.
void CSEM_Micro_SetPropStart (CSEM_Micro_Handlers *handler, CSEM_Micro_PropStart startProp)
 Set property start handler to the handler manager.
void CSEM_Micro_SetPropValue (CSEM_Micro_Handlers *handler, CSEM_Micro_PropValue propValue)
 Set property value handler to the handler manager.
void CSEM_Micro_SetPropEnd (CSEM_Micro_Handlers *handler, CSEM_Micro_PropEnd endProp)
 Set property end handler to the handler manager.
void CSEM_Micro_SetIdStart (CSEM_Micro_Handlers *handler, CSEM_Micro_IdStart startId)
 Set id start handler to the handler manager.
void CSEM_Micro_SetIdEnd (CSEM_Micro_Handlers *handler, CSEM_Micro_IdEnd endId)
 Set id end handler to the handler manager.

Define Documentation

#define CSEM_NS_C_BEGIN
#define CSEM_NS_C_END

Typedef Documentation

typedef typedefCSEM_NS_C_BEGIN struct CSEM_Micro_Handlers CSEM_Micro_Handlers

Handlers for HTML5 microdata streaming parser.

typedef void(* CSEM_Micro_IdEnd)(const void *userdata)

Handler for end scope of an id.

Parameters:
userdata[out]user data
typedef CSEM_Bool(* CSEM_Micro_IdStart)(const void *userdata, const char *id)

Handler for start scope of an id referenced by @itemref.

Parameters:
userdata[out]user data
id[out]id
Returns:
CSEM_TRUE if the passed microdata on this event should be freed by library. If applications would like to keep the passed microdata for further processing, return CSEM_FALSE.
typedef void(* CSEM_Micro_ItemEnd)(const void *userdata)

Handler for end scope of an item.

Parameters:
userdata[out]user data
typedef CSEM_Bool(* CSEM_Micro_ItemStart)(const void *userdata, const CSEM_Url *id, const CSEM_List *types, const CSEM_List *refs)

Handler for start scope of an item.

Parameters:
userdata[out]user data
id[out]item id
types[out]types of the item
refs[out]references of the item
Returns:
CSEM_TRUE if the passed microdata on this event should be freed by library. If applications would like to keep it for further processing, return CSEM_FALSE.
typedef void(* CSEM_Micro_PropEnd)(const void *userdata)

Handler for end scope of a property.

Parameters:
userdata[out]user data
typedef CSEM_Bool(* CSEM_Micro_PropStart)(const void *userdata, const char *propName, CSEM_Bool hasUrlValue)

Handler for start scope of a property.

Parameters:
userdata[out]user data
propName[out]the property name TODO : support space separated names
hasUrlValue[out]CSEM_TRUE if the value type of the property is URL.
Returns:
CSEM_TRUE if the passed microdata on this event should be freed by library. If applications would like to keep the passed it for further processing, return CSEM_FALSE.
typedef void(* CSEM_Micro_PropValue)(const void *userdata, const char *value, int len)

Handler for property value.

The values may be divided into pieces with multiple call back.

Parameters:
userdata[out]user data
value[out]property value
len[out]length of the value

Function Documentation

Create a handler manager for microdata.

Parameters:
handler[out]created handler manager
Returns:
error code
Examples:
sample_micro_stream.c.

Dispose a handler manager.

Parameters:
handler[in]handler manager to be freed
void CSEM_Micro_SetIdEnd ( CSEM_Micro_Handlers handler,
CSEM_Micro_IdEnd  endId 
)

Set id end handler to the handler manager.

Parameters:
handler[in]handler manager
endId[in]id end handler
Examples:
sample_micro_stream.c.

Set id start handler to the handler manager.

Parameters:
handler[in]handler manager
startId[in]id start handler
Examples:
sample_micro_stream.c.
void CSEM_Micro_SetItemEnd ( CSEM_Micro_Handlers handler,
CSEM_Micro_ItemEnd  endScope 
)

Set item end handler to the handler manager.

Parameters:
handler[in]handler manager
endScope[in]item end handler
Examples:
sample_micro_stream.c.

Set item start handler to the handler manager.

Parameters:
handler[in]handler manager
startScope[in]item start handler
Examples:
sample_micro_stream.c.

Set property end handler to the handler manager.

Parameters:
handler[in]handler manager
endProp[in]property end handler
Examples:
sample_micro_stream.c.

Set property start handler to the handler manager.

Parameters:
handler[in]handler manager
startProp[in]property start handler
Examples:
sample_micro_stream.c.

Set property value handler to the handler manager.

Parameters:
handler[in]handler manager
propValue[in]property value handler
Examples:
sample_micro_stream.c.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines