Go to the documentation of this file.
53 rb_gc_mark(
self->type_class);
54 rb_gc_mark(
self->arena);
58 "Google::Protobuf::RepeatedField",
60 .flags = RUBY_TYPED_FREE_IMMEDIATELY,
70 rb_check_frozen(_self);
77 self->type_class = Qnil;
94 self->type_info = type_info;
119 for (
size_t i = 0;
i <
n;
i++) {
134 VALUE arena_rb = new_self->
arena;
142 for (
size_t i = 0;
i <
size;
i++) {
156 if (!RB_TYPE_P(val, T_DATA) || !RTYPEDDATA_P(val) ||
158 rb_raise(
cTypeError,
"Expected repeated field array");
162 if (
self->type_info.type != type_info.
type) {
163 rb_raise(
cTypeError,
"Repeated field array has wrong element type");
167 rb_raise(
cTypeError,
"Repeated field array has wrong message/enum class");
175 int index = NUM2INT(_index);
182 VALUE ary = rb_ary_new2(
size);
185 for (
i = beg;
i < beg +
len;
i++) {
188 rb_ary_push(ary,
elem);
240 switch (rb_range_beg_len(
arg, &beg, &
len,
size, 0)) {
252 beg = NUM2LONG(argv[0]);
253 len = NUM2LONG(argv[1]);
278 if (index < 0 || index >= (INT_MAX - 1)) {
309 for (
i = 0;
i < argc;
i++) {
366 Check_Type(list, T_ARRAY);
369 for (
i = 0;
i < RARRAY_LEN(list);
i++) {
436 VALUE ary = rb_ary_new2(
size);
442 rb_ary_push(ary, val);
465 if (_self == _other) {
469 if (
TYPE(_other) == T_ARRAY) {
471 return rb_equal(self_ary, _other);
484 for (
size_t i = 0;
i <
n;
i++) {
504 if (!RB_OBJ_FROZEN(_self)) {
506 RB_OBJ_FREEZE(_self);
522 for (
size_t i = 0;
i <
n;
i++) {
541 if (
TYPE(list) == T_ARRAY) {
543 for (
i = 0;
i < RARRAY_LEN(list);
i++) {
544 VALUE
elem = rb_ary_entry(list,
i);
547 }
else if (RB_TYPE_P(list, T_DATA) && RTYPEDDATA_P(list) &&
560 rb_raise(rb_eArgError,
561 "Attempt to append RepeatedField with different element type.");
569 rb_raise(rb_eArgError,
"Unknown type appending to RepeatedField");
584 Check_Type(list, T_ARRAY);
585 for (
i = 0;
i < RARRAY_LEN(list);
i++) {
611 rb_raise(rb_eArgError,
"Expected at least 1 argument.");
619 if (!RB_TYPE_P(ary, T_ARRAY)) {
620 rb_raise(rb_eArgError,
"Expected array as initialize argument");
622 for (
int i = 0;
i < RARRAY_LEN(ary);
i++) {
630 VALUE
klass = rb_define_class_under(
631 module,
"RepeatedField", rb_cObject);
636 rb_define_method(
klass,
"initialize",
658 rb_include_module(
klass, rb_mEnumerable);
static VALUE RepeatedField_subarray(RepeatedField *self, long beg, long len)
VALUE RepeatedField_alloc(VALUE klass)
upb_msgval Convert_RubyToUpb(VALUE value, const char *name, TypeInfo type_info, upb_arena *arena)
VALUE Convert_UpbToRuby(upb_msgval upb_val, TypeInfo type_info, VALUE arena)
return memset(p, 0, total)
static int copy(grpc_slice_buffer *input, grpc_slice_buffer *output)
PHP_PROTO_OBJECT_FREE_END PHP_PROTO_OBJECT_DTOR_END intern array
VALUE Descriptor_DefToClass(const upb_msgdef *m)
void Arena_Pin(VALUE _arena, VALUE obj)
bool upb_array_append(upb_array *arr, upb_msgval val, upb_arena *arena)
#define PBRUBY_ASSERT(expr)
TypeInfo TypeInfo_FromClass(int argc, VALUE *argv, int skip_arg, VALUE *type_class, VALUE *init_arg)
static int index_position(VALUE _index, RepeatedField *repeated_field)
VALUE RepeatedField_hash(VALUE _self)
void RepeatedField_register(VALUE module)
upb_arena * Arena_get(VALUE _arena)
static VALUE RepeatedField_push_vararg(int argc, VALUE *argv, VALUE _self)
PHP_PROTO_OBJECT_FREE_END PHP_PROTO_OBJECT_DTOR_END intern repeated_field
grpc_core::ScopedArenaPtr arena
bool Msgval_IsEqual(upb_msgval val1, upb_msgval val2, TypeInfo type_info)
void RepeatedField_Inspect(StringBuilder *b, const upb_array *array, TypeInfo info)
VALUE RepeatedField_eq(VALUE _self, VALUE _other)
void upb_array_set(upb_array *arr, size_t i, upb_msgval val)
static void RepeatedField_mark(void *_self)
struct RepeatedField RepeatedField
VALUE RepeatedField_concat(VALUE _self, VALUE list)
VALUE RepeatedField_init(int argc, VALUE *argv, VALUE _self)
static VALUE RepeatedField_index(int argc, VALUE *argv, VALUE _self)
upb_msgval upb_array_get(const upb_array *arr, size_t i)
VALUE RepeatedField_deep_copy(VALUE _self)
const upb_array * RepeatedField_GetUpbArray(VALUE val, const upb_fielddef *field, upb_arena *arena)
const upb_msgdef * msgdef
unsigned __int64 uint64_t
uint64_t Msgval_GetHash(upb_msgval val, TypeInfo type_info, uint64_t seed)
upb_array * upb_array_new(upb_arena *a)
void StringBuilder_PrintMsgval(StringBuilder *b, upb_msgval val, TypeInfo info)
VALUE RepeatedField_plus(VALUE _self, VALUE list)
static VALUE RepeatedField_length(VALUE _self)
void ObjectCache_Add(const void *key, VALUE val)
static VALUE RepeatedField_clear(VALUE _self)
static VALUE RepeatedField_index_set(VALUE _self, VALUE _index, VALUE val)
void StringBuilder_Printf(StringBuilder *b, const char *fmt,...)
bool upb_array_resize(upb_array *arr, size_t size, upb_arena *arena)
VALUE RepeatedField_to_ary(VALUE _self)
static TypeInfo TypeInfo_get(const upb_fielddef *f)
const FieldDescriptor * field
static upb_array * RepeatedField_GetMutable(VALUE _self)
#define ALLOC(class_name)
size_t upb_array_size(const upb_array *arr)
UniquePtr< SSL_SESSION > ret
static VALUE RepeatedField_push(VALUE _self, VALUE val)
upb_msgval Msgval_DeepCopy(upb_msgval msgval, TypeInfo type_info, upb_arena *arena)
static VALUE RepeatedField_dup(VALUE _self)
VALUE RepeatedField_GetRubyWrapper(upb_array *array, TypeInfo type_info, VALUE arena)
static RepeatedField * ruby_to_RepeatedField(VALUE _self)
static VALUE RepeatedField_new_this_type(RepeatedField *from)
static VALUE RepeatedField_each(VALUE _self)
const rb_data_type_t RepeatedField_type
static VALUE RepeatedField_freeze(VALUE _self)
static VALUE RepeatedField_pop_one(VALUE _self)
PHP_PROTO_OBJECT_FREE_END PHP_PROTO_OBJECT_DTOR_END intern self
void Arena_fuse(VALUE _arena, upb_arena *other)
VALUE ObjectCache_Get(const void *key)
static VALUE RepeatedField_replace(VALUE _self, VALUE list)
grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:02