1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc.
3 // http://code.google.com/p/protobuf/
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
17 // Author: kenton@google.com (Kenton Varda)
18 // Based on original Protocol Buffers design by
19 // Sanjay Ghemawat, Jeff Dean, and others.
21 #ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_ENUM_FIELD_H__
22 #define GOOGLE_PROTOBUF_COMPILER_JAVA_ENUM_FIELD_H__
26 #include <google/protobuf/compiler/java/java_field.h>
33 class EnumFieldGenerator
: public FieldGenerator
{
35 explicit EnumFieldGenerator(const FieldDescriptor
* descriptor
);
36 ~EnumFieldGenerator();
38 // implements FieldGenerator ---------------------------------------
39 void GenerateMembers(io::Printer
* printer
) const;
40 void GenerateBuilderMembers(io::Printer
* printer
) const;
41 void GenerateMergingCode(io::Printer
* printer
) const;
42 void GenerateBuildingCode(io::Printer
* printer
) const;
43 void GenerateParsingCode(io::Printer
* printer
) const;
44 void GenerateSerializationCode(io::Printer
* printer
) const;
45 void GenerateSerializedSizeCode(io::Printer
* printer
) const;
47 string
GetBoxedType() const;
50 const FieldDescriptor
* descriptor_
;
51 map
<string
, string
> variables_
;
53 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumFieldGenerator
);
56 class RepeatedEnumFieldGenerator
: public FieldGenerator
{
58 explicit RepeatedEnumFieldGenerator(const FieldDescriptor
* descriptor
);
59 ~RepeatedEnumFieldGenerator();
61 // implements FieldGenerator ---------------------------------------
62 void GenerateMembers(io::Printer
* printer
) const;
63 void GenerateBuilderMembers(io::Printer
* printer
) const;
64 void GenerateMergingCode(io::Printer
* printer
) const;
65 void GenerateBuildingCode(io::Printer
* printer
) const;
66 void GenerateParsingCode(io::Printer
* printer
) const;
67 void GenerateSerializationCode(io::Printer
* printer
) const;
68 void GenerateSerializedSizeCode(io::Printer
* printer
) const;
70 string
GetBoxedType() const;
73 const FieldDescriptor
* descriptor_
;
74 map
<string
, string
> variables_
;
76 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedEnumFieldGenerator
);
80 } // namespace compiler
81 } // namespace protobuf
84 #endif // GOOGLE_PROTOBUF_COMPILER_JAVA_ENUM_FIELD_H__