diff options
author | Max Cai <maxtroy@google.com> | 2013-09-20 18:29:40 +0100 |
---|---|---|
committer | Max Cai <maxtroy@google.com> | 2013-09-23 15:27:13 +0100 |
commit | b337f25628ceb3649df5c4e89b5125e7698a9b47 (patch) | |
tree | dd8dc893365bbe59b77a303e163e10532eaf6017 /src/google/protobuf/compiler/javanano/javanano_helpers.h | |
parent | ee4410d551c43d800e821ffd220cc69535fef19e (diff) |
Accessor style for optional fields.
This CL implements the 'optional_field_style=accessors' option.
All optional fields will now be 1 Java field and 1 bit in a shared
bitfield behind get/set/has/clear accessor methods. The setter
performs null check for reference types (Strings and byte[]s).
Also decentralized the clear code generation.
Change-Id: I60ac78329e352e76c2f8139fba1f292383080ad3
Diffstat (limited to 'src/google/protobuf/compiler/javanano/javanano_helpers.h')
-rw-r--r-- | src/google/protobuf/compiler/javanano/javanano_helpers.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/google/protobuf/compiler/javanano/javanano_helpers.h b/src/google/protobuf/compiler/javanano/javanano_helpers.h index 03fd4347..cddc0777 100644 --- a/src/google/protobuf/compiler/javanano/javanano_helpers.h +++ b/src/google/protobuf/compiler/javanano/javanano_helpers.h @@ -163,6 +163,11 @@ string GenerateSetBit(int bit_index); // Example: "bitField1_ = (bitField1_ & ~0x04)" string GenerateClearBit(int bit_index); +// Sets the 'get_*', 'set_*' and 'clear_*' variables, where * is the given bit +// field name, to the appropriate Java expressions for the given bit index. +void SetBitOperationVariables(const string name, + int bitIndex, map<string, string>* variables); + } // namespace javanano } // namespace compiler } // namespace protobuf |