<?xml version="1.0"?>
<page xmlns="http://projectmallard.org/1.0/"
      type="topic"
      style="function"
      xmlns:api="http://projectmallard.org/experimental/api/"
      xmlns:ui="http://projectmallard.org/experimental/ui/"
      id="bson_iter_codewscope">
  <info>
    <link type="guide" xref="bson_iter_t" group="function"/>
  </info>
  <title>bson_iter_codewscope()</title>

  <section id="synopsis">
    <title>Synopsis</title>
    <synopsis><code mime="text/x-csrc"><![CDATA[
#define BSON_ITER_HOLDS_CODEWSCOPE(iter) \
   (bson_iter_type ((iter)) == BSON_TYPE_CODEWSCOPE)

const char *
bson_iter_codewscope (const bson_iter_t *iter,
                      uint32_t          *length,
                      uint32_t          *scope_len,
                      const uint8_t    **scope);
]]></code></synopsis>
  </section>

  <section id="parameters">
    <title>Parameters</title>
    <table>
      <tr><td><p>iter</p></td><td><p>A <code xref="bson_iter_t">bson_iter_t</code>.</p></td></tr>
      <tr><td><p>length</p></td><td><p>An optional location for the length of the resulting UTF-8 encoded string.</p></td></tr>
      <tr><td><p>scope_len</p></td><td><p>A optional location for the length of <code>scope</code>.</p></td></tr>
      <tr><td><p>scope</p></td><td><p>An optional location to store the immutable raw scope BSON document.</p></td></tr>
    </table>
  </section>

  <section id="description">
    <title>Description</title>
    <p>The <code>bson_iter_codewscope()</code> function acts similar to <code xref="bson_iter_code">bson_iter_code()</code> except for BSON_TYPE_CODEWSCOPE elements. It also will provide a pointer to the buffer for scope, which can be loaded into a <code xref="bson_t">bson_t</code> using <code xref="bson_init_static">bson_init_static()</code>.</p>

  </section>

  <section id="return">
    <title>Returns</title>
    <p>An UTF-8 encoded string containing the JavaScript code which should not be modified or freed.</p>
  </section>
</page>
