user1190294
user1190294

Reputation:

Google protocol buffer, how to set field of custom type?

I have proto file like this:

message Control {

    message KeyStatus {
        required bool keyUp = 1;
        required bool keyDown = 2;
        required bool keyLeft = 3;
        required bool keyRight = 4;
    }

    message MouseClick {
        required double x = 1;
        required double y = 2;
        optional bool buttonRight = 3;
    }

    required KeyStatus keyStatus = 1;
    required double angle = 2;
    optional MouseClick mouseClick = 3;
}

In generated code there is no method set_keystatus or set_mouseclick, only set_angle. How can I set keystatus then?

Upvotes: 1

Views: 2509

Answers (1)

Alan Stokes
Alan Stokes

Reputation: 18974

Have you read the documentation? Try, for example, the mutable_keystatus() method.

Upvotes: 2

Related Questions