aboutsummaryrefslogtreecommitdiff
path: root/examples/list_people.cc
diff options
context:
space:
mode:
authorJan Tattermusch <jtattermusch@users.noreply.github.com>2015-07-20 18:54:27 -0700
committerJan Tattermusch <jtattermusch@users.noreply.github.com>2015-07-20 18:54:27 -0700
commit353b7a99857442c7c64a56111b3910b63237ccc8 (patch)
tree380bd5259a5bf1cb7ab4c22931402881275def4d /examples/list_people.cc
parentd119a275495b7dcc9c389c9c650ebd83de265511 (diff)
parentb0e5ba697eb281b4ea9e53e1dc9f5ebeccf28f9a (diff)
downloadprotobuf-353b7a99857442c7c64a56111b3910b63237ccc8.tar.gz
protobuf-353b7a99857442c7c64a56111b3910b63237ccc8.tar.bz2
protobuf-353b7a99857442c7c64a56111b3910b63237ccc8.zip
Merge pull request #627 from jtattermusch/addressbook_proto3
Update addressbook.proto and examples code to proto3
Diffstat (limited to 'examples/list_people.cc')
-rw-r--r--examples/list_people.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/examples/list_people.cc b/examples/list_people.cc
index 5363152e..68e5666d 100644
--- a/examples/list_people.cc
+++ b/examples/list_people.cc
@@ -8,17 +8,17 @@ using namespace std;
// Iterates though all people in the AddressBook and prints info about them.
void ListPeople(const tutorial::AddressBook& address_book) {
- for (int i = 0; i < address_book.person_size(); i++) {
- const tutorial::Person& person = address_book.person(i);
+ for (int i = 0; i < address_book.people_size(); i++) {
+ const tutorial::Person& person = address_book.people(i);
cout << "Person ID: " << person.id() << endl;
cout << " Name: " << person.name() << endl;
- if (person.has_email()) {
+ if (person.email() != "") {
cout << " E-mail address: " << person.email() << endl;
}
- for (int j = 0; j < person.phone_size(); j++) {
- const tutorial::Person::PhoneNumber& phone_number = person.phone(j);
+ for (int j = 0; j < person.phones_size(); j++) {
+ const tutorial::Person::PhoneNumber& phone_number = person.phones(j);
switch (phone_number.type()) {
case tutorial::Person::MOBILE: