oneof_fields.proto 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * Copyright (C) 2020 Embedded AMS B.V. - All Rights Reserved
  3. *
  4. * This file is part of Embedded Proto.
  5. *
  6. * Embedded Proto is open source software: you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License as published
  8. * by the Free Software Foundation, version 3 of the license.
  9. *
  10. * Embedded Proto is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with Embedded Proto. If not, see <https://www.gnu.org/licenses/>.
  17. *
  18. * For commercial and closed source application please visit:
  19. * <https://EmbeddedProto.com/license/>.
  20. *
  21. * Embedded AMS B.V.
  22. * Info:
  23. * info at EmbeddedProto dot com
  24. *
  25. * Postal address:
  26. * Johan Huizingalaan 763a
  27. * 1066 VH, Amsterdam
  28. * the Netherlands
  29. */
  30. // This file is used to test oneof fields in messages.
  31. syntax = "proto3";
  32. message some_ABC
  33. {
  34. int32 varA = 1;
  35. int32 varB = 2;
  36. int32 varC = 3;
  37. }
  38. message some_DEF
  39. {
  40. int32 varD = 1;
  41. int32 varE = 2;
  42. int32 varF = 3;
  43. }
  44. message message_oneof
  45. {
  46. int32 a = 1;
  47. enum States {
  48. Idle = 0;
  49. Run = 1;
  50. Done = 2;
  51. Error = 3;
  52. }
  53. oneof xyz
  54. {
  55. int32 x = 5;
  56. int32 y = 6;
  57. int32 z = 7;
  58. States state = 8;
  59. }
  60. int32 b = 10;
  61. oneof uvw
  62. {
  63. float u = 15;
  64. float v = 16;
  65. float w = 17;
  66. }
  67. oneof message
  68. {
  69. some_ABC msg_ABC = 20;
  70. some_DEF msg_DEF = 21;
  71. }
  72. }
  73. message nested_oneof {
  74. message_oneof msg_oneof = 1;
  75. }