<?xml version="1.0"?>
<page id="bson_reader_t"
      type="guide"
      style="class"
      xmlns="http://projectmallard.org/1.0/"
      xmlns:api="http://projectmallard.org/experimental/api/"
      xmlns:ui="http://projectmallard.org/experimental/ui/">

  <info>
    <link type="guide" xref="index#api-reference" />
  </info>

  <title>bson_reader_t</title>
  <subtitle>Streaming BSON Document Reader</subtitle>

  <section id="description">
    <title>Synopsis</title>
    <synopsis><code mime="text/x-csrc"><![CDATA[#include <bson.h>

typedef struct _bson_reader_t bson_reader_t;

bson_reader_t *bson_reader_new_from_handle (void *handle,
                                            bson_reader_read_func_t rf,
                                            bson_reader_destroy_func_t df);
bson_reader_t *bson_reader_new_from_fd     (int fd,
                                            bool close_on_destroy);
bson_reader_t *bson_reader_new_from_file   (const char *path,
                                            bson_error_t *error);
bson_reader_t *bson_reader_new_from_data   (const uint8_t *data,
                                            size_t length);

void           bson_reader_destroy         (bson_reader_t *reader);
]]></code></synopsis>
  </section>

  <section id="description">
    <title>Description</title>
    <p><link xref="bson_reader_t">bson_reader_t</link> is a structure used for reading a sequence of BSON documents. The sequence can come from a file-descriptor, memory region, or custom callbacks.</p>
  </section>

  <links type="topic" groups="function" style="2column">
    <title>Functions</title>
  </links>

  <section id="examples">
    <title>Example</title>
    <listing>
      <title>Convert a Sequence of BSON documents to JSON</title>
      <synopsis><code mime="text/x-csrc"><include parse="text" href="../examples/bson-to-json.c" xmlns="http://www.w3.org/2001/XInclude" /></code></synopsis>
    </listing>
  </section>
</page>
