~ubuntu-branches/ubuntu/oneiric/protobuf/oneiric

« back to all changes in this revision

Viewing changes to src/google/protobuf/compiler/java/java_enum_field.h

  • Committer: Bazaar Package Importer
  • Author(s): Iustin Pop
  • Date: 2008-08-03 11:01:44 UTC
  • Revision ID: james.westby@ubuntu.com-20080803110144-uyiw41bf1m2oe17t
Tags: upstream-2.0.0~b
ImportĀ upstreamĀ versionĀ 2.0.0~b

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
10
//
 
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.
 
16
 
 
17
// Author: kenton@google.com (Kenton Varda)
 
18
//  Based on original Protocol Buffers design by
 
19
//  Sanjay Ghemawat, Jeff Dean, and others.
 
20
 
 
21
#ifndef GOOGLE_PROTOBUF_COMPILER_JAVA_ENUM_FIELD_H__
 
22
#define GOOGLE_PROTOBUF_COMPILER_JAVA_ENUM_FIELD_H__
 
23
 
 
24
#include <map>
 
25
#include <string>
 
26
#include <google/protobuf/compiler/java/java_field.h>
 
27
 
 
28
namespace google {
 
29
namespace protobuf {
 
30
namespace compiler {
 
31
namespace java {
 
32
 
 
33
class EnumFieldGenerator : public FieldGenerator {
 
34
 public:
 
35
  explicit EnumFieldGenerator(const FieldDescriptor* descriptor);
 
36
  ~EnumFieldGenerator();
 
37
 
 
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;
 
46
 
 
47
  string GetBoxedType() const;
 
48
 
 
49
 private:
 
50
  const FieldDescriptor* descriptor_;
 
51
  map<string, string> variables_;
 
52
 
 
53
  GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumFieldGenerator);
 
54
};
 
55
 
 
56
class RepeatedEnumFieldGenerator : public FieldGenerator {
 
57
 public:
 
58
  explicit RepeatedEnumFieldGenerator(const FieldDescriptor* descriptor);
 
59
  ~RepeatedEnumFieldGenerator();
 
60
 
 
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;
 
69
 
 
70
  string GetBoxedType() const;
 
71
 
 
72
 private:
 
73
  const FieldDescriptor* descriptor_;
 
74
  map<string, string> variables_;
 
75
 
 
76
  GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedEnumFieldGenerator);
 
77
};
 
78
 
 
79
}  // namespace java
 
80
}  // namespace compiler
 
81
}  // namespace protobuf
 
82
 
 
83
}  // namespace google
 
84
#endif  // GOOGLE_PROTOBUF_COMPILER_JAVA_ENUM_FIELD_H__