1#ifndef VOLK_CODEC_BASE_H
2#define VOLK_CODEC_BASE_H
13#ifdef VOLK_RDF_STREAM_CHUNK_SIZE
14#define CHUNK_SIZE VOLK_RDF_STREAM_CHUNK_SIZE
16#define CHUNK_SIZE 4096
27 ENTRY( NT, nt, nt_codec ) \
28 ENTRY( TTL, ttl, ttl_codec ) \
32typedef enum codec_type {
33#define ENTRY(a, b, c) \
38typedef struct codec_t VOLK_Codec;
42typedef struct ttl_parser_state {
43 VOLK_GraphIterator *
it;
73{
return (uint8_t *)
strdup ((
char *) str); }
83{
return (uint8_t *)
strndup ((
char *) str, size); }
105 case '\t':
return 't';
106 case '\b':
return 'b';
107 case '\n':
return 'n';
108 case '\r':
return 'r';
109 case '\f':
return 'f';
131 case 't':
return '\t';
132 case 'b':
return '\b';
133 case 'n':
return '\n';
134 case 'r':
return '\r';
135 case 'f':
return '\f';
216typedef void * (*gr_encode_init_fn_t)(
const VOLK_Graph *gr);
293 FILE *fh,
const char *sh, VOLK_Graph **gr,
size_t *ct,
char **err);
char escape_char(const char c)
void(* gr_encode_done_fn_t)(void *it)
Finalize an encoding operation.
VOLK_rc(* gr_decode_fn_t)(FILE *fh, const char *sh, VOLK_Graph **gr, size_t *ct, char **err)
Prototype for decoding a complete RDF document file into a graph.
VOLK_rc(* gr_encode_iter_fn_t)(void *it, char **res)
Perform one encoding iteration.
VOLK_rc(* term_enc_fn_t)(const VOLK_Term *term, char **rep)
Term encoder callback type.
VOLK_rc(* term_decode_fn_t)(const char *rep, VOLK_Term **term)
Prototype for decoding a string into a VOLK_Term.
void *(* gr_encode_init_fn_t)(const VOLK_Graph *gr)
Initialize a graph encoding loop.
uint8_t * uint8_ndup(const uint8_t *str, size_t size)
strndup() for unsigned char.
char * fmt_header(char *pfx)
Format an informational header.
char unescape_char(const char c)
Unescape a single character.
VOLK_rc escape_lit(const char *in, char **out)
Add escape character (backslash) to illegal literal characters.
uint8_t * uint8_dup(const uint8_t *str)
Parse error information.
uint8_t * unescape_unicode(const uint8_t *esc_str, size_t size)
Replace \uxxxx and \Uxxxxxxxx with Unicode bytes.
VOLK_CodecType
Codec types. All prefixed with VOLK_CODEC_.
char * strdup(const char *src)
Replacement for GNU strdup.
char * strndup(const char *src, size_t max)
Replacement for GNU strndup.
VOLK_GraphIterator * it
Iterator used to build the graph.
VOLK_rc rc
Internal return code.
size_t ct
Statements parsed.
VOLK_Term * base
Base IRI used in the document.
VOLK_Term * lms
Link map subject.
gr_encode_done_fn_t encode_graph_done
Graph encoder finalization.
gr_decode_fn_t decode_graph
Graph decoder function.
char extension[8]
Serialized file extension.
term_decode_fn_t decode_term
Term decoder function.
term_enc_fn_t encode_term
Term encoder function.
gr_encode_init_fn_t encode_graph_init
Graph encoder initialization.
gr_encode_iter_fn_t encode_graph_iter
Graph encoder iteration.
char name[16]
Name of the codec.
char mimetype[32]
MIME type associated with the codec.