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 // http://code.google.com/p/protobuf/ |
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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 GOOGLE_DCHECK(!iter->second.is_repeated); | 179 GOOGLE_DCHECK(!iter->second.is_repeated); |
180 return !iter->second.is_cleared; | 180 return !iter->second.is_cleared; |
181 } | 181 } |
182 | 182 |
183 int ExtensionSet::ExtensionSize(int number) const { | 183 int ExtensionSet::ExtensionSize(int number) const { |
184 map<int, Extension>::const_iterator iter = extensions_.find(number); | 184 map<int, Extension>::const_iterator iter = extensions_.find(number); |
185 if (iter == extensions_.end()) return false; | 185 if (iter == extensions_.end()) return false; |
186 return iter->second.GetSize(); | 186 return iter->second.GetSize(); |
187 } | 187 } |
188 | 188 |
| 189 FieldType ExtensionSet::ExtensionType(int number) const { |
| 190 map<int, Extension>::const_iterator iter = extensions_.find(number); |
| 191 if (iter == extensions_.end()) { |
| 192 GOOGLE_LOG(DFATAL) << "Don't lookup extension types if they aren't present (
1). "; |
| 193 return 0; |
| 194 } |
| 195 if (iter->second.is_cleared) { |
| 196 GOOGLE_LOG(DFATAL) << "Don't lookup extension types if they aren't present (
2). "; |
| 197 } |
| 198 return iter->second.type; |
| 199 } |
| 200 |
189 void ExtensionSet::ClearExtension(int number) { | 201 void ExtensionSet::ClearExtension(int number) { |
190 map<int, Extension>::iterator iter = extensions_.find(number); | 202 map<int, Extension>::iterator iter = extensions_.find(number); |
191 if (iter == extensions_.end()) return; | 203 if (iter == extensions_.end()) return; |
192 iter->second.Clear(); | 204 iter->second.Clear(); |
193 } | 205 } |
194 | 206 |
195 // =================================================================== | 207 // =================================================================== |
196 // Field accessors | 208 // Field accessors |
197 | 209 |
198 namespace { | 210 namespace { |
(...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1445 } | 1457 } |
1446 } | 1458 } |
1447 } | 1459 } |
1448 | 1460 |
1449 // Defined in extension_set_heavy.cc. | 1461 // Defined in extension_set_heavy.cc. |
1450 // int ExtensionSet::Extension::SpaceUsedExcludingSelf() const | 1462 // int ExtensionSet::Extension::SpaceUsedExcludingSelf() const |
1451 | 1463 |
1452 } // namespace internal | 1464 } // namespace internal |
1453 } // namespace protobuf | 1465 } // namespace protobuf |
1454 } // namespace google | 1466 } // namespace google |
OLD | NEW |