<?xml version="1.0"?>
<page id="bson_value_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_value_t</title>
  <subtitle>BSON Boxed Container Type</subtitle>

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

typedef struct _bson_value_t
{
   bson_type_t           value_type;
   union {
      bson_oid_t         v_oid;
      int64_t            v_int64;
      int32_t            v_int32;
      int8_t             v_int8;
      double             v_double;
      bool               v_bool;
      int64_t            v_datetime;
      struct {
         uint32_t        timestamp;
         uint32_t        increment;
      } v_timestamp;
      struct {
         uint32_t        len;
         char           *str;
      } v_utf8;
      struct {
         uint32_t        data_len;
         uint8_t        *data;
      } v_doc;
      struct {
         uint32_t        data_len;
         uint8_t        *data;
         bson_subtype_t  subtype;
      } v_binary;
      struct {
         char           *regex;
         char           *options;
      } v_regex;
      struct {
         char           *collection;
         uint32_t        collection_len;
         bson_oid_t      oid;
      } v_dbpointer;
      struct {
         uint32_t        code_len;
         char           *code;
      } v_code;
      struct {
         uint32_t        code_len;
         char           *code;
         uint32_t        scope_len;
         uint8_t        *scope_data;
      } v_codewscope;
      struct {
         uint32_t        len;
         char           *symbol;
      } v_symbol;
   } value;
} bson_value_t;]]></code></synopsis>
  </section>

  <section id="description">
    <title>Description</title>
    <p>The <link xref="bson_value_t">bson_value_t</link> structure is a boxed type for encapsulating a runtime determined type.</p>
  </section>

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

  <section id="examples">
    <title>Example</title>
    <listing>
      <title></title>
      <synopsis><code mime="text/x-csrc"><![CDATA[const bson_value_t *value;

value = bson_iter_value (&iter);

if (value.type == BSON_TYPE_INT32) {
   printf ("%d\n", value.value.v_int32);
}
]]></code></synopsis>
    </listing>
  </section>
</page>
