The Style Guide(https://developers.google.com/protocol-buffers/docs/style)
suggest that "The zero value enum should have the suffix UNSPECIFIED."
I followed this guide, build a proto, generated a client_type.pb.h in c++
language.
like this:
enum ClientType : int {
CLIENT_TYPE_UNSPECIFIED = 0,
CLIENT_TYPE_PHONE = 3,
CLIENT_TYPE_PAD = 6,
CLIENT_TYPE_PC = 9,
CLIENT_TYPE_LANDLINE = 12,
ClientType_INT_MIN_SENTINEL_DO_NOT_USE_ =
std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::min(),
ClientType_INT_MAX_SENTINEL_DO_NOT_USE_ =
std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::max()
};
bool ClientType_IsValid(int value);
constexpr ClientType ClientType_MIN = CLIENT_TYPE_UNSPECIFIED;
constexpr ClientType ClientType_MAX = CLIENT_TYPE_LANDLINE;
constexpr int ClientType_ARRAYSIZE = ClientType_MAX + 1;
But I can't use ClientType_IsValid to check this enum is valid I geted or
not.
Because CLIENT_TYPE_UNSPECIFIED is not valid.
Thankyou very much!
--
You received this message because you are subscribed to the Google Groups
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/protobuf/69eddd37-97d6-41f0-945e-b2e45e02c651%40googlegroups.com.