Hi,

I've got some code that lets me recursively walk a protobuf variable.

That part works, I can enumerate the characteristics of a variable, but the 
pointers/references returned by the API are const.

My question is: From a variable's Descriptor or FieldDescriptor, is it 
possible to get a non-const pointer/reference to the field to be able to 
modify it?

Here's my (simplified) code so far:

void enumpb(  const google::protobuf::Descriptor * d ) {

    for ( int i = 0; i < d->field_count(); i++ ) {

        auto field = d->field( i );

        // Modify variable code here
        [...]

        auto mt = field->message_type();
        if ( ! mt ) {
            continue;
        } else if ( 0 != strcmp( d->full_name().c_str(), 
mt->full_name().c_str() ) ) {

            enumpb( mt ) ;

        }

    }

    return true;

}

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/protobuf/dcf6bb53-24ce-4404-ab71-0fe3a94adc40n%40googlegroups.com.

Reply via email to