• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ raptor_free_iostream函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中raptor_free_iostream函数的典型用法代码示例。如果您正苦于以下问题:C++ raptor_free_iostream函数的具体用法?C++ raptor_free_iostream怎么用?C++ raptor_free_iostream使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了raptor_free_iostream函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: test_write_to_string

static int
test_write_to_string(raptor_world *world,
                     const char* test_string, size_t test_string_len,
                     const unsigned int expected_bytes_count)
{
  raptor_iostream *iostr = NULL;
  unsigned long count;
  int rc = 0;
  void *string = NULL;
  size_t string_len;
  const char* const label="write iostream to a string";

  
#if defined(RAPTOR_DEBUG) && RAPTOR_DEBUG > 1
  fprintf(stderr, "%s: Testing %s\n", program, label);
#endif

  iostr = raptor_new_iostream_to_string(world, &string, &string_len, NULL);
  if(!iostr) {
    fprintf(stderr, "%s: Failed to create write iostream to string\n",
            program);
    rc = 1;
    goto tidy;
  }

  raptor_iostream_write_bytes(test_string, 1, test_string_len, iostr);
  raptor_iostream_write_byte('\n', iostr);
  
  count = raptor_iostream_tell(iostr);
  if(count != expected_bytes_count) {
    fprintf(stderr, "%s: %s wrote %d bytes, expected %d\n", program, label,
            (int)count, expected_bytes_count);
    rc = 1;
  }

  raptor_free_iostream(iostr); iostr = NULL;

  if(!string) {
    fprintf(stderr, "%s: %s failed to create a string\n", program, label);
    return 1;
  }
  if(string_len != count) {
    fprintf(stderr, "%s: %s created a string length %d, expected %d\n",
            program, label, (int)string_len, (int)count);
    return 1;
  }

  tidy:
  if(string)
    raptor_free_memory(string);
  if(iostr)
    raptor_free_iostream(iostr);
  
  if(rc)
    fprintf(stderr, "%s: FAILED Testing %s\n", program, label);
    
  return rc;
}
开发者ID:bbcarchdev,项目名称:deb-raptor2,代码行数:58,代码来源:raptor_iostream.c


示例2: librdf_stream_print

/**
 * librdf_stream_print:
 * @stream: the stream object
 * @fh: the FILE stream to print to
 *
 * Print the stream.
 *
 * This prints the remaining statements of the stream to the given
 * file handle.  Note that after this method is called the stream
 * will be empty so that librdf_stream_end() will always be true
 * and librdf_stream_next() will always return NULL.  The only
 * useful operation is to dispose of the stream with the
 * librdf_free_stream() destructor.
 * 
 * This method is for debugging and the format of the output should
 * not be relied on.
 *
 * @Deprecated: Use librdf_stream_write() to write to
 * #raptor_iostream which can be made to write to a string.  Use a
 * #librdf_serializer to write proper syntax formats.
 *
 **/
void
librdf_stream_print(librdf_stream *stream, FILE *fh)
{
  raptor_iostream *iostr;

  if(!stream)
    return;

  iostr = raptor_new_iostream_to_file_handle(stream->world->raptor_world_ptr, fh);
  if(!iostr)
    return;
  
  while(!librdf_stream_end(stream)) {
    librdf_statement* statement = librdf_stream_get_object(stream);
    librdf_node* context_node = librdf_stream_get_context2(stream);
    if(!statement)
      break;

    fputs("  ", fh);
    librdf_statement_write(statement, iostr);
    if(context_node) {
      fputs(" with context ", fh);
      librdf_node_print(context_node, fh);
    }
    fputs("\n", fh);

    librdf_stream_next(stream);
  }

  raptor_free_iostream(iostr);
}
开发者ID:herc,项目名称:librdf,代码行数:53,代码来源:rdf_stream.c


示例3: roqet_print_query

