mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-28 06:38:05 +00:00
- fix CSharp comments generation - fix Python comments generation - fix Lua comments generation - fix PHP comments generation - fix Dart comments generation - add brief description of Color enum - add multi-line comments to the Monster:Color
This commit is contained in:
committed by
Wouter van Oortmerssen
parent
bc7ede8fb3
commit
95004218f7
@@ -7,10 +7,10 @@ namespace MyGame.Example
|
||||
|
||||
public enum Any : byte
|
||||
{
|
||||
NONE = 0,
|
||||
Monster = 1,
|
||||
TestSimpleTableWithEnum = 2,
|
||||
MyGame_Example2_Monster = 3,
|
||||
NONE = 0,
|
||||
Monster = 1,
|
||||
TestSimpleTableWithEnum = 2,
|
||||
MyGame_Example2_Monster = 3,
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -7,10 +7,10 @@ namespace MyGame.Example
|
||||
|
||||
public enum AnyAmbiguousAliases : byte
|
||||
{
|
||||
NONE = 0,
|
||||
M1 = 1,
|
||||
M2 = 2,
|
||||
M3 = 3,
|
||||
NONE = 0,
|
||||
M1 = 1,
|
||||
M2 = 2,
|
||||
M3 = 3,
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -7,10 +7,10 @@ namespace MyGame.Example
|
||||
|
||||
public enum AnyUniqueAliases : byte
|
||||
{
|
||||
NONE = 0,
|
||||
M = 1,
|
||||
TS = 2,
|
||||
M2 = 3,
|
||||
NONE = 0,
|
||||
M = 1,
|
||||
TS = 2,
|
||||
M2 = 3,
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -5,12 +5,16 @@
|
||||
namespace MyGame.Example
|
||||
{
|
||||
|
||||
/// Composite components of Monster color.
|
||||
[System.FlagsAttribute]
|
||||
public enum Color : byte
|
||||
{
|
||||
Red = 1,
|
||||
Green = 2,
|
||||
Blue = 8,
|
||||
Red = 1,
|
||||
/// \brief color Green
|
||||
/// Green is bit_flag with value (1u << 1)
|
||||
Green = 2,
|
||||
/// \brief color Blue (1u << 3)
|
||||
Blue = 8,
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -4,11 +4,15 @@ package Example
|
||||
|
||||
import "strconv"
|
||||
|
||||
/// Composite components of Monster color.
|
||||
type Color byte
|
||||
|
||||
const (
|
||||
ColorRed Color = 1
|
||||
/// \brief color Green
|
||||
/// Green is bit_flag with value (1u << 1)
|
||||
ColorGreen Color = 2
|
||||
/// \brief color Blue (1u << 3)
|
||||
ColorBlue Color = 8
|
||||
)
|
||||
|
||||
|
||||
@@ -2,10 +2,20 @@
|
||||
|
||||
package MyGame.Example;
|
||||
|
||||
/**
|
||||
* Composite components of Monster color.
|
||||
*/
|
||||
public final class Color {
|
||||
private Color() { }
|
||||
public static final byte Red = 1;
|
||||
/**
|
||||
* \brief color Green
|
||||
* Green is bit_flag with value (1u << 1)
|
||||
*/
|
||||
public static final byte Green = 2;
|
||||
/**
|
||||
* \brief color Blue (1u << 3)
|
||||
*/
|
||||
public static final byte Blue = 8;
|
||||
|
||||
public static final String[] names = { "Red", "Green", "", "", "", "", "", "Blue", };
|
||||
|
||||
@@ -2,9 +2,13 @@
|
||||
|
||||
-- namespace: Example
|
||||
|
||||
-- Composite components of Monster color.
|
||||
local Color = {
|
||||
Red = 1,
|
||||
-- \brief color Green
|
||||
-- Green is bit_flag with value (1u << 1)
|
||||
Green = 2,
|
||||
-- \brief color Blue (1u << 3)
|
||||
Blue = 8,
|
||||
}
|
||||
|
||||
|
||||
@@ -3,10 +3,14 @@
|
||||
|
||||
namespace MyGame\Example;
|
||||
|
||||
/// Composite components of Monster color.
|
||||
class Color
|
||||
{
|
||||
const Red = 1;
|
||||
/// \brief color Green
|
||||
/// Green is bit_flag with value (1u << 1)
|
||||
const Green = 2;
|
||||
/// \brief color Blue (1u << 3)
|
||||
const Blue = 8;
|
||||
|
||||
private static $names = array(
|
||||
|
||||
@@ -2,8 +2,12 @@
|
||||
|
||||
# namespace: Example
|
||||
|
||||
# Composite components of Monster color.
|
||||
class Color(object):
|
||||
Red = 1
|
||||
# \brief color Green
|
||||
# Green is bit_flag with value (1u << 1)
|
||||
Green = 2
|
||||
# \brief color Blue (1u << 3)
|
||||
Blue = 8
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
local flatbuffers = require('flatbuffers')
|
||||
|
||||
-- /// an example documentation comment: monster object
|
||||
-- an example documentation comment: monster object
|
||||
local Monster = {} -- the module
|
||||
local Monster_mt = {} -- the class metatable
|
||||
|
||||
@@ -120,8 +120,8 @@ function Monster_mt:TestarrayofstringLength()
|
||||
end
|
||||
return 0
|
||||
end
|
||||
-- /// an example documentation comment: this will end up in the generated code
|
||||
-- /// multiline too
|
||||
-- an example documentation comment: this will end up in the generated code
|
||||
-- multiline too
|
||||
function Monster_mt:Testarrayoftables(j)
|
||||
local o = self.view:Offset(26)
|
||||
if o ~= 0 then
|
||||
|
||||
@@ -171,8 +171,8 @@ class Monster extends Table
|
||||
return $o != 0 ? $this->__vector_len($o) : 0;
|
||||
}
|
||||
|
||||
/// an example documentation comment: this will end up in the generated code
|
||||
/// multiline too
|
||||
/// an example documentation comment: this will end up in the generated code
|
||||
/// multiline too
|
||||
/**
|
||||
* @returnVectorOffset
|
||||
*/
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import flatbuffers
|
||||
|
||||
# /// an example documentation comment: monster object
|
||||
# an example documentation comment: monster object
|
||||
class Monster(object):
|
||||
__slots__ = ['_tab']
|
||||
|
||||
@@ -131,8 +131,8 @@ class Monster(object):
|
||||
return self._tab.VectorLen(o)
|
||||
return 0
|
||||
|
||||
# /// an example documentation comment: this will end up in the generated code
|
||||
# /// multiline too
|
||||
# an example documentation comment: this will end up in the generated code
|
||||
# multiline too
|
||||
# Monster
|
||||
def Testarrayoftables(self, j):
|
||||
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26))
|
||||
|
||||
Binary file not shown.
@@ -14,7 +14,15 @@ namespace MyGame.Example;
|
||||
|
||||
attribute "priority";
|
||||
|
||||
enum Color:ubyte (bit_flags) { Red = 0, Green, Blue = 3, }
|
||||
/// Composite components of Monster color.
|
||||
enum Color:ubyte (bit_flags) {
|
||||
Red = 0, // color Red = (1u << 0)
|
||||
/// \brief color Green
|
||||
/// Green is bit_flag with value (1u << 1)
|
||||
Green,
|
||||
/// \brief color Blue (1u << 3)
|
||||
Blue = 3,
|
||||
}
|
||||
|
||||
union Any { Monster, TestSimpleTableWithEnum, MyGame.Example2.Monster }
|
||||
|
||||
|
||||
@@ -99,9 +99,13 @@ inline const flatbuffers::TypeTable *MonsterTypeTable();
|
||||
|
||||
inline const flatbuffers::TypeTable *TypeAliasesTypeTable();
|
||||
|
||||
/// Composite components of Monster color.
|
||||
enum Color {
|
||||
Color_Red = 1,
|
||||
/// \brief color Green
|
||||
/// Green is bit_flag with value (1u << 1)
|
||||
Color_Green = 2,
|
||||
/// \brief color Blue (1u << 3)
|
||||
Color_Blue = 8,
|
||||
Color_NONE = 0,
|
||||
Color_ANY = 11
|
||||
|
||||
@@ -25,20 +25,42 @@ MyGame.Example2 = MyGame.Example2 || {};
|
||||
MyGame.OtherNameSpace = MyGame.OtherNameSpace || {};
|
||||
|
||||
/**
|
||||
* Composite components of Monster color.
|
||||
*
|
||||
* @enum {number}
|
||||
*/
|
||||
MyGame.Example.Color = {
|
||||
Red: 1,
|
||||
|
||||
/**
|
||||
* \brief color Green
|
||||
* Green is bit_flag with value (1u << 1)
|
||||
*/
|
||||
Green: 2,
|
||||
|
||||
/**
|
||||
* \brief color Blue (1u << 3)
|
||||
*/
|
||||
Blue: 8
|
||||
};
|
||||
|
||||
/**
|
||||
* Composite components of Monster color.
|
||||
*
|
||||
* @enum {string}
|
||||
*/
|
||||
MyGame.Example.ColorName = {
|
||||
1: 'Red',
|
||||
|
||||
/**
|
||||
* \brief color Green
|
||||
* Green is bit_flag with value (1u << 1)
|
||||
*/
|
||||
2: 'Green',
|
||||
|
||||
/**
|
||||
* \brief color Blue (1u << 3)
|
||||
*/
|
||||
8: 'Blue'
|
||||
};
|
||||
|
||||
|
||||
@@ -3,9 +3,13 @@ import flatbuffers
|
||||
|
||||
namespace MyGame_Example
|
||||
|
||||
/// Composite components of Monster color.
|
||||
enum Color:
|
||||
Color_Red = 1
|
||||
/// \brief color Green
|
||||
/// Green is bit_flag with value (1u << 1)
|
||||
Color_Green = 2
|
||||
/// \brief color Blue (1u << 3)
|
||||
Color_Blue = 8
|
||||
|
||||
enum Any:
|
||||
|
||||
@@ -163,12 +163,16 @@ pub mod example {
|
||||
extern crate flatbuffers;
|
||||
use self::flatbuffers::EndianScalar;
|
||||
|
||||
/// Composite components of Monster color.
|
||||
#[allow(non_camel_case_types)]
|
||||
#[repr(u8)]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
|
||||
pub enum Color {
|
||||
Red = 1,
|
||||
/// \brief color Green
|
||||
/// Green is bit_flag with value (1u << 1)
|
||||
Green = 2,
|
||||
/// \brief color Blue (1u << 3)
|
||||
Blue = 8,
|
||||
|
||||
}
|
||||
|
||||
@@ -1,12 +1,23 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
/**
|
||||
* Composite components of Monster color.
|
||||
*
|
||||
* @enum {number}
|
||||
*/
|
||||
export namespace MyGame.Example{
|
||||
export enum Color{
|
||||
Red= 1,
|
||||
|
||||
/**
|
||||
* \brief color Green
|
||||
* Green is bit_flag with value (1u << 1)
|
||||
*/
|
||||
Green= 2,
|
||||
|
||||
/**
|
||||
* \brief color Blue (1u << 3)
|
||||
*/
|
||||
Blue= 8
|
||||
}};
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import 'package:flat_buffers/flat_buffers.dart' as fb;
|
||||
import './monster_test_my_game_generated.dart' as my_game;
|
||||
import './monster_test_my_game.example2_generated.dart' as my_game_example2;
|
||||
|
||||
/// Composite components of Monster color.
|
||||
class Color {
|
||||
final int value;
|
||||
const Color._(this.value);
|
||||
@@ -24,7 +25,12 @@ class Color {
|
||||
static bool containsValue(int value) => values.containsKey(value);
|
||||
|
||||
static const Color Red = const Color._(1);
|
||||
|
||||
/// \brief color Green
|
||||
/// Green is bit_flag with value (1u << 1)
|
||||
static const Color Green = const Color._(2);
|
||||
|
||||
/// \brief color Blue (1u << 3)
|
||||
static const Color Blue = const Color._(8);
|
||||
static get values => {1: Red,2: Green,8: Blue,};
|
||||
|
||||
@@ -700,8 +706,8 @@ class Monster {
|
||||
}
|
||||
List<Test> get test4 => const fb.ListReader<Test>(Test.reader).vTableGet(_bc, _bcOffset, 22, null);
|
||||
List<String> get testarrayofstring => const fb.ListReader<String>(const fb.StringReader()).vTableGet(_bc, _bcOffset, 24, null);
|
||||
/// an example documentation comment: this will end up in the generated code
|
||||
/// multiline too
|
||||
/// an example documentation comment: this will end up in the generated code
|
||||
/// multiline too
|
||||
List<Monster> get testarrayoftables => const fb.ListReader<Monster>(Monster.reader).vTableGet(_bc, _bcOffset, 26, null);
|
||||
Monster get enemy => Monster.reader.vTableGet(_bc, _bcOffset, 28, null);
|
||||
List<int> get testnestedflatbuffer => const fb.ListReader<int>(const fb.Uint8Reader()).vTableGet(_bc, _bcOffset, 30, null);
|
||||
|
||||
@@ -7,9 +7,9 @@ namespace NamespaceA.NamespaceB
|
||||
|
||||
public enum EnumInNestedNS : sbyte
|
||||
{
|
||||
A = 0,
|
||||
B = 1,
|
||||
C = 2,
|
||||
A = 0,
|
||||
B = 1,
|
||||
C = 2,
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
|
||||
public enum Character : byte
|
||||
{
|
||||
NONE = 0,
|
||||
MuLan = 1,
|
||||
Rapunzel = 2,
|
||||
Belle = 3,
|
||||
BookFan = 4,
|
||||
Other = 5,
|
||||
Unused = 6,
|
||||
NONE = 0,
|
||||
MuLan = 1,
|
||||
Rapunzel = 2,
|
||||
Belle = 3,
|
||||
BookFan = 4,
|
||||
Other = 5,
|
||||
Unused = 6,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user