**Hi All,
I am new to the protobuf. I am trying to understand the basics here.
I have created the sample proto file as Test.proto
in directory /path/to/Directory/
:
syntax = "proto2";
message Person {
required string name = 1;
required int32 id = 2;
optional string email = 3;
enum PhoneType {
MOBILE = 0;
HOME = 1;
WORK = 2;
}**
message PhoneNumber {
required string number = 1;
optional PhoneType type = 2 [default = HOME];
}
repeated PhoneNumber phone = 4;
}
and compiled it with
protoc -I=/path/to/Directory/ --cpp_out=/path/to/Directory/ /path/to/Directory/Test.proto
This created 2 files Test.pb.h
and Test.pb.cc
. Now I can see that there are different functions in the class Person
. Let's just take the function (derived from the line required string name = 1;
of Test.proto
file)
Now the compiler does it's thing and gives these various functions:
bool has_name() const;
void clear_name();
static const int kNameFieldNumber = 1;
const ::std::string& name() const;
void set_name(const ::std::string& value);
void set_name(::std::string&& value);
void set_name(const char* value);
void set_name(const char* value, size_t size);
::std::string* mutable_name();
::std::string* release_name();
void set_allocated_name(::std::string* name);
Now my question is: Where can I find the descriptions of each functions and what they do?