static
void roqet_print_query(rasqal_query* rq,
                       raptor_world* raptor_world_ptr,
                       query_output_format output_format,
                       raptor_uri* base_uri)
{
    fprintf(stderr, "Query:\n");

    switch(output_format) {
    case QUERY_OUTPUT_DEBUG:
        rasqal_query_print(rq, stdout);
        break;

    case QUERY_OUTPUT_STRUCTURE:
        roqet_query_walk(rq, stdout, 0);
        break;

    case QUERY_OUTPUT_SPARQL:
        if(1) {
            raptor_iostream* output_iostr;
            output_iostr = raptor_new_iostream_to_file_handle(raptor_world_ptr,
                           stdout);
            rasqal_query_write(output_iostr, rq, NULL, base_uri);
            raptor_free_iostream(output_iostr);
        }
        break;

    case QUERY_OUTPUT_UNKNOWN:
    default:
        fprintf(stderr, "%s: Unknown query output format %d\n", program,
                output_format);
        abort();
    }
}
开发者ID:sengels,项目名称:rasqal,代码行数:34,代码来源:roqet.c


示例4: test_read_from_filename

static int
test_read_from_filename(const char* filename, 
                        const char* test_string, size_t test_string_len,
                        const unsigned int expected_len,
                        const unsigned int expected_len2)
{
  raptor_iostream *iostr=NULL;
  char buffer[READ_BUFFER_SIZE];
  unsigned long count;
  int rc=0;
  const char* const label="read iostream from filename";

#ifdef RAPTOR_DEBUG
  fprintf(stderr, "%s: Testing %s '%s'\n", program, label, filename);
#endif

  iostr=raptor_new_iostream_from_filename(filename);
  if(!iostr) {
    fprintf(stderr, "%s: Failed to create %s '%s'\n", program, label, filename);
    rc=1;
    goto tidy;
  }
  
  count=raptor_iostream_read_bytes(iostr, buffer, 1, test_string_len);
  if(count != expected_len) {
    fprintf(stderr, "%s: %s read %d bytes, expected %d\n", program, label,
            (int)count, (int)expected_len);
    rc=1;
    goto tidy;
  }

  count=raptor_iostream_read_bytes(iostr, buffer, 1, test_string_len);
  if(count != expected_len2) {
    fprintf(stderr, "%s: %s read %d bytes, expected %d\n", program, label,
            (int)count, (int)expected_len2);
    rc=1;
    goto tidy;
  }

  if(!raptor_iostream_read_eof(iostr)) {
    fprintf(stderr, "%s: %s not EOF as expected\n", program, label);
    rc=1;
    goto tidy;
  }

  if(strncmp(buffer, test_string, test_string_len)) {
    fprintf(stderr, "%s: %s returned '%s' expected '%s'\n", program, label,
            buffer, test_string);
    rc=1;
  }

  tidy:
  if(iostr)
    raptor_free_iostream(iostr);

  if(rc)
    fprintf(stderr, "%s: FAILED Testing %s\n", program, label);
    
  return rc;
}
开发者ID:Kirushanr,项目名称:audacity,代码行数:60,代码来源:raptor_iostream.c


示例5: raptor_term_to_counted_string

/**
 * raptor_term_to_counted_string:
 * @term: #raptor_term
 * @len_p: Pointer to location to store length of new string (if not NULL)
 *
 * Turns part of raptor term into a N-Triples format counted string.
 * 
 * Turns the given @term into an N-Triples escaped string using all the
 * escapes as defined in http://www.w3.org/TR/rdf-testcases/#ntriples
 *
 * This function uses raptor_term_ntriples_write() to write to an
 * #raptor_iostream which is the prefered way to write formatted
 * output.
 *
 * Return value: the new string or NULL on failure.  The length of
 * the new string is returned in *@len_p if len_p is not NULL.
 **/
unsigned char*
raptor_term_to_counted_string(raptor_term *term, size_t* len_p)
{
  raptor_iostream *iostr;
  void *string = NULL;
  int rc;

  RAPTOR_ASSERT_OBJECT_POINTER_RETURN_VALUE(term, raptor_term, NULL);
  
  iostr = raptor_new_iostream_to_string(term->world, 
                                        &string, len_p, NULL);
  if(!iostr)
    return NULL;
  rc = raptor_term_ntriples_write(term, iostr);
  raptor_free_iostream(iostr);
  
  if(rc) {
    if(string) {
      RAPTOR_FREE(cstring, string);
      string = NULL;
    }
  }

  return (unsigned char *)string;
}
开发者ID:nevali,项目名称:raptor,代码行数:42,代码来源:raptor_term.c


示例6: raptor_new_iostream_to_filename

/**
 * raptor_new_iostream_to_filename:
 * @filename: Output filename to open and write to
 *
 * Constructor - create a new iostream writing to a filename.
 * 
 * Return value: new #raptor_iostream object or NULL on failure
 **/
