@@ -267,17 +267,19 @@ The compiler will generate the following accessor methods:
267267 whatever value is written into the given string.
268268- ` void clear_foo() ` : Clears the value of the field. After calling this,
269269 ` has_foo() ` will return ` false ` and ` foo() ` will return the default value.
270- - ` void set_allocated_foo(string* value) ` : Sets the ` string ` object to the
271- field and frees the previous field value if it exists. If the ` string `
272- pointer is not ` NULL ` , the message takes ownership of the allocated ` string `
273- object and ` has_foo() ` will return ` true ` . The message is free to delete the
274- allocated ` string ` object at any time, so references to the object may be
275- invalidated. Otherwise, if the ` value ` is ` NULL ` , the behavior is the same
276- as calling ` clear_foo() ` .
277- - ` string* release_foo() ` : Releases the ownership of the field and returns the
278- pointer of the ` string ` object. After calling this, caller takes the
279- ownership of the allocated ` string ` object, ` has_foo() ` will return ` false ` ,
280- and ` foo() ` will return the default value.
270+ - ` void set_allocated_foo(string* value) ` :
271+ Sets the ` string `
272+ object to the field and frees the previous field value if it exists. If the
273+ ` string ` pointer is not ` NULL ` , the message takes ownership of the allocated
274+ ` string ` object and ` has_foo() ` will return ` true ` . The message is free to
275+ delete the allocated ` string ` object at any time, so references to the
276+ object may be invalidated. Otherwise, if the ` value ` is ` NULL ` , the behavior
277+ is the same as calling ` clear_foo() ` .
278+ - ` string* release_foo() ` :
279+ Releases the
280+ ownership of the field and returns the pointer of the ` string ` object. After
281+ calling this, caller takes the ownership of the allocated ` string ` object,
282+ ` has_foo() ` will return ` false ` , and ` foo() ` will return the default value.
281283
282284### Singular String Fields (proto3) {#proto3_string}
283285
@@ -309,16 +311,18 @@ The compiler will generate the following accessor methods:
309311 return whatever value is written into the given string.
310312- ` void clear_foo() ` : Clears the value of the field. After calling this,
311313 ` foo() ` will return the empty string/empty bytes.
312- - ` void set_allocated_foo(string* value) ` : Sets the ` string ` object to the
313- field and frees the previous field value if it exists. If the ` string `
314- pointer is not ` NULL ` , the message takes ownership of the allocated ` string `
315- object. The message is free to delete the allocated ` string ` object at any
316- time, so references to the object may be invalidated. Otherwise, if the
317- ` value ` is ` NULL ` , the behavior is the same as calling ` clear_foo() ` .
318- - ` string* release_foo() ` : Releases the ownership of the field and returns the
319- pointer of the ` string ` object. After calling this, caller takes the
320- ownership of the allocated ` string ` object and ` foo() ` will return the empty
321- string/empty bytes.
314+ - ` void set_allocated_foo(string* value) ` :
315+ Sets the ` string `
316+ object to the field and frees the previous field value if it exists. If the
317+ ` string ` pointer is not ` NULL ` , the message takes ownership of the allocated
318+ ` string ` object. The message is free to delete the allocated ` string ` object
319+ at any time, so references to the object may be invalidated. Otherwise, if
320+ the ` value ` is ` NULL ` , the behavior is the same as calling ` clear_foo() ` .
321+ - ` string* release_foo() ` :
322+ Releases the
323+ ownership of the field and returns the pointer of the ` string ` object. After
324+ calling this, caller takes the ownership of the allocated ` string ` object
325+ and ` foo() ` will return the empty string/empty bytes.
322326
323327### Singular Enum Fields (proto2) {#enum_field}
324328
0 commit comments