aakash-sahai / nanopb

Automatically exported from code.google.com/p/nanopb
zlib License
0 stars 0 forks source link

Request: Enums defined within message #45

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It would be extremely useful if nanopb could support enums defined within a 
message:

message foo
{
   required string name = 1;
   enum bar
   {
      first = 0;
      second = 1;
   }
   optional bar value = 2;
}

Original issue reported on code.google.com by wrl...@gmail.com on 6 Dec 2012 at 2:51

GoogleCodeExporter commented 9 years ago
Hmm, as far as I know, it should work just fine?

The .proto you gave generates this:

/* Enum definitions */
typedef enum _foo_bar {
    foo_bar_first = 0,
    foo_bar_second = 1
} foo_bar;

/* Struct definitions */
typedef struct _foo {
    pb_callback_t name;
    bool has_value;
    foo_bar value;
} foo;

Original comment by Petteri.Aimonen on 6 Dec 2012 at 3:34

GoogleCodeExporter commented 9 years ago
I'm closing this because I don't see any problem. Feel free to reply if you can 
provide more information.

Original comment by Petteri.Aimonen on 13 Dec 2012 at 7:24

GoogleCodeExporter commented 9 years ago
You are correct. My test case was apparently invalid.  Sorry for the false
alarm.

Original comment by wrl...@gmail.com on 13 Dec 2012 at 7:59