raptor_iostream*
raptor_new_iostream_to_filename(const char *filename)
{
  FILE *handle;
  raptor_iostream* iostr;
  const raptor_iostream_handler2* handler2=&raptor_iostream_write_filename_handler;
  const unsigned int mode=RAPTOR_IOSTREAM_MODE_WRITE;
  
  if(!raptor_iostream_check_handler(handler2, mode))
    return NULL;

  handle=fopen(filename, "wb");
  if(!handle)
    return NULL;
  
  iostr=(raptor_iostream*)RAPTOR_CALLOC(raptor_iostream, 1, sizeof(raptor_iostream));
  if(!iostr) {
    fclose(handle);
    return NULL;
  }

  iostr->handler=handler2;
  iostr->user_data=(void*)handle;
  iostr->mode=mode;

  if(iostr->handler->init && 
     iostr->handler->init(iostr->user_data)) {
    raptor_free_iostream(iostr);
    return NULL;
  }
  return iostr;
}
开发者ID:Kirushanr,项目名称:audacity,代码行数:40,代码来源:raptor_iostream.c


示例7: raptor_uri_to_turtle_counted_string

/**
 * raptor_uri_to_turtle_counted_string:
 * @world: world
 * @uri: uri
 * @nstack: namespace stack
 * @base_uri: base URI
 * @len_p: Pointer to location to store length of new string (if not NULL)
 *
 * Convert #raptor_uri to a string.
 * Caller has responsibility to free the string.
 *
 * Note: This creates and destroys several internal objects for each
 * call so for more efficient writing, create a turtle serializer.
 *
 * Return value: the new string or NULL on failure.  The length of
 * the new string is returned in *@len_p if len_p is not NULL.
 */
unsigned char*
raptor_uri_to_turtle_counted_string(raptor_world *world,
                                    raptor_uri* uri, 
                                    raptor_namespace_stack *nstack,
                                    raptor_uri *base_uri,
                                    size_t *len_p)
{
  int rc = 1;
  raptor_iostream* iostr;
  unsigned char *s = NULL;
  raptor_turtle_writer* turtle_writer;

  iostr = raptor_new_iostream_to_string(world,
                                        (void**)&s, len_p, malloc);
  if(!iostr)
    return NULL;
  
  turtle_writer = raptor_new_turtle_writer(world, base_uri, 0, nstack, iostr);
  if(!turtle_writer)
    goto tidy;

  rc = raptor_turtle_writer_uri(turtle_writer, uri);

  raptor_free_turtle_writer(turtle_writer);

  tidy:
  raptor_free_iostream(iostr);

  if(rc) {
    free(s);
    s = NULL;
  }
  
  return s;
}
开发者ID:dr0i,项目名称:raptor,代码行数:52,代码来源:raptor_serialize_turtle.c


示例8: rasqal_rowsource_print

/**
 * rasqal_rowsource_print:
 * @rs: the #rasqal_rowsource object
 * @fh: the FILE* handle to print to
 *
 * Print a #rasqal_rowsource in a debug format.
 *
 * The print debug format may change in any release.
 *
 **/
void
rasqal_rowsource_print(rasqal_rowsource *rowsource, FILE* fh)
{
    raptor_iostream *iostr;

    iostr = raptor_new_iostream_to_file_handle(rowsource->world->raptor_world_ptr, fh);
    rasqal_rowsource_write(rowsource, iostr);
    raptor_free_iostream(iostr);
}
开发者ID:sengels,项目名称:rasqal,代码行数:19,代码来源:rasqal_rowsource.c


示例9: raptor_new_iostream_to_string

/**
 * raptor_new_iostream_to_string:
 * @string_p: pointer to location to hold string
 * @length_p: pointer to location to hold length of string (or NULL)
 * @malloc_handler: pointer to malloc to use to make string (or NULL)
 *
 * Constructor - create a new iostream writing to a string.
 *
 * If @malloc_handler is null, raptor will allocate it using it's
 * own memory allocator.  *@string_p is set to NULL on failure (and
 * *@length_p to 0 if @length_p is not NULL).
 * 
 * Return value: new #raptor_iostream object or NULL on failure
 **/
