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 // http://code.google.com/p/protobuf/ | 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. |
11 // * Redistributions in binary form must reproduce the above | 11 // * Redistributions in binary form must reproduce the above |
12 // copyright notice, this list of conditions and the following disclaimer | 12 // copyright notice, this list of conditions and the following disclaimer |
13 // in the documentation and/or other materials provided with the | 13 // in the documentation and/or other materials provided with the |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 class PrimitiveFieldGenerator : public FieldGenerator { | 47 class PrimitiveFieldGenerator : public FieldGenerator { |
48 public: | 48 public: |
49 explicit PrimitiveFieldGenerator(const FieldDescriptor* descriptor, | 49 explicit PrimitiveFieldGenerator(const FieldDescriptor* descriptor, |
50 const Options& options); | 50 const Options& options); |
51 ~PrimitiveFieldGenerator(); | 51 ~PrimitiveFieldGenerator(); |
52 | 52 |
53 // implements FieldGenerator --------------------------------------- | 53 // implements FieldGenerator --------------------------------------- |
54 void GeneratePrivateMembers(io::Printer* printer) const; | 54 void GeneratePrivateMembers(io::Printer* printer) const; |
55 void GenerateAccessorDeclarations(io::Printer* printer) const; | 55 void GenerateAccessorDeclarations(io::Printer* printer) const; |
56 void GenerateInlineAccessorDefinitions(io::Printer* printer) const; | 56 void GenerateInlineAccessorDefinitions(io::Printer* printer, |
| 57 bool is_inline) const; |
57 void GenerateClearingCode(io::Printer* printer) const; | 58 void GenerateClearingCode(io::Printer* printer) const; |
58 void GenerateMergingCode(io::Printer* printer) const; | 59 void GenerateMergingCode(io::Printer* printer) const; |
59 void GenerateSwappingCode(io::Printer* printer) const; | 60 void GenerateSwappingCode(io::Printer* printer) const; |
60 void GenerateConstructorCode(io::Printer* printer) const; | 61 void GenerateConstructorCode(io::Printer* printer) const; |
61 void GenerateMergeFromCodedStream(io::Printer* printer) const; | 62 void GenerateMergeFromCodedStream(io::Printer* printer) const; |
62 void GenerateSerializeWithCachedSizes(io::Printer* printer) const; | 63 void GenerateSerializeWithCachedSizes(io::Printer* printer) const; |
63 void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; | 64 void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; |
64 void GenerateByteSize(io::Printer* printer) const; | 65 void GenerateByteSize(io::Printer* printer) const; |
65 | 66 |
66 private: | 67 protected: |
67 const FieldDescriptor* descriptor_; | 68 const FieldDescriptor* descriptor_; |
68 map<string, string> variables_; | 69 map<string, string> variables_; |
69 | 70 |
| 71 private: |
70 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PrimitiveFieldGenerator); | 72 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PrimitiveFieldGenerator); |
71 }; | 73 }; |
72 | 74 |
| 75 class PrimitiveOneofFieldGenerator : public PrimitiveFieldGenerator { |
| 76 public: |
| 77 explicit PrimitiveOneofFieldGenerator(const FieldDescriptor* descriptor, |
| 78 const Options& options); |
| 79 ~PrimitiveOneofFieldGenerator(); |
| 80 |
| 81 // implements FieldGenerator --------------------------------------- |
| 82 void GenerateInlineAccessorDefinitions(io::Printer* printer, |
| 83 bool is_inline) const; |
| 84 void GenerateClearingCode(io::Printer* printer) const; |
| 85 void GenerateSwappingCode(io::Printer* printer) const; |
| 86 void GenerateConstructorCode(io::Printer* printer) const; |
| 87 void GenerateMergeFromCodedStream(io::Printer* printer) const; |
| 88 |
| 89 private: |
| 90 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PrimitiveOneofFieldGenerator); |
| 91 }; |
| 92 |
73 class RepeatedPrimitiveFieldGenerator : public FieldGenerator { | 93 class RepeatedPrimitiveFieldGenerator : public FieldGenerator { |
74 public: | 94 public: |
75 explicit RepeatedPrimitiveFieldGenerator(const FieldDescriptor* descriptor, | 95 explicit RepeatedPrimitiveFieldGenerator(const FieldDescriptor* descriptor, |
76 const Options& options); | 96 const Options& options); |
77 ~RepeatedPrimitiveFieldGenerator(); | 97 ~RepeatedPrimitiveFieldGenerator(); |
78 | 98 |
79 // implements FieldGenerator --------------------------------------- | 99 // implements FieldGenerator --------------------------------------- |
80 void GeneratePrivateMembers(io::Printer* printer) const; | 100 void GeneratePrivateMembers(io::Printer* printer) const; |
81 void GenerateAccessorDeclarations(io::Printer* printer) const; | 101 void GenerateAccessorDeclarations(io::Printer* printer) const; |
82 void GenerateInlineAccessorDefinitions(io::Printer* printer) const; | 102 void GenerateInlineAccessorDefinitions(io::Printer* printer, |
| 103 bool is_inline) const; |
83 void GenerateClearingCode(io::Printer* printer) const; | 104 void GenerateClearingCode(io::Printer* printer) const; |
84 void GenerateMergingCode(io::Printer* printer) const; | 105 void GenerateMergingCode(io::Printer* printer) const; |
85 void GenerateSwappingCode(io::Printer* printer) const; | 106 void GenerateSwappingCode(io::Printer* printer) const; |
86 void GenerateConstructorCode(io::Printer* printer) const; | 107 void GenerateConstructorCode(io::Printer* printer) const; |
87 void GenerateMergeFromCodedStream(io::Printer* printer) const; | 108 void GenerateMergeFromCodedStream(io::Printer* printer) const; |
88 void GenerateMergeFromCodedStreamWithPacking(io::Printer* printer) const; | 109 void GenerateMergeFromCodedStreamWithPacking(io::Printer* printer) const; |
89 void GenerateSerializeWithCachedSizes(io::Printer* printer) const; | 110 void GenerateSerializeWithCachedSizes(io::Printer* printer) const; |
90 void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; | 111 void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const; |
91 void GenerateByteSize(io::Printer* printer) const; | 112 void GenerateByteSize(io::Printer* printer) const; |
92 | 113 |
93 private: | 114 private: |
94 const FieldDescriptor* descriptor_; | 115 const FieldDescriptor* descriptor_; |
95 map<string, string> variables_; | 116 map<string, string> variables_; |
96 | 117 |
97 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedPrimitiveFieldGenerator); | 118 GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedPrimitiveFieldGenerator); |
98 }; | 119 }; |
99 | 120 |
100 } // namespace cpp | 121 } // namespace cpp |
101 } // namespace compiler | 122 } // namespace compiler |
102 } // namespace protobuf | 123 } // namespace protobuf |
103 | 124 |
104 } // namespace google | 125 } // namespace google |
105 #endif // GOOGLE_PROTOBUF_COMPILER_CPP_PRIMITIVE_FIELD_H__ | 126 #endif // GOOGLE_PROTOBUF_COMPILER_CPP_PRIMITIVE_FIELD_H__ |
OLD | NEW |