Initial import of v2.0.0beta
[protobuf.git] / src / google / protobuf / compiler / java / java_enum_field.h
blob473ba61731b93e9aa8091dce50b8b2f9e6cf3caf
1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc.
3 // http://code.google.com/p/protobuf/
4 //
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
8 //
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__
24 #include <map>
25 #include <string>
26 #include <google/protobuf/compiler/java/java_field.h>
28 namespace google {
29 namespace protobuf {
30 namespace compiler {
31 namespace java {
33 class EnumFieldGenerator : public FieldGenerator {
34 public:
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;
49 private:
50 const FieldDescriptor* descriptor_;
51 map<string, string> variables_;
53 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumFieldGenerator);
56 class RepeatedEnumFieldGenerator : public FieldGenerator {
57 public:
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;
72 private:
73 const FieldDescriptor* descriptor_;
74 map<string, string> variables_;
76 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedEnumFieldGenerator);
79 } // namespace java
80 } // namespace compiler
81 } // namespace protobuf
83 } // namespace google
84 #endif // GOOGLE_PROTOBUF_COMPILER_JAVA_ENUM_FIELD_H__