• Home
  • Raw
  • Download

Lines Matching full:field

56 bool IsMapFieldInApi(const FieldDescriptor* field) {  in IsMapFieldInApi()  argument
57 return field->is_map(); in IsMapFieldInApi()
83 // a string field).
88 const Descriptor* descriptor, const FieldDescriptor* field, in ReportReflectionUsageError() argument
94 " Field : " << field->full_name() << "\n" in ReportReflectionUsageError()
113 const Descriptor* descriptor, const FieldDescriptor* field, in ReportReflectionUsageTypeError() argument
120 " Field : " << field->full_name() << "\n" in ReportReflectionUsageTypeError()
121 " Problem : Field is not the right type for this message:\n" in ReportReflectionUsageTypeError()
123 " Field type: " << cpptype_names_[field->cpp_type()]; in ReportReflectionUsageTypeError()
127 const Descriptor* descriptor, const FieldDescriptor* field, in ReportReflectionUsageEnumTypeError() argument
133 " Field : " << field->full_name() << "\n" in ReportReflectionUsageEnumTypeError()
134 " Problem : Enum value did not match field type:\n" in ReportReflectionUsageEnumTypeError()
135 " Expected : " << field->enum_type()->full_name() << "\n" in ReportReflectionUsageEnumTypeError()
141 ReportReflectionUsageError(descriptor_, field, #METHOD, ERROR_DESCRIPTION)
148 if (field->cpp_type() != FieldDescriptor::CPPTYPE_##CPPTYPE) \
149 ReportReflectionUsageTypeError(descriptor_, field, #METHOD, \
153 if (value->type() != field->enum_type()) \
154 ReportReflectionUsageEnumTypeError(descriptor_, field, #METHOD, value)
157 USAGE_CHECK_EQ(field->containing_type(), descriptor_, \
158 METHOD, "Field does not match message type.");
160 USAGE_CHECK_NE(field->label(), FieldDescriptor::LABEL_REPEATED, METHOD, \
161 "Field is repeated; the method requires a singular field.")
163 USAGE_CHECK_EQ(field->label(), FieldDescriptor::LABEL_REPEATED, METHOD, \
164 "Field is singular; the method requires a repeated field.")
279 // object_size_ already includes the in-memory representation of each field in SpaceUsed()
291 const FieldDescriptor* field = descriptor_->field(i); in SpaceUsed() local
293 if (field->is_repeated()) { in SpaceUsed()
294 switch (field->cpp_type()) { in SpaceUsed()
297 total_size += GetRaw<RepeatedField<LOWERCASE> >(message, field) \ in SpaceUsed()
312 switch (field->options().ctype()) { in SpaceUsed()
315 total_size += GetRaw<RepeatedPtrField<string> >(message, field) in SpaceUsed()
322 if (IsMapFieldInApi(field)) { in SpaceUsed()
324 GetRaw<MapFieldBase>(message, field).SpaceUsedExcludingSelf(); in SpaceUsed()
329 GetRaw<RepeatedPtrFieldBase>(message, field) in SpaceUsed()
336 if (field->containing_oneof() && !HasOneofField(message, field)) { in SpaceUsed()
339 switch (field->cpp_type()) { in SpaceUsed()
348 // Field is inline, so we've already counted it. in SpaceUsed()
352 switch (field->options().ctype()) { in SpaceUsed()
359 &DefaultRaw<ArenaStringPtr>(field).Get(NULL); in SpaceUsed()
361 &GetField<ArenaStringPtr>(message, field).Get(default_ptr); in SpaceUsed()
379 const Message* sub_message = GetRaw<const Message*>(message, field); in SpaceUsed()
395 const FieldDescriptor* field) const { in SwapField()
396 if (field->is_repeated()) { in SwapField()
397 switch (field->cpp_type()) { in SwapField()
400 MutableRaw<RepeatedField<TYPE> >(message1, field)->Swap( \ in SwapField()
401 MutableRaw<RepeatedField<TYPE> >(message2, field)); \ in SwapField()
415 switch (field->options().ctype()) { in SwapField()
418 MutableRaw<RepeatedPtrFieldBase>(message1, field)-> in SwapField()
420 MutableRaw<RepeatedPtrFieldBase>(message2, field)); in SwapField()
425 if (IsMapFieldInApi(field)) { in SwapField()
426 MutableRaw<MapFieldBase>(message1, field)-> in SwapField()
429 MutableRaw<MapFieldBase>(message2, field)-> in SwapField()
432 MutableRaw<RepeatedPtrFieldBase>(message1, field)-> in SwapField()
434 MutableRaw<RepeatedPtrFieldBase>(message2, field)); in SwapField()
439 GOOGLE_LOG(FATAL) << "Unimplemented type: " << field->cpp_type(); in SwapField()
442 switch (field->cpp_type()) { in SwapField()
445 std::swap(*MutableRaw<TYPE>(message1, field), \ in SwapField()
446 *MutableRaw<TYPE>(message2, field)); \ in SwapField()
460 std::swap(*MutableRaw<Message*>(message1, field), in SwapField()
461 *MutableRaw<Message*>(message2, field)); in SwapField()
463 Message** sub_msg1 = MutableRaw<Message*>(message1, field); in SwapField()
464 Message** sub_msg2 = MutableRaw<Message*>(message2, field); in SwapField()
473 ClearField(message2, field); in SwapField()
477 ClearField(message1, field); in SwapField()
483 switch (field->options().ctype()) { in SwapField()
490 MutableRaw<ArenaStringPtr>(message1, field); in SwapField()
492 MutableRaw<ArenaStringPtr>(message2, field); in SwapField()
497 &DefaultRaw<ArenaStringPtr>(field).Get(NULL); in SwapField()
508 GOOGLE_LOG(FATAL) << "Unimplemented type: " << field->cpp_type(); in SwapField()
531 // Stores message1's oneof field to a temp variable. in SwapOneofField()
535 //oneof_descriptor->field(oneof_case1); in SwapOneofField()
564 // Sets message1's oneof field from the message2's oneof field. in SwapOneofField()
600 // Sets message2's oneof field from the temp variable. in SwapOneofField()
680 const FieldDescriptor* field = descriptor_->field(i); in Swap() local
681 if (!field->containing_oneof()) { in Swap()
682 SwapField(message1, message2, field); in Swap()
722 const FieldDescriptor* field = fields[i]; in SwapFields() local
723 if (field->is_extension()) { in SwapFields()
726 field->number()); in SwapFields()
728 if (field->containing_oneof()) { in SwapFields()
729 int oneof_index = field->containing_oneof()->index(); in SwapFields()
730 // Only swap the oneof field once. in SwapFields()
735 SwapOneofField(message1, message2, field->containing_oneof()); in SwapFields()
738 SwapBit(message1, message2, field); in SwapFields()
739 // Swap field. in SwapFields()
740 SwapField(message1, message2, field); in SwapFields()
749 const FieldDescriptor* field) const { in HasField()
753 if (field->is_extension()) { in HasField()
754 return GetExtensionSet(message).Has(field->number()); in HasField()
756 if (field->containing_oneof()) { in HasField()
757 return HasOneofField(message, field); in HasField()
759 return HasBit(message, field); in HasField()
765 const FieldDescriptor* field) const { in FieldSize()
769 if (field->is_extension()) { in FieldSize()
770 return GetExtensionSet(message).ExtensionSize(field->number()); in FieldSize()
772 switch (field->cpp_type()) { in FieldSize()
775 return GetRaw<RepeatedField<LOWERCASE> >(message, field).size() in FieldSize()
789 if (IsMapFieldInApi(field)) { in FieldSize()
790 return GetRaw<MapFieldBase>(message, field).GetRepeatedField().size(); in FieldSize()
792 return GetRaw<RepeatedPtrFieldBase>(message, field).size(); in FieldSize()
802 Message* message, const FieldDescriptor* field) const { in ClearField()
805 if (field->is_extension()) { in ClearField()
806 MutableExtensionSet(message)->ClearExtension(field->number()); in ClearField()
807 } else if (!field->is_repeated()) { in ClearField()
808 if (field->containing_oneof()) { in ClearField()
809 ClearOneofField(message, field); in ClearField()
813 if (HasBit(*message, field)) { in ClearField()
814 ClearBit(message, field); in ClearField()
816 // We need to set the field back to its default value. in ClearField()
817 switch (field->cpp_type()) { in ClearField()
820 *MutableRaw<TYPE>(message, field) = \ in ClearField()
821 field->default_value_##TYPE(); \ in ClearField()
834 *MutableRaw<int>(message, field) = in ClearField()
835 field->default_value_enum()->number(); in ClearField()
839 switch (field->options().ctype()) { in ClearField()
843 &DefaultRaw<ArenaStringPtr>(field).Get(NULL); in ClearField()
844 MutableRaw<ArenaStringPtr>(message, field)->Destroy(default_ptr, in ClearField()
854 // Proto3 does not have has-bits and we need to set a message field in ClearField()
857 delete *MutableRaw<Message*>(message, field); in ClearField()
859 *MutableRaw<Message*>(message, field) = NULL; in ClearField()
861 (*MutableRaw<Message*>(message, field))->Clear(); in ClearField()
867 switch (field->cpp_type()) { in ClearField()
870 MutableRaw<RepeatedField<LOWERCASE> >(message, field)->Clear(); \ in ClearField()
884 switch (field->options().ctype()) { in ClearField()
887 MutableRaw<RepeatedPtrField<string> >(message, field)->Clear(); in ClearField()
894 if (IsMapFieldInApi(field)) { in ClearField()
895 MutableRaw<MapFieldBase>(message, field) in ClearField()
901 MutableRaw<RepeatedPtrFieldBase>(message, field) in ClearField()
912 const FieldDescriptor* field) const { in RemoveLast()
916 if (field->is_extension()) { in RemoveLast()
917 MutableExtensionSet(message)->RemoveLast(field->number()); in RemoveLast()
919 switch (field->cpp_type()) { in RemoveLast()
922 MutableRaw<RepeatedField<LOWERCASE> >(message, field)->RemoveLast(); \ in RemoveLast()
936 switch (field->options().ctype()) { in RemoveLast()
939 MutableRaw<RepeatedPtrField<string> >(message, field)->RemoveLast(); in RemoveLast()
945 if (IsMapFieldInApi(field)) { in RemoveLast()
946 MutableRaw<MapFieldBase>(message, field) in RemoveLast()
950 MutableRaw<RepeatedPtrFieldBase>(message, field) in RemoveLast()
960 const FieldDescriptor* field) const { in ReleaseLast()
963 if (field->is_extension()) { in ReleaseLast()
965 MutableExtensionSet(message)->ReleaseLast(field->number())); in ReleaseLast()
967 if (IsMapFieldInApi(field)) { in ReleaseLast()
968 return MutableRaw<MapFieldBase>(message, field) in ReleaseLast()
972 return MutableRaw<RepeatedPtrFieldBase>(message, field) in ReleaseLast()
980 const FieldDescriptor* field, in SwapElements() argument
986 if (field->is_extension()) { in SwapElements()
987 MutableExtensionSet(message)->SwapElements(field->number(), index1, index2); in SwapElements()
989 switch (field->cpp_type()) { in SwapElements()
992 MutableRaw<RepeatedField<LOWERCASE> >(message, field) \ in SwapElements()
1008 if (IsMapFieldInApi(field)) { in SwapElements()
1009 MutableRaw<MapFieldBase>(message, field) in SwapElements()
1013 MutableRaw<RepeatedPtrFieldBase>(message, field) in SwapElements()
1022 // Comparison functor for sorting FieldDescriptors by field number.
1041 const FieldDescriptor* field = descriptor_->field(i); in ListFields() local
1042 if (field->is_repeated()) { in ListFields()
1043 if (FieldSize(message, field) > 0) { in ListFields()
1044 output->push_back(field); in ListFields()
1047 if (field->containing_oneof()) { in ListFields()
1048 if (HasOneofField(message, field)) { in ListFields()
1049 output->push_back(field); in ListFields()
1051 } else if (HasBit(message, field)) { in ListFields()
1052 output->push_back(field); in ListFields()
1062 // ListFields() must sort output by field number. in ListFields()
1071 const Message& message, const FieldDescriptor* field) const { \
1073 if (field->is_extension()) { \
1075 field->number(), field->default_value_##PASSTYPE()); \
1077 return GetField<TYPE>(message, field); \
1082 Message* message, const FieldDescriptor* field, \
1085 if (field->is_extension()) { \
1087 field->number(), field->type(), value, field); \
1089 SetField<TYPE>(message, field, value); \
1095 const FieldDescriptor* field, int index) const { \
1097 if (field->is_extension()) { \
1099 field->number(), index); \
1101 return GetRepeatedField<TYPE>(message, field, index); \
1106 Message* message, const FieldDescriptor* field, \
1109 if (field->is_extension()) { \
1111 field->number(), index, value); \
1113 SetRepeatedField<TYPE>(message, field, index, value); \
1118 Message* message, const FieldDescriptor* field, \
1121 if (field->is_extension()) { \
1123 field->number(), field->type(), field->options().packed(), value, \
1124 field); \
1126 AddField<TYPE>(message, field, value); \
1142 const Message& message, const FieldDescriptor* field) const { in DEFINE_PRIMITIVE_ACCESSORS()
1144 if (field->is_extension()) { in DEFINE_PRIMITIVE_ACCESSORS()
1145 return GetExtensionSet(message).GetString(field->number(), in DEFINE_PRIMITIVE_ACCESSORS()
1146 field->default_value_string()); in DEFINE_PRIMITIVE_ACCESSORS()
1148 switch (field->options().ctype()) { in DEFINE_PRIMITIVE_ACCESSORS()
1152 &DefaultRaw<ArenaStringPtr>(field).Get(NULL); in DEFINE_PRIMITIVE_ACCESSORS()
1153 return GetField<ArenaStringPtr>(message, field).Get(default_ptr); in DEFINE_PRIMITIVE_ACCESSORS()
1164 const FieldDescriptor* field, string* scratch) const { in GetStringReference() argument
1166 if (field->is_extension()) { in GetStringReference()
1167 return GetExtensionSet(message).GetString(field->number(), in GetStringReference()
1168 field->default_value_string()); in GetStringReference()
1170 switch (field->options().ctype()) { in GetStringReference()
1174 &DefaultRaw<ArenaStringPtr>(field).Get(NULL); in GetStringReference()
1175 return GetField<ArenaStringPtr>(message, field).Get(default_ptr); in GetStringReference()
1186 Message* message, const FieldDescriptor* field, in SetString() argument
1189 if (field->is_extension()) { in SetString()
1190 return MutableExtensionSet(message)->SetString(field->number(), in SetString()
1191 field->type(), value, field); in SetString()
1193 switch (field->options().ctype()) { in SetString()
1197 &DefaultRaw<ArenaStringPtr>(field).Get(NULL); in SetString()
1198 if (field->containing_oneof() && !HasOneofField(*message, field)) { in SetString()
1199 ClearOneof(message, field->containing_oneof()); in SetString()
1200 MutableField<ArenaStringPtr>(message, field)->UnsafeSetDefault( in SetString()
1203 MutableField<ArenaStringPtr>(message, field)->Set(default_ptr, in SetString()
1213 const Message& message, const FieldDescriptor* field, int index) const { in GetRepeatedString() argument
1215 if (field->is_extension()) { in GetRepeatedString()
1216 return GetExtensionSet(message).GetRepeatedString(field->number(), index); in GetRepeatedString()
1218 switch (field->options().ctype()) { in GetRepeatedString()
1221 return GetRepeatedPtrField<string>(message, field, index); in GetRepeatedString()
1230 const Message& message, const FieldDescriptor* field, in GetRepeatedStringReference() argument
1233 if (field->is_extension()) { in GetRepeatedStringReference()
1234 return GetExtensionSet(message).GetRepeatedString(field->number(), index); in GetRepeatedStringReference()
1236 switch (field->options().ctype()) { in GetRepeatedStringReference()
1239 return GetRepeatedPtrField<string>(message, field, index); in GetRepeatedStringReference()
1249 Message* message, const FieldDescriptor* field, in SetRepeatedString() argument
1252 if (field->is_extension()) { in SetRepeatedString()
1254 field->number(), index, value); in SetRepeatedString()
1256 switch (field->options().ctype()) { in SetRepeatedString()
1259 *MutableRepeatedField<string>(message, field, index) = value; in SetRepeatedString()
1267 Message* message, const FieldDescriptor* field, in AddString() argument
1270 if (field->is_extension()) { in AddString()
1271 MutableExtensionSet(message)->AddString(field->number(), in AddString()
1272 field->type(), value, field); in AddString()
1274 switch (field->options().ctype()) { in AddString()
1277 *AddField<string>(message, field) = value; in AddString()
1291 const Message& message, const FieldDescriptor* field) const { in GetEnum()
1293 int value = GetEnumValue(message, field); in GetEnum()
1294 return field->enum_type()->FindValueByNumberCreatingIfUnknown(value); in GetEnum()
1298 const Message& message, const FieldDescriptor* field) const { in GetEnumValue()
1302 if (field->is_extension()) { in GetEnumValue()
1304 field->number(), field->default_value_enum()->number()); in GetEnumValue()
1306 value = GetField<int>(message, field); in GetEnumValue()
1312 Message* message, const FieldDescriptor* field, in SetEnum() argument
1316 SetEnumValueInternal(message, field, value->number()); in SetEnum()
1320 Message* message, const FieldDescriptor* field, in SetEnumValue() argument
1327 field->enum_type()->FindValueByNumber(value); in SetEnumValue()
1330 << value << " unexpected for field " << field->full_name(); in SetEnumValue()
1333 value = field->default_value_enum()->number(); in SetEnumValue()
1336 SetEnumValueInternal(message, field, value); in SetEnumValue()
1340 Message* message, const FieldDescriptor* field, in SetEnumValueInternal() argument
1342 if (field->is_extension()) { in SetEnumValueInternal()
1343 MutableExtensionSet(message)->SetEnum(field->number(), field->type(), in SetEnumValueInternal()
1344 value, field); in SetEnumValueInternal()
1346 SetField<int>(message, field, value); in SetEnumValueInternal()
1351 const Message& message, const FieldDescriptor* field, int index) const { in GetRepeatedEnum() argument
1353 int value = GetRepeatedEnumValue(message, field, index); in GetRepeatedEnum()
1354 return field->enum_type()->FindValueByNumberCreatingIfUnknown(value); in GetRepeatedEnum()
1358 const Message& message, const FieldDescriptor* field, int index) const { in GetRepeatedEnumValue() argument
1362 if (field->is_extension()) { in GetRepeatedEnumValue()
1363 value = GetExtensionSet(message).GetRepeatedEnum(field->number(), index); in GetRepeatedEnumValue()
1365 value = GetRepeatedField<int>(message, field, index); in GetRepeatedEnumValue()
1372 const FieldDescriptor* field, int index, in SetRepeatedEnum() argument
1376 SetRepeatedEnumValueInternal(message, field, index, value->number()); in SetRepeatedEnum()
1381 const FieldDescriptor* field, int index, in SetRepeatedEnumValue() argument
1388 field->enum_type()->FindValueByNumber(value); in SetRepeatedEnumValue()
1391 << "value " << value << " unexpected for field " in SetRepeatedEnumValue()
1392 << field->full_name(); in SetRepeatedEnumValue()
1395 value = field->default_value_enum()->number(); in SetRepeatedEnumValue()
1398 SetRepeatedEnumValueInternal(message, field, index, value); in SetRepeatedEnumValue()
1403 const FieldDescriptor* field, int index, in SetRepeatedEnumValueInternal() argument
1405 if (field->is_extension()) { in SetRepeatedEnumValueInternal()
1407 field->number(), index, value); in SetRepeatedEnumValueInternal()
1409 SetRepeatedField<int>(message, field, index, value); in SetRepeatedEnumValueInternal()
1414 Message* message, const FieldDescriptor* field, in AddEnum() argument
1418 AddEnumValueInternal(message, field, value->number()); in AddEnum()
1422 Message* message, const FieldDescriptor* field, in AddEnumValue() argument
1429 field->enum_type()->FindValueByNumber(value); in AddEnumValue()
1432 << value << " unexpected for field " << field->full_name(); in AddEnumValue()
1435 value = field->default_value_enum()->number(); in AddEnumValue()
1438 AddEnumValueInternal(message, field, value); in AddEnumValue()
1442 Message* message, const FieldDescriptor* field, in AddEnumValueInternal() argument
1444 if (field->is_extension()) { in AddEnumValueInternal()
1445 MutableExtensionSet(message)->AddEnum(field->number(), field->type(), in AddEnumValueInternal()
1446 field->options().packed(), in AddEnumValueInternal()
1447 value, field); in AddEnumValueInternal()
1449 AddField<int>(message, field, value); in AddEnumValueInternal()
1456 const Message& message, const FieldDescriptor* field, in GetMessage() argument
1462 if (field->is_extension()) { in GetMessage()
1465 field->number(), field->message_type(), factory)); in GetMessage()
1468 result = GetRaw<const Message*>(message, field); in GetMessage()
1470 result = DefaultRaw<const Message*>(field); in GetMessage()
1477 Message* message, const FieldDescriptor* field, in MutableMessage() argument
1483 if (field->is_extension()) { in MutableMessage()
1485 MutableExtensionSet(message)->MutableMessage(field, factory)); in MutableMessage()
1488 Message** result_holder = MutableRaw<Message*>(message, field); in MutableMessage()
1490 if (field->containing_oneof()) { in MutableMessage()
1491 if (!HasOneofField(*message, field)) { in MutableMessage()
1492 ClearOneof(message, field->containing_oneof()); in MutableMessage()
1493 result_holder = MutableField<Message*>(message, field); in MutableMessage()
1494 const Message* default_message = DefaultRaw<const Message*>(field); in MutableMessage()
1498 SetBit(message, field); in MutableMessage()
1502 const Message* default_message = DefaultRaw<const Message*>(field); in MutableMessage()
1513 const FieldDescriptor* field) const { in UnsafeArenaSetAllocatedMessage()
1516 if (field->is_extension()) { in UnsafeArenaSetAllocatedMessage()
1518 field->number(), field->type(), field, sub_message); in UnsafeArenaSetAllocatedMessage()
1520 if (field->containing_oneof()) { in UnsafeArenaSetAllocatedMessage()
1522 ClearOneof(message, field->containing_oneof()); in UnsafeArenaSetAllocatedMessage()
1525 ClearOneof(message, field->containing_oneof()); in UnsafeArenaSetAllocatedMessage()
1526 *MutableRaw<Message*>(message, field) = sub_message; in UnsafeArenaSetAllocatedMessage()
1527 SetOneofCase(message, field); in UnsafeArenaSetAllocatedMessage()
1532 ClearBit(message, field); in UnsafeArenaSetAllocatedMessage()
1534 SetBit(message, field); in UnsafeArenaSetAllocatedMessage()
1536 Message** sub_message_holder = MutableRaw<Message*>(message, field); in UnsafeArenaSetAllocatedMessage()
1547 const FieldDescriptor* field) const { in SetAllocatedMessage()
1558 UnsafeArenaSetAllocatedMessage(message, sub_message, field); in SetAllocatedMessage()
1563 Message* sub_message_copy = MutableMessage(message, field); in SetAllocatedMessage()
1568 UnsafeArenaSetAllocatedMessage(message, sub_message, field); in SetAllocatedMessage()
1574 const FieldDescriptor* field, in UnsafeArenaReleaseMessage() argument
1580 if (field->is_extension()) { in UnsafeArenaReleaseMessage()
1582 MutableExtensionSet(message)->ReleaseMessage(field, factory)); in UnsafeArenaReleaseMessage()
1584 ClearBit(message, field); in UnsafeArenaReleaseMessage()
1585 if (field->containing_oneof()) { in UnsafeArenaReleaseMessage()
1586 if (HasOneofField(*message, field)) { in UnsafeArenaReleaseMessage()
1587 *MutableOneofCase(message, field->containing_oneof()) = 0; in UnsafeArenaReleaseMessage()
1592 Message** result = MutableRaw<Message*>(message, field); in UnsafeArenaReleaseMessage()
1601 const FieldDescriptor* field, in ReleaseMessage() argument
1603 Message* released = UnsafeArenaReleaseMessage(message, field, factory); in ReleaseMessage()
1613 const Message& message, const FieldDescriptor* field, int index) const { in GetRepeatedMessage() argument
1616 if (field->is_extension()) { in GetRepeatedMessage()
1618 GetExtensionSet(message).GetRepeatedMessage(field->number(), index)); in GetRepeatedMessage()
1620 if (IsMapFieldInApi(field)) { in GetRepeatedMessage()
1621 return GetRaw<MapFieldBase>(message, field) in GetRepeatedMessage()
1625 return GetRaw<RepeatedPtrFieldBase>(message, field) in GetRepeatedMessage()
1632 Message* message, const FieldDescriptor* field, int index) const { in MutableRepeatedMessage() argument
1635 if (field->is_extension()) { in MutableRepeatedMessage()
1638 field->number(), index)); in MutableRepeatedMessage()
1640 if (IsMapFieldInApi(field)) { in MutableRepeatedMessage()
1641 return MutableRaw<MapFieldBase>(message, field) in MutableRepeatedMessage()
1645 return MutableRaw<RepeatedPtrFieldBase>(message, field) in MutableRepeatedMessage()
1652 Message* message, const FieldDescriptor* field, in AddMessage() argument
1658 if (field->is_extension()) { in AddMessage()
1660 MutableExtensionSet(message)->AddMessage(field, factory)); in AddMessage()
1667 if (IsMapFieldInApi(field)) { in AddMessage()
1669 MutableRaw<MapFieldBase>(message, field)->MutableRepeatedField(); in AddMessage()
1671 repeated = MutableRaw<RepeatedPtrFieldBase>(message, field); in AddMessage()
1678 prototype = factory->GetPrototype(field->message_type()); in AddMessage()
1694 Message* message, const FieldDescriptor* field, in AddAllocatedMessage() argument
1698 if (field->is_extension()) { in AddAllocatedMessage()
1699 MutableExtensionSet(message)->AddAllocatedMessage(field, new_entry); in AddAllocatedMessage()
1702 if (IsMapFieldInApi(field)) { in AddAllocatedMessage()
1704 MutableRaw<MapFieldBase>(message, field)->MutableRepeatedField(); in AddAllocatedMessage()
1706 repeated = MutableRaw<RepeatedPtrFieldBase>(message, field); in AddAllocatedMessage()
1713 Message* message, const FieldDescriptor* field, in MutableRawRepeatedField() argument
1717 if (field->cpp_type() != cpptype) in MutableRawRepeatedField()
1719 field, "MutableRawRepeatedField", cpptype); in MutableRawRepeatedField()
1721 GOOGLE_CHECK_EQ(field->options().ctype(), ctype) << "subtype mismatch"; in MutableRawRepeatedField()
1723 GOOGLE_CHECK_EQ(field->message_type(), desc) << "wrong submessage type"; in MutableRawRepeatedField()
1724 if (field->is_extension()) { in MutableRawRepeatedField()
1726 field->number(), field->type(), field->is_packed(), field); in MutableRawRepeatedField()
1729 if (IsMapFieldInApi(field)) { in MutableRawRepeatedField()
1731 offsets_[field->index()]) in MutableRawRepeatedField()
1734 return reinterpret_cast<uint8*>(message) + offsets_[field->index()]; in MutableRawRepeatedField()
1739 const Message& message, const FieldDescriptor* field, in GetRawRepeatedField() argument
1743 if (field->cpp_type() != cpptype) in GetRawRepeatedField()
1745 field, "GetRawRepeatedField", cpptype); in GetRawRepeatedField()
1747 GOOGLE_CHECK_EQ(field->options().ctype(), ctype) << "subtype mismatch"; in GetRawRepeatedField()
1749 GOOGLE_CHECK_EQ(field->message_type(), desc) << "wrong submessage type"; in GetRawRepeatedField()
1750 if (field->is_extension()) { in GetRawRepeatedField()
1757 field->number(), field->type(), field->is_packed(), field); in GetRawRepeatedField()
1760 if (IsMapFieldInApi(field)) { in GetRawRepeatedField()
1763 offsets_[field->index()])->GetRepeatedField()); in GetRawRepeatedField()
1765 return reinterpret_cast<const uint8*>(&message) + offsets_[field->index()]; in GetRawRepeatedField()
1781 const FieldDescriptor* field, in ContainsMapKey() argument
1783 USAGE_CHECK(IsMapFieldInApi(field), in ContainsMapKey()
1785 "Field is not a map field."); in ContainsMapKey()
1786 return GetRaw<MapFieldBase>(message, field).ContainsMapKey(key); in ContainsMapKey()
1791 const FieldDescriptor* field, in InsertOrLookupMapValue() argument
1794 USAGE_CHECK(IsMapFieldInApi(field), in InsertOrLookupMapValue()
1796 "Field is not a map field."); in InsertOrLookupMapValue()
1797 val->SetType(field->message_type()->FindFieldByName("value")->cpp_type()); in InsertOrLookupMapValue()
1798 return MutableRaw<MapFieldBase>(message, field)->InsertOrLookupMapValue( in InsertOrLookupMapValue()
1804 const FieldDescriptor* field, in DeleteMapValue() argument
1806 USAGE_CHECK(IsMapFieldInApi(field), in DeleteMapValue()
1808 "Field is not a map field."); in DeleteMapValue()
1809 return MutableRaw<MapFieldBase>(message, field)->DeleteMapValue(key); in DeleteMapValue()
1814 const FieldDescriptor* field) const { in MapBegin()
1815 USAGE_CHECK(IsMapFieldInApi(field), in MapBegin()
1817 "Field is not a map field."); in MapBegin()
1818 MapIterator iter(message, field); in MapBegin()
1819 GetRaw<MapFieldBase>(*message, field).MapBegin(&iter); in MapBegin()
1825 const FieldDescriptor* field) const { in MapEnd()
1826 USAGE_CHECK(IsMapFieldInApi(field), in MapEnd()
1828 "Field is not a map field."); in MapEnd()
1829 MapIterator iter(message, field); in MapEnd()
1830 GetRaw<MapFieldBase>(*message, field).MapEnd(&iter); in MapEnd()
1836 const FieldDescriptor* field) const { in MapSize()
1837 USAGE_CHECK(IsMapFieldInApi(field), in MapSize()
1839 "Field is not a map field."); in MapSize()
1840 return GetRaw<MapFieldBase>(message, field).size(); in MapSize()
1889 // the given field.
1892 const Message& message, const FieldDescriptor* field) const { in GetRaw()
1893 if (field->containing_oneof() && !HasOneofField(message, field)) { in GetRaw()
1894 return DefaultRaw<Type>(field); in GetRaw()
1896 int index = field->containing_oneof() ? in GetRaw()
1897 descriptor_->field_count() + field->containing_oneof()->index() : in GetRaw()
1898 field->index(); in GetRaw()
1906 Message* message, const FieldDescriptor* field) const { in MutableRaw()
1907 int index = field->containing_oneof() ? in MutableRaw()
1908 descriptor_->field_count() + field->containing_oneof()->index() : in MutableRaw()
1909 field->index(); in MutableRaw()
1916 const FieldDescriptor* field) const { in DefaultRaw()
1917 const void* ptr = field->containing_oneof() ? in DefaultRaw()
1919 offsets_[field->index()] : in DefaultRaw()
1921 offsets_[field->index()]; in DefaultRaw()
2013 const Message& message, const FieldDescriptor* field) const { in HasBit()
2016 // present only if their message-field pointer is non-NULL. in HasBit()
2017 if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { in HasBit()
2019 GetRaw<const Message*>(message, field) != NULL; in HasBit()
2021 // Non-message field (and non-oneof, since that was handled in HasField() in HasBit()
2023 // field must be a scalar. in HasBit()
2031 switch (field->cpp_type()) { in HasBit()
2033 switch (field->options().ctype()) { in HasBit()
2036 &DefaultRaw<ArenaStringPtr>(field).Get(NULL); in HasBit()
2037 return GetField<ArenaStringPtr>(message, field).Get( in HasBit()
2043 return GetRaw<bool>(message, field) != false; in HasBit()
2045 return GetRaw<int32>(message, field) != 0; in HasBit()
2047 return GetRaw<int64>(message, field) != 0; in HasBit()
2049 return GetRaw<uint32>(message, field) != 0; in HasBit()
2051 return GetRaw<uint64>(message, field) != 0; in HasBit()
2053 return GetRaw<float>(message, field) != 0.0; in HasBit()
2055 return GetRaw<double>(message, field) != 0.0; in HasBit()
2057 return GetRaw<int>(message, field) != 0; in HasBit()
2065 return GetHasBits(message)[field->index() / 32] & in HasBit()
2066 (1 << (field->index() % 32)); in HasBit()
2070 Message* message, const FieldDescriptor* field) const { in SetBit()
2074 MutableHasBits(message)[field->index() / 32] |= (1 << (field->index() % 32)); in SetBit()
2078 Message* message, const FieldDescriptor* field) const { in ClearBit()
2082 MutableHasBits(message)[field->index() / 32] &= ~(1 << (field->index() % 32)); in ClearBit()
2086 Message* message1, Message* message2, const FieldDescriptor* field) const { in SwapBit()
2090 bool temp_has_bit = HasBit(*message1, field); in SwapBit()
2091 if (HasBit(*message2, field)) { in SwapBit()
2092 SetBit(message1, field); in SwapBit()
2094 ClearBit(message1, field); in SwapBit()
2097 SetBit(message2, field); in SwapBit()
2099 ClearBit(message2, field); in SwapBit()
2109 const Message& message, const FieldDescriptor* field) const { in HasOneofField()
2110 return (GetOneofCase(message, field->containing_oneof()) == field->number()); in HasOneofField()
2114 Message* message, const FieldDescriptor* field) const { in SetOneofCase()
2115 *MutableOneofCase(message, field->containing_oneof()) = field->number(); in SetOneofCase()
2119 Message* message, const FieldDescriptor* field) const { in ClearOneofField()
2120 if (HasOneofField(*message, field)) { in ClearOneofField()
2121 ClearOneof(message, field->containing_oneof()); in ClearOneofField()
2132 const FieldDescriptor* field = descriptor_->FindFieldByNumber(oneof_case); in ClearOneof() local
2134 switch (field->cpp_type()) { in ClearOneof()
2136 switch (field->options().ctype()) { in ClearOneof()
2140 &DefaultRaw<ArenaStringPtr>(field).Get(NULL); in ClearOneof()
2141 MutableField<ArenaStringPtr>(message, field)-> in ClearOneof()
2150 delete *MutableRaw<Message*>(message, field); in ClearOneof()
2166 const Message& message, const FieldDescriptor* field) const { in GetField()
2167 return GetRaw<Type>(message, field); in GetField()
2172 Message* message, const FieldDescriptor* field, const Type& value) const { in SetField() argument
2173 if (field->containing_oneof() && !HasOneofField(*message, field)) { in SetField()
2174 ClearOneof(message, field->containing_oneof()); in SetField()
2176 *MutableRaw<Type>(message, field) = value; in SetField()
2177 field->containing_oneof() ? in SetField()
2178 SetOneofCase(message, field) : SetBit(message, field); in SetField()
2183 Message* message, const FieldDescriptor* field) const { in MutableField()
2184 field->containing_oneof() ? in MutableField()
2185 SetOneofCase(message, field) : SetBit(message, field); in MutableField()
2186 return MutableRaw<Type>(message, field); in MutableField()
2191 const Message& message, const FieldDescriptor* field, int index) const { in GetRepeatedField() argument
2192 return GetRaw<RepeatedField<Type> >(message, field).Get(index); in GetRepeatedField()
2197 const Message& message, const FieldDescriptor* field, int index) const { in GetRepeatedPtrField() argument
2198 return GetRaw<RepeatedPtrField<Type> >(message, field).Get(index); in GetRepeatedPtrField()
2203 Message* message, const FieldDescriptor* field, in SetRepeatedField() argument
2205 MutableRaw<RepeatedField<Type> >(message, field)->Set(index, value); in SetRepeatedField()
2210 Message* message, const FieldDescriptor* field, int index) const { in MutableRepeatedField() argument
2212 MutableRaw<RepeatedPtrField<Type> >(message, field); in MutableRepeatedField()
2218 Message* message, const FieldDescriptor* field, const Type& value) const { in AddField() argument
2219 MutableRaw<RepeatedField<Type> >(message, field)->Add(value); in AddField()
2224 Message* message, const FieldDescriptor* field) const { in AddField()
2226 MutableRaw<RepeatedPtrField<Type> >(message, field); in AddField()
2235 Message* message, const FieldDescriptor* field, in RepeatedFieldData() argument
2238 GOOGLE_CHECK(field->is_repeated()); in RepeatedFieldData()
2239 GOOGLE_CHECK(field->cpp_type() == cpp_type || in RepeatedFieldData()
2240 (field->cpp_type() == FieldDescriptor::CPPTYPE_ENUM && in RepeatedFieldData()
2243 << "the actual field type (for enums T should be the generated enum " in RepeatedFieldData()
2246 GOOGLE_CHECK_EQ(message_type, field->message_type()); in RepeatedFieldData()
2248 if (field->is_extension()) { in RepeatedFieldData()
2250 field->number(), field->type(), field->is_packed(), field); in RepeatedFieldData()
2252 return reinterpret_cast<uint8*>(message) + offsets_[field->index()]; in RepeatedFieldData()
2257 Message* message, const FieldDescriptor* field) const { in MapData()
2258 USAGE_CHECK(IsMapFieldInApi(field), in MapData()
2260 "Field is not a map field."); in MapData()
2261 return MutableRaw<MapFieldBase>(message, field); in MapData()