RAPTOR_EXTERN_C
raptor_iostream*
raptor_new_iostream_to_string(void **string_p, size_t *length_p,
                              void *(*malloc_handler)(size_t size))
{
  raptor_iostream* iostr;
  struct raptor_write_string_iostream_context* con;
  const raptor_iostream_handler2* handler2=&raptor_iostream_write_string_handler;
  const unsigned int mode=RAPTOR_IOSTREAM_MODE_WRITE;
  
  if(!raptor_iostream_check_handler(handler2, mode))
    return NULL;

  iostr=(raptor_iostream*)RAPTOR_CALLOC(raptor_iostream, 1,
                                        sizeof(raptor_iostream));
  if(!iostr)
    return NULL;

  con=(struct raptor_write_string_iostream_context*)RAPTOR_CALLOC(raptor_write_string_iostream_context, 1, sizeof(struct raptor_write_string_iostream_context));
  if(!con) {
    RAPTOR_FREE(raptor_iostream, iostr);
    return NULL;
  }

  con->sb=raptor_new_stringbuffer();
  if(!con->sb) {
    RAPTOR_FREE(raptor_iostream, iostr);
    RAPTOR_FREE(raptor_write_string_iostream_context, con);
    return NULL;
  }

  con->string_p=string_p;
  *string_p=NULL;

  con->length_p=length_p;  
  if(length_p)
    *length_p=0;

  if(malloc_handler)
    con->malloc_handler=malloc_handler;
  else
    con->malloc_handler=raptor_alloc_memory;
  
  iostr->handler=handler2;
  iostr->user_data=(void*)con;
  iostr->mode = mode;

  if(iostr->handler->init && iostr->handler->init(iostr->user_data)) {
    raptor_free_iostream(iostr);
    return NULL;
  }
  return iostr;
}
开发者ID:copasi,项目名称:copasi-dependencies,代码行数:67,代码来源:raptor_iostream.c


示例10: librdf_query_results_to_counted_string2

/**
 * librdf_query_results_to_counted_string2:
 * @query_results: #librdf_query_results object
 * @name: name of syntax to format to
 * @mime_type: mime type of syntax to format to (or NULL)
 * @format_uri: URI of syntax to format to (or NULL)
 * @base_uri: Base URI of output formatted syntax (or NULL)
 * @length_p: Pointer to where to store length of string (or NULL)
 *
 * Turn a query results into a string.
 * 
 * A query results format can be named, have a mime type, or
 * identified by a URI, all of which are optional.  The default
 * query results format will be used if @name, @mime_type and
 * @format_uri are all NULL.
 *
 * librdf_query_results_formats_enumerate() returns information on
 * the known query results names, labels and URIs.
 *
 * The @base_uri may be used for as the base URI the generated
 * syntax, depending on the format.
 *
 * The returned string must be freed by the caller using
 * librdf_free_memory().
 *
 * Return value: new string value or NULL on failure
 **/
unsigned char*
librdf_query_results_to_counted_string2(librdf_query_results *query_results,
                                        const char *name,
                                        const char *mime_type,
                                        librdf_uri *format_uri,
                                        librdf_uri *base_uri,
                                        size_t *length_p)
{
  librdf_query_results_formatter *formatter;
  void *string=NULL;
  size_t string_length=0;
  raptor_iostream *iostr;
  int error=0;

  LIBRDF_ASSERT_OBJECT_POINTER_RETURN_VALUE(query_results, librdf_query_results, NULL);

  iostr = raptor_new_iostream_to_string(query_results->query->world->raptor_world_ptr,
                                        &string, &string_length, malloc);
  if(!iostr)
    return NULL;
              
  formatter = librdf_new_query_results_formatter2(query_results,
                                                  name, mime_type,
                                                  format_uri);
  if(!formatter) {
    error=1;
    goto tidy;
  }

  if(librdf_query_results_formatter_write(iostr, formatter,
                                          query_results, base_uri))
    error=1;

  librdf_free_query_results_formatter(formatter);

 tidy:
  raptor_free_iostream(iostr);

  /* string is available only after the iostream is finished
   * - clean it up here on error */
  if(error) {
    if(string) {
      raptor_free_memory(string);
      string=NULL;
    }
  }
  else if(length_p)
    *length_p = string_length;
  
  return (unsigned char *)string;
}
开发者ID:Distrotech,项目名称:librdf,代码行数:78,代码来源:rdf_query_results.c


示例11: librdf_query_results_to_file_handle2

