Skip to content

Commit 84062e9

Browse files
authored
Merge branch 'main' into patch-1
2 parents 82237fd + b9bd712 commit 84062e9

File tree

57 files changed

+1333
-1211
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1333
-1211
lines changed

content/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ Dart, Go, Ruby, PHP, and C#, with more languages to come.
9393
<ol>
9494
9595
<li>
96-
<a href="https://github.com/protocolbuffers/protobuf#protocol-compiler-installation">Download
96+
<a href="https://github.com/protocolbuffers/protobuf#protobuf-compiler-installation">Download
9797
and install</a> the protocol buffer compiler.
9898
</li>
9999

content/editions/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ message Person {
224224
string name = 1;
225225
int32 id = 2 [features.presence = IMPLICIT];
226226
227-
enum Pay_Type
227+
enum Pay_Type {
228228
PAY_TYPE_UNSPECIFIED = 1,
229229
PAY_TYPE_SALARY = 2,
230230
PAY_TYPE_HOURLY = 3

content/getting-started/cpptutorial.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ message Person {
9696
9797
message PhoneNumber {
9898
optional string number = 1;
99-
optional PhoneType type = 2 [default = HOME];
99+
optional PhoneType type = 2 [default = PHONE_TYPE_HOME];
100100
}
101101
102102
repeated PhoneNumber phones = 4;
@@ -276,9 +276,9 @@ any particular field definition, see the
276276
277277
The generated code includes a `PhoneType` enum that corresponds to your `.proto`
278278
enum. You can refer to this type as `Person::PhoneType` and its values as
279-
`Person::MOBILE`, `Person::HOME`, and `Person::WORK` (the implementation details
280-
are a little more complicated, but you don't need to understand them to use the
281-
enum).
279+
`Person::PHONE_TYPE_MOBILE`, `Person::PHONE_TYPE_HOME`, and
280+
`Person::PHONE_TYPE_WORK` (the implementation details are a little more
281+
complicated, but you don't need to understand them to use the enum).
282282
283283
The compiler has also generated a nested class for you called
284284
`Person::PhoneNumber`. If you look at the code, you can see that the "real"
@@ -394,11 +394,11 @@ void PromptForAddress(tutorial::Person* person) {
394394
string type;
395395
getline(cin, type);
396396
if (type == "mobile") {
397-
phone_number->set_type(tutorial::Person::MOBILE);
397+
phone_number->set_type(tutorial::Person::PHONE_TYPE_MOBILE);
398398
} else if (type == "home") {
399-
phone_number->set_type(tutorial::Person::HOME);
399+
phone_number->set_type(tutorial::Person::PHONE_TYPE_HOME);
400400
} else if (type == "work") {
401-
phone_number->set_type(tutorial::Person::WORK);
401+
phone_number->set_type(tutorial::Person::PHONE_TYPE_WORK);
402402
} else {
403403
cout << "Unknown phone type. Using default." << endl;
404404
}
@@ -494,13 +494,13 @@ void ListPeople(const tutorial::AddressBook& address_book) {
494494
const tutorial::Person::PhoneNumber& phone_number = person.phones(j);
495495
496496
switch (phone_number.type()) {
497-
case tutorial::Person::MOBILE:
497+
case tutorial::Person::PHONE_TYPE_MOBILE:
498498
cout << " Mobile phone #: ";
499499
break;
500-
case tutorial::Person::HOME:
500+
case tutorial::Person::PHONE_TYPE_HOME:
501501
cout << " Home phone #: ";
502502
break;
503-
case tutorial::Person::WORK:
503+
case tutorial::Person::PHONE_TYPE_WORK:
504504
cout << " Work phone #: ";
505505
break;
506506
}

content/getting-started/darttutorial.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -251,13 +251,13 @@ Person promptForAddress() {
251251
String type = stdin.readLineSync();
252252
switch (type) {
253253
case 'mobile':
254-
phoneNumber.type = Person_PhoneType.MOBILE;
254+
phoneNumber.type = Person_PhoneType.PHONE_TYPE_MOBILE;
255255
break;
256256
case 'home':
257-
phoneNumber.type = Person_PhoneType.HOME;
257+
phoneNumber.type = Person_PhoneType.PHONE_TYPE_HOME;
258258
break;
259259
case 'work':
260-
phoneNumber.type = Person_PhoneType.WORK;
260+
phoneNumber.type = Person_PhoneType.PHONE_TYPE_WORK;
261261
break;
262262
default:
263263
print('Unknown phone type. Using default.');
@@ -312,13 +312,13 @@ void printAddressBook(AddressBook addressBook) {
312312
313313
for (Person_PhoneNumber phoneNumber in person.phones) {
314314
switch (phoneNumber.type) {
315-
case Person_PhoneType.MOBILE:
315+
case Person_PhoneType.PHONE_TYPE_MOBILE:
316316
print(' Mobile phone #: ');
317317
break;
318-
case Person_PhoneType.HOME:
318+
case Person_PhoneType.PHONE_TYPE_HOME:
319319
print(' Home phone #: ');
320320
break;
321-
case Person_PhoneType.WORK:
321+
case Person_PhoneType.PHONE_TYPE_WORK:
322322
print(' Work phone #: ');
323323
break;
324324
default:

content/getting-started/gotutorial.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ p := pb.Person{
232232
Name: "John Doe",
233233
234234
Phones: []*pb.Person_PhoneNumber{
235-
{Number: "555-4321", Type: pb.Person_HOME},
235+
{Number: "555-4321", Type: pb.Person_PHONE_TYPE_HOME},
236236
},
237237
}
238238
```

content/getting-started/javatutorial.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ message Person {
100100
101101
message PhoneNumber {
102102
optional string number = 1;
103-
optional PhoneType type = 2 [default = HOME];
103+
optional PhoneType type = 2 [default = PHONE_TYPE_HOME];
104104
}
105105
106106
repeated PhoneNumber phones = 4;
@@ -350,7 +350,7 @@ Person john =
350350
.addPhones(
351351
Person.PhoneNumber.newBuilder()
352352
.setNumber("555-4321")
353-
.setType(Person.PhoneType.HOME))
353+
.setType(Person.PhoneType.PHONE_TYPE_HOME))
354354
.build();
355355
```
356356
@@ -460,11 +460,11 @@ class AddPerson {
460460
stdout.print("Is this a mobile, home, or work phone? ");
461461
String type = stdin.readLine();
462462
if (type.equals("mobile")) {
463-
phoneNumber.setType(Person.PhoneType.MOBILE);
463+
phoneNumber.setType(Person.PhoneType.PHONE_TYPE_MOBILE);
464464
} else if (type.equals("home")) {
465-
phoneNumber.setType(Person.PhoneType.HOME);
465+
phoneNumber.setType(Person.PhoneType.PHONE_TYPE_HOME);
466466
} else if (type.equals("work")) {
467-
phoneNumber.setType(Person.PhoneType.WORK);
467+
phoneNumber.setType(Person.PhoneType.PHONE_TYPE_WORK);
468468
} else {
469469
stdout.println("Unknown phone type. Using default.");
470470
}
@@ -531,13 +531,13 @@ class ListPeople {
531531
532532
for (Person.PhoneNumber phoneNumber : person.getPhonesList()) {
533533
switch (phoneNumber.getType()) {
534-
case MOBILE:
534+
case PHONE_TYPE_MOBILE:
535535
System.out.print(" Mobile phone #: ");
536536
break;
537-
case HOME:
537+
case PHONE_TYPE_HOME:
538538
System.out.print(" Home phone #: ");
539539
break;
540-
case WORK:
540+
case PHONE_TYPE_WORK:
541541
System.out.print(" Work phone #: ");
542542
break;
543543
}

content/getting-started/kotlintutorial.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -262,12 +262,12 @@ fun promptPerson(): Person = person {
262262
263263
print("Is this a mobile, home, or work phone? ")
264264
val type = when (readLine()) {
265-
"mobile" -> Person.PhoneType.MOBILE
266-
"home" -> Person.PhoneType.HOME
267-
"work" -> Person.PhoneType.WORK
265+
"mobile" -> Person.PhoneType.PHONE_TYPE_MOBILE
266+
"home" -> Person.PhoneType.PHONE_TYPE_HOME
267+
"work" -> Person.PhoneType.PHONE_TYPE_WORK
268268
else -> {
269269
println("Unknown phone type. Using home.")
270-
Person.PhoneType.HOME
270+
Person.PhoneType.PHONE_TYPE_HOME
271271
}
272272
}
273273
phones += phoneNumber {
@@ -319,9 +319,9 @@ fun print(addressBook: AddressBook) {
319319
}
320320
for (phoneNumber in person.phonesList) {
321321
val modifier = when (phoneNumber.type) {
322-
Person.PhoneType.MOBILE -> "Mobile"
323-
Person.PhoneType.HOME -> "Home"
324-
Person.PhoneType.WORK -> "Work"
322+
Person.PhoneType.PHONE_TYPE_MOBILE -> "Mobile"
323+
Person.PhoneType.PHONE_TYPE_HOME -> "Home"
324+
Person.PhoneType.PHONE_TYPE_WORK -> "Work"
325325
else -> "Unknown"
326326
}
327327
println(" $modifier phone #: ${phoneNumber.number}")

content/getting-started/pythontutorial.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ message Person {
9494
9595
message PhoneNumber {
9696
optional string number = 1;
97-
optional PhoneType type = 2 [default = HOME];
97+
optional PhoneType type = 2 [default = PHONE_TYPE_HOME];
9898
}
9999
100100
repeated PhoneNumber phones = 4;
@@ -125,7 +125,7 @@ even define message types nested inside other messages -- as you can see, the
125125
`PhoneNumber` type is defined inside `Person`. You can also define `enum` types
126126
if you want one of your fields to have one of a predefined list of values --
127127
here you want to specify that a phone number can be one of the following phone
128-
types: `MOBILE`, `HOME`, or `WORK`.
128+
types: `PHONE_TYPE_MOBILE`, `PHONE_TYPE_HOME`, or `PHONE_TYPE_WORK`.
129129

130130
The " = 1", " = 2" markers on each element identify the unique "tag" that field
131131
uses in the binary encoding. Tag numbers 1-15 require one less byte to encode
@@ -240,7 +240,7 @@ person.name = "John Doe"
240240
person.email = "[email protected]"
241241
phone = person.phones.add()
242242
phone.number = "555-4321"
243-
phone.type = addressbook_pb2.Person.HOME
243+
phone.type = addressbook_pb2.Person.PHONE_TYPE_HOME
244244
```
245245

246246
Note that these assignments are not just adding arbitrary new fields to a
@@ -262,7 +262,7 @@ any particular field definition, see the
262262
263263
Enums are expanded by the metaclass into a set of symbolic constants with
264264
integer values. So, for example, the constant
265-
`addressbook_pb2.Person.PhoneType.WORK` has the value 2.
265+
`addressbook_pb2.Person.PhoneType.PHONE_TYPE_WORK` has the value 2.
266266
267267
### Standard Message Methods {#standard-message-methods}
268268
@@ -348,11 +348,11 @@ def PromptForAddress(person):
348348
349349
phone_type = input("Is this a mobile, home, or work phone? ")
350350
if phone_type == "mobile":
351-
phone_number.type = addressbook_pb2.Person.PhoneType.MOBILE
351+
phone_number.type = addressbook_pb2.Person.PhoneType.PHONE_TYPE_MOBILE
352352
elif phone_type == "home":
353-
phone_number.type = addressbook_pb2.Person.PhoneType.HOME
353+
phone_number.type = addressbook_pb2.Person.PhoneType.PHONE_TYPE_HOME
354354
elif phone_type == "work":
355-
phone_number.type = addressbook_pb2.Person.PhoneType.WORK
355+
phone_number.type = addressbook_pb2.Person.PhoneType.PHONE_TYPE_WORK
356356
else:
357357
print("Unknown phone type; leaving as default value.")
358358
@@ -401,11 +401,11 @@ def ListPeople(address_book):
401401
print(" E-mail address:", person.email)
402402
403403
for phone_number in person.phones:
404-
if phone_number.type == addressbook_pb2.Person.PhoneType.MOBILE:
404+
if phone_number.type == addressbook_pb2.Person.PhoneType.PHONE_TYPE_MOBILE:
405405
print(" Mobile phone #: ", end="")
406-
elif phone_number.type == addressbook_pb2.Person.PhoneType.HOME:
406+
elif phone_number.type == addressbook_pb2.Person.PhoneType.PHONE_TYPE_HOME:
407407
print(" Home phone #: ", end="")
408-
elif phone_number.type == addressbook_pb2.Person.PhoneType.WORK:
408+
elif phone_number.type == addressbook_pb2.Person.PhoneType.PHONE_TYPE_WORK:
409409
print(" Work phone #: ", end="")
410410
print(phone_number.number)
411411

content/news/2022-05-06.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
+++
22
title = "Changes announced May 6, 2022"
3-
weight = 27
43
linkTitle = "May 6, 2022"
54
toc_hide = "true"
65
description = "Changes announced for Protocol Buffers on May 6, 2022."

content/news/2022-07-06.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
+++
22
title = "Changes announced July 6, 2022"
3-
weight = 26
43
linkTitle = "July 6, 2022"
54
toc_hide = "true"
65
description = "Changes announced for Protocol Buffers on July 6, 2022."

0 commit comments

Comments
 (0)