diff options
author | Jan Tattermusch <jtattermusch@google.com> | 2015-07-20 14:33:36 -0700 |
---|---|---|
committer | Jan Tattermusch <jtattermusch@google.com> | 2015-07-20 14:33:36 -0700 |
commit | 78709f20fb7255c3209e7126f404935bcf73e8dc (patch) | |
tree | 45b58101da0ce11295623da4c2e072e077011640 /examples/list_people.cc | |
parent | 69c14071ad58b1dad9e5e52c33140ece139577d0 (diff) | |
download | protobuf-78709f20fb7255c3209e7126f404935bcf73e8dc.tar.gz protobuf-78709f20fb7255c3209e7126f404935bcf73e8dc.tar.bz2 protobuf-78709f20fb7255c3209e7126f404935bcf73e8dc.zip |
fix C++ example
Diffstat (limited to 'examples/list_people.cc')
-rw-r--r-- | examples/list_people.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/examples/list_people.cc b/examples/list_people.cc index 5363152e..3daa3159 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.persons_size(); i++) { + const tutorial::Person& person = address_book.persons(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: |