/**
 * librdf_query_results_to_file_handle2:
 * @query_results: #librdf_query_results object
 * @handle: file handle to write to
 * @name: result format name (or NULL)
 * @mime_type: result mime type (or NULL)
 * @format_uri: URI of syntax to format to (or NULL)
 * @base_uri: Base URI of output formatted syntax 
 *
 * Write a query results to a FILE*.
 * 
 * A query results format can be named, have a mime type, or
 * identified by a URI, all of which are optional.  The default
 * query results format will be used if @name, @mime_type and @format_uri
 * are all NULL.
 *
 * librdf_query_results_formats_enumerate() returns information on
 * the known query results names, labels and URIs.
 *
 * The @base_uri may be used for as the base URI the generated syntax, depending
 * on the format.
 *
 * Return value: non 0 on failure
 **/
int
librdf_query_results_to_file_handle2(librdf_query_results *query_results, 
                                     FILE *handle, 
                                     const char *name,
                                     const char *mime_type,
                                     librdf_uri *format_uri,
                                     librdf_uri *base_uri)
{
  raptor_iostream *iostr;
  librdf_query_results_formatter *formatter;
  int status;
  
  LIBRDF_ASSERT_OBJECT_POINTER_RETURN_VALUE(query_results, query_results, 1);
  LIBRDF_ASSERT_OBJECT_POINTER_RETURN_VALUE(handle, FILE*, 1);


  iostr = raptor_new_iostream_to_file_handle(query_results->query->world->raptor_world_ptr,
                                             handle);
  if(!iostr)
    return 1;

  formatter = librdf_new_query_results_formatter2(query_results,
                                                  name, mime_type,
                                                  format_uri);
  if(!formatter) {
    raptor_free_iostream(iostr);
    return 1;
  }

  status = librdf_query_results_formatter_write(iostr, formatter,
                                                query_results, base_uri);

  librdf_free_query_results_formatter(formatter);

  raptor_free_iostream(iostr);

  return status;
}
开发者ID:Distrotech,项目名称:librdf,代码行数:62,代码来源:rdf_query_results.c


示例12: raptor_new_iostream_from_string

/**
 * raptor_new_iostream_from_string:
 * @world: raptor world
 * @string: pointer to string
 * @length: length of string
 *
 * Constructor - create a new iostream reading from a string.
 *
 * Return value: new #raptor_iostream object or NULL on failure
 **/
raptor_iostream*
raptor_new_iostream_from_string(raptor_world *world,
                                void *string, size_t length)
{
  raptor_iostream* iostr;
  struct raptor_read_string_iostream_context* con;
  const raptor_iostream_handler* handler;
  const unsigned int mode = RAPTOR_IOSTREAM_MODE_READ;

  RAPTOR_CHECK_CONSTRUCTOR_WORLD(world);

  if(!string)
    return NULL;
  
  raptor_world_open(world);
  
  handler = &raptor_iostream_read_string_handler;
  if(!raptor_iostream_check_handler(handler, mode))
    return NULL;

  iostr = RAPTOR_CALLOC(raptor_iostream*, 1, sizeof(*iostr));
  if(!iostr)
    return NULL;

  con = RAPTOR_CALLOC(struct raptor_read_string_iostream_context*, 1,
                      sizeof(*con));
  if(!con) {
    RAPTOR_FREE(raptor_iostream, iostr);
    return NULL;
  }

  con->string = string;
  con->length = length;

  iostr->world = world;
  iostr->handler = handler;
  iostr->user_data = (void*)con;
  iostr->mode = mode;

  if(iostr->handler->init && iostr->handler->init(iostr->user_data)) {
    raptor_free_iostream(iostr);
    return NULL;
  }
  return iostr;
}
开发者ID:bbcarchdev,项目名称:deb-raptor2,代码行数:55,代码来源:raptor_iostream.c


示例13: librdf_statement_print

/**
 * librdf_statement_print:
 * @statement: the statement
 * @fh: file handle
 *
 * Pretty print the statement to a file descriptor.
 * 
 * This method is for debugging and the format of the output should
 * not be relied on.
 * 
 **/
void
librdf_statement_print(librdf_statement *statement, FILE *fh) 
{
  raptor_iostream *iostr;
  
  LIBRDF_ASSERT_OBJECT_POINTER_RETURN(statement, librdf_statement);

  if(!statement)
    return;
  
  iostr = raptor_new_iostream_to_file_handle(statement->world->raptor_world_ptr, fh);
  if(!iostr)
    return;
  
  librdf_statement_write(statement, iostr);

  raptor_free_iostream(iostr);
}
开发者ID:nxg,项目名称:librdf,代码行数:29,代码来源:rdf_statement.c


