upb: Add upb_Message_GetExtensionMutableArray

PiperOrigin-RevId: 698010022
pull/19270/head
Hong Shin 4 months ago committed by Copybara-Service
parent 8aa3d35a37
commit cd837fd6bf
  1. 17
      csharp/src/Google.Protobuf/Reflection/FeatureSetDescriptor.g.cs
  2. 3
      upb/message/accessors.h
  3. 13
      upb/message/internal/accessors.h

@ -1,17 +0,0 @@
#region Copyright notice and license
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
#endregion
namespace Google.Protobuf.Reflection;
internal sealed partial class FeatureSetDescriptor
{
// Canonical serialized form of the edition defaults, generated by embed_edition_defaults.
private const string DefaultsBase64 =
"ChMYhAciACoMCAEQAhgCIAMoATACChMY5wciACoMCAIQARgBIAIoATABChMY6AciDAgBEAEYASACKAEwASoAIOYHKOgH";
}

@ -206,6 +206,9 @@ UPB_API_INLINE upb_Message* upb_Message_GetExtensionMessage(
UPB_API_INLINE const upb_Array* upb_Message_GetExtensionArray(
const upb_Message* msg, const upb_MiniTableExtension* f);
UPB_API_INLINE upb_Array* upb_Message_GetExtensionMutableArray(
upb_Message* msg, const upb_MiniTableExtension* f);
// Extension Setters ///////////////////////////////////////////////////////////
UPB_API_INLINE bool upb_Message_SetExtension(upb_Message* msg,

@ -1030,6 +1030,19 @@ UPB_API_INLINE const upb_Array* upb_Message_GetExtensionArray(
return ret;
}
UPB_API_INLINE upb_Array* upb_Message_GetExtensionMutableArray(
struct upb_Message* msg, const upb_MiniTableExtension* e) {
UPB_ASSERT(!upb_Message_IsFrozen(msg));
UPB_ASSUME(UPB_PRIVATE(_upb_MiniTableField_GetRep)(&e->UPB_PRIVATE(field)) ==
kUpb_FieldRep_NativePointer);
UPB_ASSUME(upb_MiniTableField_IsArray(&e->UPB_PRIVATE(field)));
UPB_ASSUME(e->UPB_PRIVATE(field).presence == 0);
upb_Array* ret;
upb_Array* default_val = NULL;
_upb_Message_GetExtensionField(msg, e, &default_val, &ret);
return ret;
}
#ifdef __cplusplus
} /* extern "C" */
#endif

Loading…
Cancel
Save