<?xml version="1.0" encoding="UTF-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.1" version="1.1">
  <file original="NoName" source-language="en" datatype="plaintext" target-language="zh_Hans">
    <body>
      <trans-unit xml:space="preserve" approved="no" id="ae46d3469cc00b75">
        <source>Custom Body Types</source>
        <target state="needs-translation">Custom Body Types</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile">10</context>
        </context-group>
        <note from="developer">type: section title</note>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="9a1435d9b0eb37fc">
        <source>User-defined types are possible for the message body, where the type meets the __Body__ requirements. This simplified class declaration shows the customization points available to user-defined body types: ``` /// Defines a Body type struct body {</source>
        <target state="needs-translation">User-defined types are possible for the message body, where the type meets the __Body__ requirements. This simplified class declaration shows the customization points available to user-defined body types: ``` /// Defines a Body type struct body {</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile">13</context>
        </context-group>
        <note from="developer">type: paragraph</note>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="1a3d7b198ded861c">
        <source>} ```</source>
        <target state="needs-translation">} ```</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile">33</context>
        </context-group>
        <note from="developer">type: paragraph</note>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="7e2d55cde8a6de8b">
        <source>The meaning of the nested types is as follows</source>
        <target state="needs-translation">The meaning of the nested types is as follows</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile">36</context>
        </context-group>
        <note from="developer">type: paragraph</note>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="cc1ebc169e468231">
        <source>Body Type Members</source>
        <target state="needs-translation">Body Type Members</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile">38</context>
        </context-group>
        <note from="developer">type: table title</note>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="b4c4db868dbf643a">
        <source>Name</source>
        <target state="needs-translation">Name</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile">38</context>
        </context-group>
        <note from="developer">type: table cell</note>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="f7f5c115cf553484">
        <source>Description</source>
        <target state="needs-translation">Description</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile">38</context>
        </context-group>
        <note from="developer">type: table cell</note>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="a65bcb465ca6f2e6">
        <source>`value_type`</source>
        <target state="needs-translation">`value_type`</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile">38</context>
        </context-group>
        <note from="developer">type: table cell</note>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="384a48135ea791a4">
        <source>Determines the type of the [link beast.ref.boost__beast__http__message.body `message::body`] member.</source>
        <target state="needs-translation">Determines the type of the [link beast.ref.boost__beast__http__message.body `message::body`] member.</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile">38</context>
        </context-group>
        <note from="developer">type: table cell</note>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="a077af8881d6e492">
        <source>`reader`</source>
        <target state="needs-translation">`reader`</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile">38</context>
        </context-group>
        <note from="developer">type: table cell</note>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="f96d6488fd32ac02">
        <source>An optional nested type meeting the requirements of __BodyReader__, which provides the algorithm for storing a forward range of buffer sequences in the body representation. If present, this body type may be used with a __parser__.</source>
        <target state="needs-translation">An optional nested type meeting the requirements of __BodyReader__, which provides the algorithm for storing a forward range of buffer sequences in the body representation. If present, this body type may be used with a __parser__.</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile">38</context>
        </context-group>
        <note from="developer">type: table cell</note>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="36e0a25eef2a6741">
        <source>`writer`</source>
        <target state="needs-translation">`writer`</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile">38</context>
        </context-group>
        <note from="developer">type: table cell</note>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="4eeb97838dc1cdc5">
        <source>An optional nested type meeting the requirements of __BodyWriter__, which provides the algorithm for converting the body representation to a forward range of buffer sequences. If present this body type may be used with a __serializer__.</source>
        <target state="needs-translation">An optional nested type meeting the requirements of __BodyWriter__, which provides the algorithm for converting the body representation to a forward range of buffer sequences. If present this body type may be used with a __serializer__.</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile">38</context>
        </context-group>
        <note from="developer">type: table cell</note>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="e520291155d7b259">
        <source>Value Type</source>
        <target state="needs-translation">Value Type</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile">66</context>
        </context-group>
        <note from="developer">type: heading</note>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="17a5ca6656d66b30">
        <source>The `value_type` nested type allows the body to define the declaration of the body type as it appears in the message. This can be any type. For example, a body's value type may specify `std::vector&lt;char&gt;` or `std::list&lt;std::string&gt;`. A custom body may even set the value type to something that is not a container for body octets, such as a [@boost:/libs/filesystem/doc/reference.html#class-path `boost::filesystem::path`]. Or, a more structured container may be chosen. This declares a body's value type as a JSON tree structure produced from a [@boost:/doc/html/json/input_output.html#json.input_output.parsing.streaming_parser `boost::json::stream_parser`]: ``` #include &lt;boost/json/stream_parser.hpp&gt;</source>
        <target state="needs-translation">The `value_type` nested type allows the body to define the declaration of the body type as it appears in the message. This can be any type. For example, a body's value type may specify `std::vector&lt;char&gt;` or `std::list&lt;std::string&gt;`. A custom body may even set the value type to something that is not a container for body octets, such as a [@boost:/libs/filesystem/doc/reference.html#class-path `boost::filesystem::path`]. Or, a more structured container may be chosen. This declares a body's value type as a JSON tree structure produced from a [@boost:/doc/html/json/input_output.html#json.input_output.parsing.streaming_parser `boost::json::stream_parser`]: ``` #include &lt;boost/json/stream_parser.hpp&gt;</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile">68</context>
        </context-group>
        <note from="developer">type: paragraph</note>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="cf4fdc4882b68625">
        <source>struct Body {</source>
        <target state="needs-translation">struct Body {</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile">80</context>
        </context-group>
        <note from="developer">type: paragraph</note>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="5d23d166dd76cc10">
        <source>}; ```</source>
        <target state="needs-translation">}; ```</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile">86</context>
        </context-group>
        <note from="developer">type: paragraph</note>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="ee9c5a5e0a8c5b38">
        <source>As long as a suitable reader or writer is available to provide the algorithm for transferring buffers in and out of the value type, those bodies may be parsed or serialized.</source>
        <target state="needs-translation">As long as a suitable reader or writer is available to provide the algorithm for transferring buffers in and out of the value type, those bodies may be parsed or serialized.</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile">89</context>
        </context-group>
        <note from="developer">type: paragraph</note>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="4e3a0bb9e818f8db">
        <source>File Body __example__</source>
        <target state="needs-translation">File Body __example__</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile">95</context>
        </context-group>
        <note from="developer">type: section title</note>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="e992dcd904b248ce">
        <source>Use of the flexible __Body__ concept customization point enables authors to preserve the self-contained nature of the __message__ object while allowing domain specific behaviors. Common operations for HTTP servers include sending responses which deliver file contents, and allowing for file uploads. In this example we build the [link beast.ref.boost__beast__http__basic_file_body `basic_file_body`] type which supports both reading and writing to a file on the file system. The interface is a class templated on the type of file used to access the file system, which must meet the requirements of __File__.</source>
        <target state="needs-translation">Use of the flexible __Body__ concept customization point enables authors to preserve the self-contained nature of the __message__ object while allowing domain specific behaviors. Common operations for HTTP servers include sending responses which deliver file contents, and allowing for file uploads. In this example we build the [link beast.ref.boost__beast__http__basic_file_body `basic_file_body`] type which supports both reading and writing to a file on the file system. The interface is a class templated on the type of file used to access the file system, which must meet the requirements of __File__.</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile">97</context>
        </context-group>
        <note from="developer">type: paragraph</note>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="caf14d591a66675b">
        <source>First we declare the type with its nested types:</source>
        <target state="needs-translation">First we declare the type with its nested types:</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile">108</context>
        </context-group>
        <note from="developer">type: paragraph</note>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="1b080b010675a984">
        <source>We will start with the definition of the `value_type`. Our strategy will be to store the file object directly in the message container through the `value_type` field. To use this body it will be necessary to call `msg.body.file().open()` first with the required information such as the path and open mode. This ensures that the file exists throughout the operation and prevent the race condition where the file is removed from the file system in between calls.</source>
        <target state="needs-translation">We will start with the definition of the `value_type`. Our strategy will be to store the file object directly in the message container through the `value_type` field. To use this body it will be necessary to call `msg.body.file().open()` first with the required information such as the path and open mode. This ensures that the file exists throughout the operation and prevent the race condition where the file is removed from the file system in between calls.</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile">112</context>
        </context-group>
        <note from="developer">type: paragraph</note>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="7adf2345ff6bc9a0">
        <source>Our implementation of __BodyWriter__ will contain a small buffer from which the file contents are read. The buffer is provided to the implementation on each call until everything has been read in.</source>
        <target state="needs-translation">Our implementation of __BodyWriter__ will contain a small buffer from which the file contents are read. The buffer is provided to the implementation on each call until everything has been read in.</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile">122</context>
        </context-group>
        <note from="developer">type: paragraph</note>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="b1b361e610ef38cd">
        <source>And here are the definitions for the functions we have declared:</source>
        <target state="needs-translation">And here are the definitions for the functions we have declared:</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile">128</context>
        </context-group>
        <note from="developer">type: paragraph</note>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="6f303673e6236848">
        <source>Files can be read now, and the next step is to allow writing to files by implementing the __BodyReader__. The style is similar to the writer, except that buffers are incoming instead of outgoing. Here's the declaration:</source>
        <target state="needs-translation">Files can be read now, and the next step is to allow writing to files by implementing the __BodyReader__. The style is similar to the writer, except that buffers are incoming instead of outgoing. Here's the declaration:</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile">132</context>
        </context-group>
        <note from="developer">type: paragraph</note>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="e51edc6ead05debe">
        <source>Finally, here is the implementation of the reader member functions:</source>
        <target state="needs-translation">Finally, here is the implementation of the reader member functions:</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile">139</context>
        </context-group>
        <note from="developer">type: paragraph</note>
      </trans-unit>
      <trans-unit xml:space="preserve" approved="no" id="460bd6af1ab8229f">
        <source>We have created a full featured body type capable of reading and writing files on the filesystem, integrating seamlessly with the HTTP algorithms and message container. The body type works with any file implementation meeting the requirements of __File__ so it may be transparently used with solutions optimized for particular platforms. Example HTTP servers which use file bodies are available in the example directory.</source>
        <target state="needs-translation">We have created a full featured body type capable of reading and writing files on the filesystem, integrating seamlessly with the HTTP algorithms and message container. The body type works with any file implementation meeting the requirements of __File__ so it may be transparently used with solutions optimized for particular platforms. Example HTTP servers which use file bodies are available in the example directory.</target>
        <context-group name="" purpose="location">
          <context context-type="sourcefile">143</context>
        </context-group>
        <note from="developer">type: paragraph</note>
      </trans-unit>
    </body>
  </file>
</xliff>