示例14: raptor_term_print_as_ntriples

int
raptor_term_print_as_ntriples(const raptor_term *term, FILE* stream)
{
  int rc = 0;
  raptor_iostream* iostr;

  RAPTOR_ASSERT_OBJECT_POINTER_RETURN_VALUE(term, raptor_term, 1);
  RAPTOR_ASSERT_OBJECT_POINTER_RETURN_VALUE(stream, FILE*, 1);
  
  iostr = raptor_new_iostream_to_file_handle(term->world, stream);
  if(!iostr)
    return 1;
  
  rc = raptor_term_ntriples_write(term, iostr);

  raptor_free_iostream(iostr);
  
  return rc;
}
开发者ID:nevali,项目名称:raptor,代码行数:19,代码来源:raptor_term.c


示例15: test_write_to_filename

static int
test_write_to_filename(raptor_world *world, const char* filename, 
                       const char* test_string, size_t test_string_len,
                       const unsigned int expected_bytes_count)
{
  raptor_iostream *iostr = NULL;
  unsigned long count;
  int rc = 0;
  const char* const label="write iostream to filename";
  
#if defined(RAPTOR_DEBUG) && RAPTOR_DEBUG > 1
  fprintf(stderr, "%s: Testing %s '%s'\n", program, label, filename);
#endif

  iostr = raptor_new_iostream_to_filename(world, filename);
  if(!iostr) {
    fprintf(stderr, "%s: Failed to create %s '%s'\n", program, label, filename);
    rc = 1;
    goto tidy;
  }

  raptor_iostream_write_bytes(test_string, 1, test_string_len, iostr);
  raptor_iostream_write_byte('\n', iostr);
  
  count = raptor_iostream_tell(iostr);
  if(count != expected_bytes_count) {
    fprintf(stderr, "%s: %s wrote %d bytes, expected %d\n", program, label,
            (int)count, expected_bytes_count);
    rc = 1;
    goto tidy;
  }

  tidy:
  if(iostr)
    raptor_free_iostream(iostr);
  remove(filename);

  if(rc)
    fprintf(stderr, "%s: FAILED Testing %s\n", program, label);
    
  return rc;
}
开发者ID:bbcarchdev,项目名称:deb-raptor2,代码行数:42,代码来源:raptor_iostream.c


示例16: print_formatted_query_results

static int
print_formatted_query_results(rasqal_world* world,
                              rasqal_query_results* results,
                              raptor_world* raptor_world_ptr,
                              FILE* output,
                              const char* result_format,
                              raptor_uri* base_uri,
                              int quiet)
{
    raptor_iostream *iostr;
    rasqal_query_results_formatter* results_formatter;
    int rc = 0;

    results_formatter = rasqal_new_query_results_formatter(world,
                        result_format,
                        NULL, NULL);
    if(!results_formatter) {
        fprintf(stderr, "%s: Invalid bindings result format `%s'\n",
                program, result_format);
        rc = 1;
        goto tidy;
    }


    iostr = raptor_new_iostream_to_file_handle(raptor_world_ptr, output);
    if(!iostr) {
        rasqal_free_query_results_formatter(results_formatter);
        rc = 1;
        goto tidy;
    }

    rc = rasqal_query_results_formatter_write(iostr, results_formatter,
            results, base_uri);
    raptor_free_iostream(iostr);
    rasqal_free_query_results_formatter(results_formatter);

tidy:
    if(rc)
        fprintf(stderr, "%s: Formatting query results failed\n", program);

    return rc;
}
开发者ID:sengels,项目名称:rasqal,代码行数:42,代码来源:roqet.c


示例17: rleaf_librdf_node_to_string

/*
 * Return the specified +node+ as an NTriples string.
 */
VALUE
rleaf_librdf_node_to_string( librdf_node *node )
{
	raptor_iostream *stream = NULL;
	void *dumped_node = NULL;
	int ret;

	stream = raptor_new_iostream_to_string( node->world, &dumped_node, NULL, NULL );
	if ( !stream ) {
		rb_sys_fail( "raptor_new_iostream_to_string" );
	}

	ret = librdf_node_write( node, stream );
	raptor_free_iostream( stream );

	if ( ret != 0 )
		rb_fatal( "librdf_node_write failed." );

	return rb_str_new2( (char *)dumped_node );
}
开发者ID:ged,项目名称:redleaf,代码行数:23,代码来源:node.c


