Skip to content

Commit 0afb2b8

Browse files
Move "Generated Fieldnames" documentation section to the "Fields" section.
PiperOrigin-RevId: 840803477
1 parent 4951c87 commit 0afb2b8

File tree

1 file changed

+34
-34
lines changed

1 file changed

+34
-34
lines changed

content/reference/cpp/cpp-generated.md

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -149,40 +149,6 @@ The class also defines the following static methods:
149149
default instance of a message can be used as a factory by calling its
150150
`New()` method.
151151

152-
<a id="generated-filenames"><!-- old anchor name, retained to avoid broken links --></a>
153-
154-
### Generated Fieldnames {#generated-fieldnames}
155-
156-
[Reserved keywords](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/compiler/cpp/helpers.cc#L4)
157-
are appended with an underscore in the generated output.
158-
159-
For example, the following proto3 definition syntax:
160-
161-
```proto
162-
message MyMessage {
163-
string false = 1;
164-
string myFalse = 2;
165-
}
166-
```
167-
168-
generates the following partial output:
169-
170-
```cpp
171-
void clear_false_() ;
172-
const std::string& false_() const;
173-
void set_false_(Arg_&& arg, Args_... args);
174-
std::string* mutable_false_();
175-
PROTOBUF_NODISCARD std::string* release_false_();
176-
void set_allocated_false_(std::string* ptr);
177-
178-
void clear_myfalse() ;
179-
const std::string& myfalse() const;
180-
void set_myfalse(Arg_&& arg, Args_... args);
181-
std::string* mutable_myfalse();
182-
PROTOBUF_NODISCARD std::string* release_myfalse();
183-
void set_allocated_myfalse(std::string* ptr);
184-
```
185-
186152
### Nested Types {#nested-types}
187153

188154
A message can be declared inside another message. For example:
@@ -235,6 +201,40 @@ any method inherited from `Message` or accessing the message through other ways
235201
Correspondingly, the value of the returned pointer is never guaranteed to be the
236202
same across two different invocations of the accessor.
237203

204+
<a id="generated-filenames"><!-- old anchor name, retained to avoid broken links --></a>
205+
206+
### Generated Fieldnames {#generated-fieldnames}
207+
208+
[Reserved keywords](https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/compiler/cpp/helpers.cc#L4)
209+
are appended with an underscore in the generated output.
210+
211+
For example, the following proto3 definition syntax:
212+
213+
```proto
214+
message MyMessage {
215+
string false = 1;
216+
string myFalse = 2;
217+
}
218+
```
219+
220+
generates the following partial output:
221+
222+
```cpp
223+
void clear_false_() ;
224+
const std::string& false_() const;
225+
void set_false_(Arg_&& arg, Args_... args);
226+
std::string* mutable_false_();
227+
PROTOBUF_NODISCARD std::string* release_false_();
228+
void set_allocated_false_(std::string* ptr);
229+
230+
void clear_myfalse() ;
231+
const std::string& myfalse() const;
232+
void set_myfalse(Arg_&& arg, Args_... args);
233+
std::string* mutable_myfalse();
234+
PROTOBUF_NODISCARD std::string* release_myfalse();
235+
void set_allocated_myfalse(std::string* ptr);
236+
```
237+
238238
### Explicit Presence Numeric Fields {#numeric}
239239
240240
For field definitions for numeric fields with

0 commit comments

Comments
 (0)