namespace proto_field_ops

Overview

Implement single field Get/Set operations using field descriptor and reflection interface. More…

namespace proto_field_ops {

// global functions

bpy::object GetScalarField(gpb::Message& m, const gpb::FieldDescriptor* field);

std::string GetScalarFieldAsString(
    const gpb::Message& m,
    const gpb::FieldDescriptor* field
);

bpy::object GetRepeatedScalarField(
    gpb::Message& m,
    const gpb::FieldDescriptor* field,
    int index
);

void SetScalarField(
    gpb::Message& m,
    const gpb::FieldDescriptor* field,
    const bpy::object& value
);

void SetRepeatedScalarField(
    gpb::Message& m,
    const gpb::FieldDescriptor* field,
    const bpy::object& value,
    int index
);

void AddRepeatedScalarField(
    gpb::Message& m,
    const gpb::FieldDescriptor* field,
    const bpy::object& value
);

template <class MSG, class ... REMAINING_MSGS>
bpy::object GetMessageField(
    gpb::Message& m,
    const gpb::FieldDescriptor* field
);

} // namespace proto_field_ops

Detailed Documentation

Implement single field Get/Set operations using field descriptor and reflection interface.

Global Functions

bpy::object GetScalarField(gpb::Message& m, const gpb::FieldDescriptor* field)

Get scalar field. Returns a copy of the field value.

std::string GetScalarFieldAsString(
    const gpb::Message& m,
    const gpb::FieldDescriptor* field
)

Get scalar field value as a string.

bpy::object GetRepeatedScalarField(
    gpb::Message& m,
    const gpb::FieldDescriptor* field,
    int index
)

Get repeated scalar field. Returns a copy of the field value.

void SetScalarField(
    gpb::Message& m,
    const gpb::FieldDescriptor* field,
    const bpy::object& value
)

Set scalar field.

void SetRepeatedScalarField(
    gpb::Message& m,
    const gpb::FieldDescriptor* field,
    const bpy::object& value,
    int index
)

Set repeated scalar field.

void AddRepeatedScalarField(
    gpb::Message& m,
    const gpb::FieldDescriptor* field,
    const bpy::object& value
)

Append repeated scalar field.

template <class MSG, class ... REMAINING_MSGS>
bpy::object GetMessageField(
    gpb::Message& m,
    const gpb::FieldDescriptor* field
)

Get message field. Returns a reference of the field value.