示例18: raptor_serializer_serialize_end

/**
 * raptor_serializer_serialize_end:
 * @rdf_serializer:  the #raptor_serializer
 *
 * End a serialization.
 * 
 * Return value: non-0 on failure.
 **/
int
raptor_serializer_serialize_end(raptor_serializer *rdf_serializer) 
{
  int rc;
  
  if(!rdf_serializer->iostream)
    return 1;

  if(rdf_serializer->factory->serialize_end)
    rc = rdf_serializer->factory->serialize_end(rdf_serializer);
  else
    rc = 0;

  if(rdf_serializer->iostream) {
    if(rdf_serializer->free_iostream_on_end)
      raptor_free_iostream(rdf_serializer->iostream);
    rdf_serializer->iostream = NULL;
  }
  return rc;
}
开发者ID:Distrotech,项目名称:raptor,代码行数:28,代码来源:raptor_serialize.c


示例19: raptor_new_iostream_from_filename

/**
 * raptor_new_iostream_from_filename:
 * @world: raptor world
 * @filename: Input filename to open and read from
 *
 * Constructor - create a new iostream reading from a filename.
 * 
 * Return value: new #raptor_iostream object or NULL on failure
 **/
raptor_iostream*
raptor_new_iostream_from_filename(raptor_world *world, const char *filename)
{
  FILE *handle;
  raptor_iostream* iostr;
  const raptor_iostream_handler* handler;
  const unsigned int mode = RAPTOR_IOSTREAM_MODE_READ;

  RAPTOR_CHECK_CONSTRUCTOR_WORLD(world);

  if(!filename)
    return NULL;
  
  raptor_world_open(world);
  
  handler = &raptor_iostream_read_filename_handler;
  if(!raptor_iostream_check_handler(handler, mode))
    return NULL;

  handle = fopen(filename, "rb");
  if(!handle)
    return NULL;
  
  iostr = RAPTOR_CALLOC(raptor_iostream*, 1, sizeof(*iostr));
  if(!iostr) {
    fclose(handle);
    return NULL;
  }

  iostr->world = world;
  iostr->handler = handler;
  iostr->user_data = (void*)handle;
  iostr->mode = mode;

  if(iostr->handler->init && 
     iostr->handler->init(iostr->user_data)) {
    raptor_free_iostream(iostr);
    return NULL;
  }
  return iostr;
}
开发者ID:bbcarchdev,项目名称:deb-raptor2,代码行数:50,代码来源:raptor_iostream.c


示例20: test_read_from_sink

static int
test_read_from_sink(raptor_world *world, size_t read_len, size_t expected_len)
{
  raptor_iostream *iostr = NULL;
  char buffer[READ_BUFFER_SIZE];
  unsigned long count;
  int rc = 0;
  const char* const label="read iostream from sink";
  
#if defined(RAPTOR_DEBUG) && RAPTOR_DEBUG > 1
  fprintf(stderr, "%s: Testing %s\n", program, label);
#endif
  expected_len = 0;
  iostr = raptor_new_iostream_from_sink(world);
  if(!iostr) {
    fprintf(stderr, "%s: Failed to create %s\n", program, label);
    rc = 1;
    goto tidy;
  }

  count = raptor_iostream_read_bytes(buffer, 1, read_len, iostr);
  if(count != expected_len) {
    fprintf(stderr, "%s: %s read %d bytes, expected %d\n", program, label,
            (int)count, (int)expected_len);
    rc = 1;
  }

  if(!raptor_iostream_read_eof(iostr)) {
    fprintf(stderr, "%s: %s not EOF as expected\n", program, label);
    rc = 1;
  }

  tidy:
  if(iostr)
    raptor_free_iostream(iostr);

  if(rc)
    fprintf(stderr, "%s: FAILED Testing %s\n", program, label);
    
  return rc;
}
开发者ID:bbcarchdev,项目名称:deb-raptor2,代码行数:41,代码来源:raptor_iostream.c



注:本文中的raptor_free_iostream函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ raptor_free_uri函数代码示例发布时间:2022-05-30
下一篇:
C++ rank函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap