-
Notifications
You must be signed in to change notification settings - Fork 0
Translation zh hans boost 1.90.0 #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: local-zh_Hans
Are you sure you want to change the base?
Changes from all commits
64cd412
7263137
af68b12
4c7773b
e8390b5
f256edf
ff79d08
bbad6c0
3a3502e
2055740
1fd25d6
fb06767
c1564a7
e7e1958
89cb1f6
b701d62
b6592da
79ace75
5b709cd
9494cec
d98fc2c
c753282
e01db7b
d66c344
8d8c745
80df57a
d68bd21
c1a129d
328ec83
eb3796e
d8562cf
c777e5c
30b012a
f080d39
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,8 +15,6 @@ Official repository: https://github.com/boostorg/json | |
|
|
||
| :leveloffset: +1 | ||
|
|
||
| include::background.adoc[] | ||
| include::storage_ptr.adoc[] | ||
| include::uses_allocator.adoc[] | ||
| include::background.adoc[] include::storage_ptr.adoc[] include::uses_allocator.adoc[] | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # First, check if the file exists and view its content around line 18
fd "overview_zh_Hans.adoc" -type fRepository: CppDigest/json Length of output: 229 🌐 Web query:
💡 Result: The AsciiDoc (Asciidoctor) include directive does not support specifying multiple distinct target files in a single directive line. Each include::[] directive processes exactly one target file or URI.[1][2] To include content from multiple files, use separate include directives, one per line.[1] For example, to include chapters with separation: include::chapter01.adoc[] include::chapter02.adoc[] [1] For contiguous content (no extra blank lines), place them adjacent: include::attributes-settings.adoc[] include::attributes-urls.adoc[] [1] The directive syntax is a line-oriented expression: include::target[optional-attributes].[1][2] The target (single) may contain spaces but cannot start with one.[1] Within one file/target, you can include multiple portions using attributes: - Multiple line ranges: lines="1..10,15..20" (quoted commas) or lines=7;14..25 (semicolons).[3] - Multiple tags: tag=foo,bar (quoted) or tag=foo;bar.[4][5] Example: include::filename.txt[lines="1..10,15..20"] [3] No native support for globs/multiple-files-in-one-directive (core); requires extensions like glob-include-processor.[6] Official docs confirm the directive must be on its own line, parsing one target per directive.[1][2][7] Citations:
🏁 Script executed: # Search for similar patterns in the codebase to see if this is a common practice
rg "include::" --type adoc -A 1 -B 1 | head -100Repository: CppDigest/json Length of output: 87 🏁 Script executed: # Find the file without type filter
fd "overview_zh_Hans.adoc"Repository: CppDigest/json Length of output: 215 🏁 Script executed: # Alternative: search in doc directory
find . -name "*overview_zh_Hans*" -type f 2>/dev/nullRepository: CppDigest/json Length of output: 223 🏁 Script executed: # View the content around line 18
sed -n '15,22p' doc/pages/allocators/overview_zh_Hans.adocRepository: CppDigest/json Length of output: 181 Split multiple include directives onto separate lines. The AsciiDoc include directive must be one per line per the official Asciidoctor specification. Place each 🤖 Prompt for AI Agents |
||
|
|
||
| :leveloffset: -1 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,49 +8,59 @@ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
| Official repository: https://github.com/boostorg/json | ||
| //// | ||
|
|
||
| = `storage_ptr` | ||
| 本库中的可变长度容器均使用动态分配的内存来存储其内容。调用方可通过在特定构造函数和函数参数列表中指定 <<ref_storage_ptr>> ,以控制所使用的内存分配策略。<<ref_storage_ptr>> 具有以下特性: | ||
| = `storage_ptr` 本库中的可变长度容器均使用动态分配的内存来存储其内容。调用方可通过在特定构造函数和函数参数列表中指定 <<ref_storage_ptr>> ,以控制所使用的内存分配策略。<<ref_storage_ptr>> 具有以下特性: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: cd /repo && find . -name "storage_ptr_zh_Hans.adoc" -type fRepository: CppDigest/json Length of output: 114 🏁 Script executed: git ls-files | grep -E "storage_ptr_zh_Hans.adoc"Repository: CppDigest/json Length of output: 104 🏁 Script executed: cat -n doc/pages/allocators/storage_ptr_zh_Hans.adocRepository: CppDigest/json Length of output: 6611 🏁 Script executed: rg -n "Functions and Types" doc/pages/allocators/storage_ptr_zh_Hans.adocRepository: CppDigest/json Length of output: 82 Split AsciiDoc section title and table blocks onto separate lines. Line 11 merges a section title with paragraph text on the same line. Lines 17 and 63 mix table captions, delimiters, and content onto single lines instead of proper standalone block boundaries. Correct formatting:
🤖 Prompt for AI Agents |
||
|
|
||
| * 存储指针始终指向一个有效的、类型擦除后的 {ref_memory_resource}。 | ||
| 以下是使用该库时所有与分配相关的类型和函数列表: | ||
|
|
||
| * 默认构造的存储指针引用 <<default_memory_resource,default resource>>(默认资源),这是一个由实现定义的实例,始终使用等效于全局 operator new 和 operator delete 的方式。 | ||
| .函数与类型 |=== |Name|描述 | ||
|
|
||
| * 从 {ref_memory_resource} 或 {ref_polymorphic_allocator} 构造的存储指针不获取所有权;调用方负责确保资源的生命周期持续到不再被引用为止。 | ||
| {ref_polymorphic_allocator} do not acquire ownership; the caller is responsible for ensuring that the lifetime of the resource extends until it is no longer referenced. | ||
|
|
||
| * 通过 <<ref_make_shared_resource>> 获取的存储指针会获得对内存资源的共享所有权;该资源的生命周期将延长,直至所有该存储指针的副本均被销毁。 | ||
| ownership of the memory resource; the lifetime of the resource is extended until all copies of the storage pointer are destroyed. | ||
|
|
||
| * 存储指针在对资源进行类型擦除之前会记录 <<ref_is_deallocate_trivial>> 的值,从而允许在运行时查询该值。 | ||
| before type-erasing the resource, allowing the value to be queried at run-time. | ||
|
|
||
| 以下是使用该库时所有与分配相关的类型和函数列表: | ||
| This lists all of the allocation-related types and functions available when using the library: | ||
|
|
||
| .函数与类型 | ||
| .Functions and Types | ||
| |=== | ||
| |Name|描述 | ||
| |Name|Description | ||
|
|
||
| | <<ref_get_null_resource>> | ||
| | 返回一个指向内存资源实例的指针,该实例在分配内存时总是抛出异常。此机制用于确保解析或容器操作不会进行动态内存分配,从而维持该不变性。 | ||
| | Returns a pointer to a memory resource instance which always throws an | ||
| exception upon allocation. This is used to to achieve the invariant that no parsing or container operation will dynamically allocate memory. | ||
|
|
||
| | <<ref_is_deallocate_trivial>> | ||
| | 一个自定义点,允许内存资源类型表明其 deallocate 调用是平凡的。 | ||
| | A customization point allowing a memory resource type to indicate that calls | ||
| to deallocate are trivial. | ||
|
|
||
| | <<ref_make_shared_resource>> | ||
| | 一个返回智能指针的函数,该智能指针对新分配的内存资源具有共享所有权。 | ||
| | A function returning a smart pointer with shared ownership of a newly | ||
| allocated memory resource. | ||
|
|
||
| | {ref_memory_resource} | ||
| | 表示分配器的抽象基类。 | ||
| | The abstract base class representing an allocator. | ||
|
|
||
| | <<ref_monotonic_resource>> | ||
| | 一种内存资源,用于分配大块内存,且其 deallocate 函数是平凡的。所分配的内存不会被释放,直到该资源被销毁,因此在解析场景下速度很快,但不适合执行修改操作。 | ||
| | A memory resource which allocates large blocks of memory and has a trivial | ||
| deallocate function. Allocated memory is not freed until the resource is destroyed, making it fast for parsing but not suited for performing modifications. | ||
|
|
||
| | {ref_polymorphic_allocator} | ||
| | 一个 {req_Allocator},它通过引用 {ref_memory_resource} 执行内存分配。 | ||
| | An {req_Allocator} which uses a reference to a {ref_memory_resource} to | ||
| perform allocations. | ||
|
|
||
| | <<ref_static_resource>> | ||
| | 一种使用调用方提供的单一缓冲区的内存资源,不进行任何动态分配。该资源在解析时速度很快,但不适合执行修改操作。 | ||
| | A memory resource that uses a single caller provided buffer. No dynamic | ||
| allocations are used. This is fast for parsing but not suited for performing modifications. | ||
|
|
||
| | <<ref_storage_ptr>> | ||
| | 一种用于管理和访问 {ref_memory_resource} 的智能指针。 | ||
| |=== | ||
| | A smart pointer through which a {ref_memory_resource} is managed and | ||
| accessed. |=== | ||
|
|
||
| == 默认内存资源 | ||
| 默认内存资源使用全局 `operator new` 和 `operator delete` 来进行内存分配。该资源不采用引用计数,且其 deallocate 函数是非平凡的。所有默认构造的 <<ref_storage_ptr>> 对象均引用同一个内存资源: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,28 +9,29 @@ Official repository: https://github.com/boostorg/json | |
| //// | ||
|
|
||
| [#uses_allocator] | ||
| = 使用分配器构造 | ||
| 为支持已使用多态分配器的代码库,本库中的容器支持 {std_uses_allocator} 构造。对于 <<ref_array>>, <<ref_object>>, <<ref_string>> 和 <<ref_value>>: | ||
| = 使用分配器构造 为支持已使用多态分配器的代码库,本库中的容器支持 {std_uses_allocator} 构造。对于 <<ref_array>>, <<ref_object>>, <<ref_string>> 和 <<ref_value>>: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: cat -n doc/pages/allocators/uses_allocator_zh_Hans.adoc | head -30Repository: CppDigest/json Length of output: 1264 Fix AsciiDoc document structure for heading and bullet item. Line 12 merges the section title with paragraph text on a single line, breaking AsciiDoc syntax. Lines 20–21 fragment the Suggested fix-= 使用分配器构造 为支持已使用多态分配器的代码库,本库中的容器支持 {std_uses_allocator} 构造。对于 <<ref_array>>, <<ref_object>>, <<ref_string>> 和 <<ref_value>>:
+= 使用分配器构造
+
+为支持已使用多态分配器的代码库,本库中的容器支持 {std_uses_allocator} 构造。对于 <<ref_array>>, <<ref_object>>, <<ref_string>> 和 <<ref_value>>:
...
-* 成员函数 `get_allocator` 返回一个
-库容器可以从多态分配器构造:
+* 成员函数 `get_allocator` 返回一个由容器所使用的 {ref_memory_resource} 构造的 {ref_polymorphic_allocator} 实例。
+
+库容器可以从多态分配器构造:🤖 Prompt for AI Agents |
||
|
|
||
| * 嵌套类型 `allocator_type` 是{ref_polymorphic_allocator}的别名。 | ||
| 由容器所使用的 {ref_memory_resource} 构造的 {ref_polymorphic_allocator} 实例。该内存资源的所有权不会被转移。 | ||
|
|
||
| * 所有接受 <<ref_storage_ptr>> 的合格构造函数,也将在相同参数位置接受一个 {ref_polymorphic_allocator} 实例。 | ||
| 实际上,这意味着当库中的容器类型被用在使用多态分配器的标准容器中时,该分配器会传播到 JSON 类型。例如: | ||
|
|
||
| * 成员函数 `get_allocator` 返回一个 | ||
| 由容器所使用的 {ref_memory_resource} 构造的 {ref_polymorphic_allocator} 实例。该内存资源的所有权不会被转移。 | ||
| 库容器可以从多态分配器构造: | ||
|
|
||
| 实际上,这意味着当库中的容器类型被用在使用多态分配器的标准容器中时,该分配器会传播到 JSON 类型。例如: | ||
| 多态分配器会递归传播。子元素的子元素将使用与父元素相同的内存资源。 | ||
|
|
||
| [source] | ||
| ---- | ||
| include::../../../test/doc_uses_allocator.cpp[tag=doc_uses_allocator_1,indent=0] | ||
| ---- | ||
|
|
||
| 库容器可以从多态分配器构造: | ||
| Library containers can be constructed from polymorphic allocators: | ||
|
|
||
| [source] | ||
| ---- | ||
| include::../../../test/doc_uses_allocator.cpp[tag=doc_uses_allocator_2,indent=0] | ||
| ---- | ||
|
|
||
| 多态分配器会递归传播。子元素的子元素将使用与父元素相同的内存资源。 | ||
| The polymorphic allocator is propagated recursively. Child elements of child elements will use the same memory resource as the parent. | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: CppDigest/json
Length of output: 796
Split the section heading from body text.
Line 11 incorrectly appends the explanatory sentence to the section heading. In AsciiDoc, the
=heading syntax requires the title only on that line. The body text must start on a separate line after a blank line:Fix
🤖 Prompt for AI Agents