OLD | NEW |
1 // Protocol Buffers - Google's data interchange format | 1 // Protocol Buffers - Google's data interchange format |
2 // Copyright 2008 Google Inc. All rights reserved. | 2 // Copyright 2008 Google Inc. All rights reserved. |
3 // https://developers.google.com/protocol-buffers/ | 3 // https://developers.google.com/protocol-buffers/ |
4 // | 4 // |
5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
7 // met: | 7 // met: |
8 // | 8 // |
9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
(...skipping 28 matching lines...) Expand all Loading... |
39 #include <string> | 39 #include <string> |
40 #include <google/protobuf/compiler/cpp/cpp_field.h> | 40 #include <google/protobuf/compiler/cpp/cpp_field.h> |
41 | 41 |
42 namespace google { | 42 namespace google { |
43 namespace protobuf { | 43 namespace protobuf { |
44 namespace compiler { | 44 namespace compiler { |
45 namespace cpp { | 45 namespace cpp { |
46 | 46 |
47 class EnumFieldGenerator : public FieldGenerator { | 47 class EnumFieldGenerator : public FieldGenerator { |
48 public: | 48 public: |
49 explicit EnumFieldGenerator(const FieldDescriptor* descriptor, | 49 EnumFieldGenerator(const FieldDescriptor* descriptor, const Options& options); |
50 const Options& options); | |
51 ~EnumFieldGenerator(); | 50 ~EnumFieldGenerator(); |
52 | 51 |
53 // implements FieldGenerator --------------------------------------- | 52 // implements FieldGenerator --------------------------------------- |
54 void GeneratePrivateMembers(io::Printer* printer) const; | 53 void GeneratePrivateMembers(io::Printer* printer) const; |
55 void GenerateAccessorDeclarations(io::Printer* printer) const; | 54 void GenerateAccessorDeclarations(io::Printer* printer) const; |
56 void GenerateInlineAccessorDefinitions(io::Printer* printer, | 55 void GenerateInlineAccessorDefinitions(io::Printer* printer, |
57 bool is_inline) const; | 56 bool is_inline) const; |
58 void GenerateClearingCode(io::Printer* printer) const; | 57 void GenerateClearingCode(io::Printer* printer) const; |
59 void GenerateMergingCode(io::Printer* printer) const; | 58 void GenerateMergingCode(io::Printer* printer) const; |
60 void GenerateSwappingCode(io::Printer* printer) const; | 59 void GenerateSwappingCode(io::Printer* printer) const; |
61 void GenerateConstructorCode(io::Printer* printer) const; | 60 void GenerateConstructorCode(io::Printer* printer) const; |
62 void GenerateMergeFromCodedStream(io::Printer* printer) const; | 61 void GenerateMergeFromCodedStream(io::Printer* printer) const; |
63 void GenerateSerializeWithCachedSizes(io::Printer* printer) const; | 62 void GenerateSerializeWithCachedSizes(io::Printer* printer) const; |
64 void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; | 63 void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; |
65 void GenerateByteSize(io::Printer* printer) const; | 64 void GenerateByteSize(io::Printer* printer) const; |
66 | 65 |
67 protected: | 66 protected: |
68 const FieldDescriptor* descriptor_; | 67 const FieldDescriptor* descriptor_; |
69 map<string, string> variables_; | 68 map<string, string> variables_; |
70 | 69 |
71 private: | 70 private: |
72 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumFieldGenerator); | 71 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumFieldGenerator); |
73 }; | 72 }; |
74 | 73 |
75 class EnumOneofFieldGenerator : public EnumFieldGenerator { | 74 class EnumOneofFieldGenerator : public EnumFieldGenerator { |
76 public: | 75 public: |
77 explicit EnumOneofFieldGenerator(const FieldDescriptor* descriptor, | 76 EnumOneofFieldGenerator(const FieldDescriptor* descriptor, |
78 const Options& options); | 77 const Options& options); |
79 ~EnumOneofFieldGenerator(); | 78 ~EnumOneofFieldGenerator(); |
80 | 79 |
81 // implements FieldGenerator --------------------------------------- | 80 // implements FieldGenerator --------------------------------------- |
82 void GenerateInlineAccessorDefinitions(io::Printer* printer, | 81 void GenerateInlineAccessorDefinitions(io::Printer* printer, |
83 bool is_inline) const; | 82 bool is_inline) const; |
84 void GenerateClearingCode(io::Printer* printer) const; | 83 void GenerateClearingCode(io::Printer* printer) const; |
85 void GenerateSwappingCode(io::Printer* printer) const; | 84 void GenerateSwappingCode(io::Printer* printer) const; |
86 void GenerateConstructorCode(io::Printer* printer) const; | 85 void GenerateConstructorCode(io::Printer* printer) const; |
87 | 86 |
88 private: | 87 private: |
89 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumOneofFieldGenerator); | 88 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumOneofFieldGenerator); |
90 }; | 89 }; |
91 | 90 |
92 class RepeatedEnumFieldGenerator : public FieldGenerator { | 91 class RepeatedEnumFieldGenerator : public FieldGenerator { |
93 public: | 92 public: |
94 explicit RepeatedEnumFieldGenerator(const FieldDescriptor* descriptor, | 93 RepeatedEnumFieldGenerator(const FieldDescriptor* descriptor, |
95 const Options& options); | 94 const Options& options); |
96 ~RepeatedEnumFieldGenerator(); | 95 ~RepeatedEnumFieldGenerator(); |
97 | 96 |
98 // implements FieldGenerator --------------------------------------- | 97 // implements FieldGenerator --------------------------------------- |
99 void GeneratePrivateMembers(io::Printer* printer) const; | 98 void GeneratePrivateMembers(io::Printer* printer) const; |
100 void GenerateAccessorDeclarations(io::Printer* printer) const; | 99 void GenerateAccessorDeclarations(io::Printer* printer) const; |
101 void GenerateInlineAccessorDefinitions(io::Printer* printer, | 100 void GenerateInlineAccessorDefinitions(io::Printer* printer, |
102 bool is_inline) const; | 101 bool is_inline) const; |
103 void GenerateClearingCode(io::Printer* printer) const; | 102 void GenerateClearingCode(io::Printer* printer) const; |
104 void GenerateMergingCode(io::Printer* printer) const; | 103 void GenerateMergingCode(io::Printer* printer) const; |
105 void GenerateSwappingCode(io::Printer* printer) const; | 104 void GenerateSwappingCode(io::Printer* printer) const; |
(...skipping 10 matching lines...) Expand all Loading... |
116 | 115 |
117 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedEnumFieldGenerator); | 116 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedEnumFieldGenerator); |
118 }; | 117 }; |
119 | 118 |
120 } // namespace cpp | 119 } // namespace cpp |
121 } // namespace compiler | 120 } // namespace compiler |
122 } // namespace protobuf | 121 } // namespace protobuf |
123 | 122 |
124 } // namespace google | 123 } // namespace google |
125 #endif // GOOGLE_PROTOBUF_COMPILER_CPP_ENUM_FIELD_H__ | 124 #endif // GOOGLE_PROTOBUF_COMPILER_CPP_ENUM_FIELD_H__ |
OLD | NEW |