本文整理汇总了C++中raptor_free_uri函数的典型用法代码示例。如果您正苦于以下问题:C++ raptor_free_uri函数的具体用法?C++ raptor_free_uri怎么用?C++ raptor_free_uri使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了raptor_free_uri函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: raptor_rss_common_terminate
void
raptor_rss_common_terminate(raptor_world* world) {
int i;
if(--world->rss_common_initialised)
return;
if(world->rss_types_info_uris) {
for(i = 0; i< RAPTOR_RSS_COMMON_SIZE; i++) {
if(world->rss_types_info_uris[i])
raptor_free_uri(world->rss_types_info_uris[i]);
}
RAPTOR_FREE(raptor_uri* array, world->rss_types_info_uris);
world->rss_types_info_uris = NULL;
}
if(world->rss_fields_info_uris) {
for(i = 0; i< RAPTOR_RSS_FIELDS_SIZE; i++) {
if(world->rss_fields_info_uris[i])
raptor_free_uri(world->rss_fields_info_uris[i]);
}
RAPTOR_FREE(raptor_uri* array, world->rss_fields_info_uris);
world->rss_fields_info_uris = NULL;
}
if(world->rss_namespaces_info_uris) {
for(i = 0; i < RAPTOR_RSS_NAMESPACES_SIZE;i++) {
if(world->rss_namespaces_info_uris[i])
raptor_free_uri(world->rss_namespaces_info_uris[i]);
}
RAPTOR_FREE(raptor_uri* array, world->rss_namespaces_info_uris);
world->rss_namespaces_info_uris = NULL;
}
}
示例2: rdf_database_read_file
/*****
** Lee el archivo que contiene las tripletas RDF
** y hace el llamado a la funcion save_triple() para guardarlos
*****/
void rdf_database_read_file(rdf_database db, const char *file)
{
raptor_world *world = NULL;
unsigned char *uri_string;
raptor_uri *uri, *base_uri;
// parser
world = raptor_new_world();
rdf_parser = raptor_new_parser(world, "rdfxml");
// seteo funcion handler para cada nodo
raptor_parser_set_statement_handler(rdf_parser, (void*)db, save_triple);
uri_string = raptor_uri_filename_to_uri_string(file);
uri = raptor_new_uri(world, uri_string);
base_uri = raptor_uri_copy(uri);
// empieza parseo y guardado en memoria
raptor_parser_parse_file(rdf_parser, uri, base_uri);
// liberar ram
raptor_free_parser(rdf_parser);
raptor_free_uri(base_uri);
raptor_free_uri(uri);
raptor_free_memory(uri_string);
raptor_free_world(world);
}
示例3: main
int
main(int argc, char *argv[])
{
#ifdef HAVE_RAPTOR
raptor_world *world = NULL;
raptor_parser* rdf_parser = NULL;
unsigned char *uri_string;
raptor_uri *uri, *base_uri;
world = raptor_new_world();
rdf_parser = raptor_new_parser(world, "ntriples");
raptor_parser_set_statement_handler(rdf_parser, NULL, print_triple);
uri_string = raptor_uri_filename_to_uri_string(argv[1]);
uri = raptor_new_uri(world, uri_string);
base_uri = raptor_uri_copy(uri);
raptor_parser_parse_file(rdf_parser, uri, base_uri);
raptor_free_parser(rdf_parser);
raptor_free_uri(base_uri);
raptor_free_uri(uri);
raptor_free_memory(uri_string);
raptor_free_world(world);
#endif
return EXIT_SUCCESS;
}
示例4: load_nquad_file
DllExport int call_conv load_nquad_file(CTXTdecl)
{
char *filename = p2c_string(reg_term(CTXTdecl 1));
unsigned char *uri_string;
raptor_uri *uri, *base_uri;
world = raptor_new_world();
rdf_parser = raptor_new_parser(world, "nquads");
raptor_parser_set_statement_handler(rdf_parser, NULL, handle_term);
uri_string = raptor_uri_filename_to_uri_string(filename);
uri = raptor_new_uri(world, uri_string);
base_uri = raptor_uri_copy(uri);
raptor_parser_parse_file(rdf_parser, uri, base_uri);
raptor_free_parser(rdf_parser);
raptor_free_uri(base_uri);
raptor_free_uri(uri);
raptor_free_memory(uri_string);
raptor_free_world(world);
return 1;
}
示例5: assert_uri_to_relative
static int
assert_uri_to_relative(const char *base, const char *uri, const char *relative)
{
unsigned char *output;
int result;
raptor_uri* base_uri=NULL;
raptor_uri* reference_uri=raptor_new_uri((const unsigned char*)uri);
size_t length=0;
if(base)
base_uri=raptor_new_uri((const unsigned char*)base);
output=raptor_uri_to_relative_counted_uri_string(base_uri, reference_uri,
&length);
result=strcmp(relative, (const char*)output);
if (result) {
fprintf(stderr,
"%s: raptor_uri_string_to_relative_uri_string FAILED: base='%s', uri='%s', expected='%s', got='%s'\n",
program, base, uri, relative, output);
RAPTOR_FREE(cstring, output);
return 1;
}
RAPTOR_FREE(cstring, output);
raptor_free_uri(base_uri);
raptor_free_uri(reference_uri);
return 0;
}
示例6: raptor_free_www
/**
* raptor_free_www:
* @www: WWW object.
*
* Destructor - destroy a #raptor_www object.
**/
void
raptor_free_www(raptor_www* www)
{
/* free context */
if(www->type) {
if(www->free_type)
RAPTOR_FREE(cstring, www->type);
www->type = NULL;
}
if(www->user_agent) {
RAPTOR_FREE(cstring, www->user_agent);
www->user_agent = NULL;
}
if(www->cache_control) {
RAPTOR_FREE(cstring, www->cache_control);
www->cache_control = NULL;
}
if(www->proxy) {
RAPTOR_FREE(cstring, www->proxy);
www->proxy = NULL;
}
if(www->http_accept) {
RAPTOR_FREE(cstring, www->http_accept);
www->http_accept = NULL;
}
#ifdef RAPTOR_WWW_LIBCURL
raptor_www_curl_free(www);
#endif
#ifdef RAPTOR_WWW_LIBXML
raptor_www_libxml_free(www);
#endif
#ifdef RAPTOR_WWW_LIBFETCH
raptor_www_libfetch_free(www);
#endif
if(www->uri)
raptor_free_uri(www->uri);
if(www->final_uri)
raptor_free_uri(www->final_uri);
RAPTOR_FREE(www, www);
}
示例7: raptor_free_term
/**
* raptor_free_term:
* @term: #raptor_term object
*
* Destructor - destroy a raptor_term object.
*
**/
void
raptor_free_term(raptor_term *term)
{
if(!term)
return;
if(--term->usage)
return;
switch(term->type) {
case RAPTOR_TERM_TYPE_URI:
if(term->value.uri) {
raptor_free_uri(term->value.uri);
term->value.uri = NULL;
}
break;
case RAPTOR_TERM_TYPE_BLANK:
if(term->value.blank.string) {
RAPTOR_FREE(cstring, (void*)term->value.blank.string);
term->value.blank.string = NULL;
}
break;
case RAPTOR_TERM_TYPE_LITERAL:
if(term->value.literal.string) {
RAPTOR_FREE(cstring, (void*)term->value.literal.string);
term->value.literal.string = NULL;
}
if(term->value.literal.datatype) {
raptor_free_uri(term->value.literal.datatype);
term->value.literal.datatype = NULL;
}
if(term->value.literal.language) {
RAPTOR_FREE(cstring, (void*)term->value.literal.language);
term->value.literal.language = NULL;
}
break;
case RAPTOR_TERM_TYPE_UNKNOWN:
default:
break;
}
RAPTOR_FREE(term, (void*)term);
}
示例8: raptor_free_sax2
/**
* raptor_free_sax2:
* @sax2: SAX2 object
*
* Destructor - destroy a SAX2 object
*/
void
raptor_free_sax2(raptor_sax2 *sax2)
{
raptor_xml_element *xml_element;
if(!sax2)
return;
#ifdef RAPTOR_XML_LIBXML
if(sax2->xc) {
raptor_libxml_free(sax2->xc);
sax2->xc = NULL;
}
#endif
while( (xml_element = raptor_xml_element_pop(sax2)) )
raptor_free_xml_element(xml_element);
raptor_namespaces_clear(&sax2->namespaces);
if(sax2->base_uri)
raptor_free_uri(sax2->base_uri);
raptor_object_options_clear(&sax2->options);
RAPTOR_FREE(raptor_sax2, sax2);
}
示例9: main
int main(int argc, char *argv[]) {
fsp_link *link;
fs_query_state *qs;
fs_query *qr;
raptor_uri *bu;
int i;
#ifdef LINUX
mtrace();
#endif
link = fsp_open_link("ukgov_finances_cra", NULL, FS_OPEN_HINT_RW);
raptor_init();
fs_hash_init(fsp_hash_type(link));
bu = raptor_new_uri((unsigned char *)"local:");
fsp_no_op(link, 0);
qs = fs_query_init(link);
for (i=0;i<atoi(argv[1]);i++) {
//printf("--------- %d ----------\n", i);
qr = fs_query_execute(qs, link, bu, QUERY, 0, 3, 0);
fs_query_free(qr);
fs_query_cache_flush(qs, 0);
}
fs_query_fini(qs);
raptor_free_uri(bu);
raptor_finish();
fsp_close_link(link);
#ifdef LINUX
muntrace();
#endif
}
示例10: raptor_serializer_start_to_string
/**
* raptor_serializer_start_to_string:
* @rdf_serializer: the #raptor_serializer
* @uri: base URI or NULL if no base URI is required
* @string_p: pointer to location to hold string
* @length_p: pointer to location to hold length of string (or NULL)
*
* Start serializing to a string.
*
* Return value: non-0 on failure.
**/
int
raptor_serializer_start_to_string(raptor_serializer *rdf_serializer,
raptor_uri *uri,
void **string_p, size_t *length_p)
{
if(rdf_serializer->base_uri)
raptor_free_uri(rdf_serializer->base_uri);
if(uri)
rdf_serializer->base_uri = raptor_uri_copy(uri);
else
rdf_serializer->base_uri = NULL;
rdf_serializer->locator.uri = rdf_serializer->base_uri;
rdf_serializer->locator.line = rdf_serializer->locator.column = 0;
rdf_serializer->iostream = raptor_new_iostream_to_string(rdf_serializer->world,
string_p, length_p,
NULL);
if(!rdf_serializer->iostream)
return 1;
rdf_serializer->free_iostream_on_end = 1;
if(rdf_serializer->factory->serialize_start)
return rdf_serializer->factory->serialize_start(rdf_serializer);
return 0;
}
示例11: raptor_free_xml_element
/**
* raptor_free_xml_element:
* @element: XML Element
*
* Destructor - destroy a raptor_xml_element object.
**/
void
raptor_free_xml_element(raptor_xml_element *element)
{
unsigned int i;
if(!element)
return;
for(i = 0; i < element->attribute_count; i++)
if(element->attributes[i])
raptor_free_qname(element->attributes[i]);
if(element->attributes)
RAPTOR_FREE(raptor_qname_array, element->attributes);
if(element->content_cdata_sb)
raptor_free_stringbuffer(element->content_cdata_sb);
if(element->base_uri)
raptor_free_uri(element->base_uri);
if(element->xml_language)
RAPTOR_FREE(char*, element->xml_language);
raptor_free_qname(element->name);
if(element->declared_nspaces)
raptor_free_sequence(element->declared_nspaces);
RAPTOR_FREE(raptor_element, element);
}
示例12: raptor_serializer_start_to_filename
/**
* raptor_serializer_start_to_filename:
* @rdf_serializer: the #raptor_serializer
* @filename: filename to serialize to
*
* Start serializing to a filename.
*
* Return value: non-0 on failure.
**/
int
raptor_serializer_start_to_filename(raptor_serializer *rdf_serializer,
const char *filename)
{
unsigned char *uri_string = raptor_uri_filename_to_uri_string(filename);
if(!uri_string)
return 1;
if(rdf_serializer->base_uri)
raptor_free_uri(rdf_serializer->base_uri);
rdf_serializer->base_uri = raptor_new_uri(rdf_serializer->world, uri_string);
rdf_serializer->locator.uri = rdf_serializer->base_uri;
rdf_serializer->locator.line = rdf_serializer->locator.column = 0;
RAPTOR_FREE(char*, uri_string);
rdf_serializer->iostream = raptor_new_iostream_to_filename(rdf_serializer->world,
filename);
if(!rdf_serializer->iostream)
return 1;
rdf_serializer->free_iostream_on_end = 1;
if(rdf_serializer->factory->serialize_start)
return rdf_serializer->factory->serialize_start(rdf_serializer);
return 0;
}
示例13: raptor_rss_model_clear
void
raptor_rss_model_clear(raptor_rss_model* rss_model)
{
int i;
raptor_rss_item* item;
for(i = 0; i< RAPTOR_RSS_COMMON_SIZE; i++) {
item = rss_model->common[i];
while(item) {
raptor_rss_item *next = item->next;
raptor_free_rss_item(item);
item = next;
}
}
item = rss_model->items;
while(item) {
raptor_rss_item *next = item->next;
raptor_free_rss_item(item);
item = next;
}
rss_model->last = rss_model->items = NULL;
for(i = 0; i< RAPTOR_RSS_N_CONCEPTS; i++) {
raptor_uri* concept_uri = rss_model->concepts[i];
if(concept_uri) {
raptor_free_uri(concept_uri);
rss_model->concepts[i] = NULL;
}
}
}
示例14: raptor_serializer_start_to_iostream
/**
* raptor_serializer_start_to_iostream:
* @rdf_serializer: the #raptor_serializer
* @uri: base URI or NULL if no base URI is required
* @iostream: #raptor_iostream to write serialization to
*
* Start serialization to an iostream with given base URI
*
* The passed in @iostream does not become owned by the serializer
* and can be used by the caller after serializing is done. It
* must be destroyed by the caller.
*
* Return value: non-0 on failure.
**/
int
raptor_serializer_start_to_iostream(raptor_serializer *rdf_serializer,
raptor_uri *uri, raptor_iostream *iostream)
{
if(rdf_serializer->base_uri)
raptor_free_uri(rdf_serializer->base_uri);
if(!iostream)
return 1;
if(uri)
uri = raptor_uri_copy(uri);
rdf_serializer->base_uri = uri;
rdf_serializer->locator.uri = uri;
rdf_serializer->locator.line = rdf_serializer->locator.column = 0;
rdf_serializer->iostream = iostream;
rdf_serializer->free_iostream_on_end = 0;
if(rdf_serializer->factory->serialize_start)
return rdf_serializer->factory->serialize_start(rdf_serializer);
return 0;
}
示例15: ser_emit_triple
static void
ser_emit_triple(void* user_data,
const char* subject, int subject_type,
const char* predicate_nspace, const char* predicate_name,
const char *object, int object_type,
const char *datatype_uri)
{
raptor_serializer* serializer = (raptor_serializer*)user_data;
raptor_statement s; /* static */
raptor_uri* predicate_ns_uri;
raptor_uri* predicate_uri;
raptor_statement_init(&s, rworld);
if(subject_type == FLICKCURL_TERM_TYPE_RESOURCE)
s.subject = raptor_new_term_from_uri_string(rworld, (const unsigned char*)subject);
else /* blank node */
s.subject = raptor_new_term_from_blank(rworld, (const unsigned char*)subject);
predicate_ns_uri = raptor_new_uri(rworld, (const unsigned char*)predicate_nspace);
predicate_uri = raptor_new_uri_from_uri_local_name(rworld, predicate_ns_uri,
(const unsigned char*)predicate_name);
s.predicate = raptor_new_term_from_uri(rworld, predicate_uri);
raptor_free_uri(predicate_uri);
raptor_free_uri(predicate_ns_uri);
if(object_type == FLICKCURL_TERM_TYPE_RESOURCE)
s.object = (void*)raptor_new_term_from_uri_string(rworld, (const unsigned char*)object);
else if(object_type == FLICKCURL_TERM_TYPE_BLANK)
s.object = raptor_new_term_from_blank(rworld, (const unsigned char*)subject);
else {
/* literal */
raptor_uri* raptor_datatype_uri = NULL;
if(datatype_uri)
raptor_datatype_uri = raptor_new_uri(rworld, (const unsigned char*)datatype_uri);
s.object = raptor_new_term_from_literal(rworld, (const unsigned char*)object, raptor_datatype_uri, NULL /* language */);
raptor_free_uri(raptor_datatype_uri);
}
raptor_serializer_serialize_statement(serializer, &s);
raptor_statement_clear(&s);
}