msgid ""
msgstr ""
"Project-Id-Version: Chinese (Simplified Han script) (Boost Beast Translation "
"(zh_Hans))\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-07-25 15:41+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: Chinese (Simplified Han script) <https://"
"insights.cppalliance.org/weblate/projects/boost-beast-documentation-zh_Hans/"
"doc-qbk-06-websocket-03-decorator-qbk/zh_Hans/>\n"
"Language: zh_Hans\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Weblate 2026.5\n"

#. type: section title
#: 12
msgid "Decorator"
msgstr "修饰器"

#. type: paragraph
#: 14
msgid ""
"For programs which need to modify either the outgoing WebSocket HTTP Upgrade "
"request, the outgoing WebSocket HTTP Upgrade response, or both, the stream "
"supports an optional property called a ['decorator]. This is a function "
"pointer or callable object which is invoked before the implementation sends "
"an HTTP message. The decorator receives a modifiable reference to the "
"message, allowing for modifications. The interface to this system uses:"
msgstr ""
"对于需要修改出站 WebSocket HTTP 升级请求或响应（或两者都需要）的程序，流支持"
"一个可选属性，称为“修饰器”。修饰器是一个函数指针或可调用对象，在实现发送 "
"HTTP 消息前会被调用。修饰器接收一个可修改的消息引用，允许对其进行修改。该系统"
"的接口使用以下类型："

#. type: table title
#: 22
msgid "WebSocket Decorator Interface"
msgstr "WebSocket 修饰器接口"

#. type: table cell
#: 22
msgid "Name"
msgstr "名称"

#. type: table cell
#: 22
msgid "Description"
msgstr "描述"

#. type: table cell
#: 22
msgid "[link beast.ref.boost__beast__websocket__request_type `request_type`]"
msgstr "[link beast.ref.boost__beast__websocket__request_type `request_type`]"

#. type: table cell
#: 22
msgid ""
"This is the type of the object passed to the decorator to represent HTTP "
"Upgrade requests."
msgstr "该类型表示传递给修饰器的对象，用于表示 HTTP 升级请求。"

#. type: table cell
#: 22
msgid "[link beast.ref.boost__beast__websocket__response_type `response_type`]"
msgstr "[link beast.ref.boost__beast__websocket__response_type `response_type`]"

#. type: table cell
#: 22
msgid ""
"This is the type of the object passed to the decorator to represent HTTP "
"Upgrade response."
msgstr "该类型表示传递给修饰器的对象，用于表示 HTTP 升级响应。"

#. type: table cell
#: 22
msgid ""
"[link beast.ref.boost__beast__websocket__stream_base__decorator "
"`stream_base::decorator`]"
msgstr ""
"[link beast.ref.boost__beast__websocket__stream_base__decorator "
"`stream_base::decorator`]"

#. type: table cell
#: 22
msgid ""
"Objects of this type are used to hold a decorator to be set on the stream "
"using `set_option`."
msgstr "该类型的对象用于保存修饰器，并通过 `set_option` 将其设置在流上。"

#. type: table cell
#: 22
msgid ""
"[link beast.ref.boost__beast__websocket__stream.set_option "
"`stream::set_option`]"
msgstr ""
"[link beast.ref.boost__beast__websocket__stream.set_option "
"`stream::set_option`]"

#. type: table cell
#: 22
msgid "This function is used to set a `stream_base::decorator` on the stream."
msgstr "该函数用于在流上设置 `stream_base::decorator`。"

#. type: paragraph
#: 49
msgid "This declares a normal function which decorates outgoing HTTP requests:"
msgstr "以下声明一个普通函数，该函数用于装饰出站 HTTP 请求。"

#. type: paragraph
#: 53
msgid ""
"When using a decorator, it must be set on the stream before any handshaking "
"takes place. This sets the decorator on the stream, to be used for all "
"subsequent calls to accept or handshake:"
msgstr ""
"使用修饰器时，必须在进行任何握手之前将其设置在流上。以下代码将修饰器设置在流"
"上，供后续所有 `accept` 或 `handshake` 调用使用："

#. type: paragraph
#: 59
msgid ""
"Alternatively, a function object may be used. Small function objects will "
"not incur a memory allocation. The follow code declares and sets a function "
"object as a decorator:"
msgstr ""
"也可以使用函数对象。小型函数对象不会产生内存分配。以下代码声明并设置一个函数"
"对象作为修饰器："

#. type: paragraph
#: 65
msgid "A lambda may be used in place of a named function object:"
msgstr "也可以使用 lambda 表达式代替具名函数对象："

#. type: paragraph
#: 69
msgid ""
"It also possible for a single decorator to handle both requests and "
"responses, if it is overloaded for both types either as a generic lambda "
"(C++14 and later) or as a class as shown here:"
msgstr ""
"单个修饰器也可以同时处理请求和响应，只需为这两种类型提供重载，可以通过泛型 "
"lambda（C++14 及更高版本）或类来实现，如下所示："

#. type: paragraph
#: 75
msgid ""
"The implementation takes ownership by decay-copy of the invocable object "
"used as the decorator. Move-only types are possible:"
msgstr ""
"实现会通过退化拷贝的方式获取用作修饰器的可调用对象的所有权。只可移动的类型也"
"同样适用："

#. type: paragraph
#: 81
msgid "Undefined behavior results if the decorator modifies the fields"
msgstr "如果修饰器修改以下字段，将导致未定义行为："
