mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-12 07:50:59 +00:00
Const correctness in generated code and in code generators. Added missing \reflection\generate_code.bat file. (#4679)
This commit is contained in:
committed by
Wouter van Oortmerssen
parent
c0a6e5120d
commit
79f62ee353
@@ -17,11 +17,11 @@ struct MonsterT;
|
||||
struct Weapon;
|
||||
struct WeaponT;
|
||||
|
||||
inline flatbuffers::TypeTable *Vec3TypeTable();
|
||||
inline const flatbuffers::TypeTable *Vec3TypeTable();
|
||||
|
||||
inline flatbuffers::TypeTable *MonsterTypeTable();
|
||||
inline const flatbuffers::TypeTable *MonsterTypeTable();
|
||||
|
||||
inline flatbuffers::TypeTable *WeaponTypeTable();
|
||||
inline const flatbuffers::TypeTable *WeaponTypeTable();
|
||||
|
||||
enum Color {
|
||||
Color_Red = 0,
|
||||
@@ -31,8 +31,8 @@ enum Color {
|
||||
Color_MAX = Color_Blue
|
||||
};
|
||||
|
||||
inline Color (&EnumValuesColor())[3] {
|
||||
static Color values[] = {
|
||||
inline const Color (&EnumValuesColor())[3] {
|
||||
static const Color values[] = {
|
||||
Color_Red,
|
||||
Color_Green,
|
||||
Color_Blue
|
||||
@@ -40,8 +40,8 @@ inline Color (&EnumValuesColor())[3] {
|
||||
return values;
|
||||
}
|
||||
|
||||
inline const char **EnumNamesColor() {
|
||||
static const char *names[] = {
|
||||
inline const char * const *EnumNamesColor() {
|
||||
static const char * const names[] = {
|
||||
"Red",
|
||||
"Green",
|
||||
"Blue",
|
||||
@@ -62,16 +62,16 @@ enum Equipment {
|
||||
Equipment_MAX = Equipment_Weapon
|
||||
};
|
||||
|
||||
inline Equipment (&EnumValuesEquipment())[2] {
|
||||
static Equipment values[] = {
|
||||
inline const Equipment (&EnumValuesEquipment())[2] {
|
||||
static const Equipment values[] = {
|
||||
Equipment_NONE,
|
||||
Equipment_Weapon
|
||||
};
|
||||
return values;
|
||||
}
|
||||
|
||||
inline const char **EnumNamesEquipment() {
|
||||
static const char *names[] = {
|
||||
inline const char * const *EnumNamesEquipment() {
|
||||
static const char * const names[] = {
|
||||
"NONE",
|
||||
"Weapon",
|
||||
nullptr
|
||||
@@ -191,7 +191,7 @@ struct MonsterT : public flatbuffers::NativeTable {
|
||||
|
||||
struct Monster FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||
typedef MonsterT NativeTableType;
|
||||
static flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
static const flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return MonsterTypeTable();
|
||||
}
|
||||
enum {
|
||||
@@ -393,7 +393,7 @@ struct WeaponT : public flatbuffers::NativeTable {
|
||||
|
||||
struct Weapon FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||
typedef WeaponT NativeTableType;
|
||||
static flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
static const flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return WeaponTypeTable();
|
||||
}
|
||||
enum {
|
||||
@@ -615,64 +615,64 @@ inline void EquipmentUnion::Reset() {
|
||||
type = Equipment_NONE;
|
||||
}
|
||||
|
||||
inline flatbuffers::TypeTable *ColorTypeTable() {
|
||||
static flatbuffers::TypeCode type_codes[] = {
|
||||
inline const flatbuffers::TypeTable *ColorTypeTable() {
|
||||
static const flatbuffers::TypeCode type_codes[] = {
|
||||
{ flatbuffers::ET_CHAR, 0, 0 },
|
||||
{ flatbuffers::ET_CHAR, 0, 0 },
|
||||
{ flatbuffers::ET_CHAR, 0, 0 }
|
||||
};
|
||||
static flatbuffers::TypeFunction type_refs[] = {
|
||||
static const flatbuffers::TypeFunction type_refs[] = {
|
||||
ColorTypeTable
|
||||
};
|
||||
static const char *names[] = {
|
||||
static const char * const names[] = {
|
||||
"Red",
|
||||
"Green",
|
||||
"Blue"
|
||||
};
|
||||
static flatbuffers::TypeTable tt = {
|
||||
static const flatbuffers::TypeTable tt = {
|
||||
flatbuffers::ST_ENUM, 3, type_codes, type_refs, nullptr, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
inline flatbuffers::TypeTable *EquipmentTypeTable() {
|
||||
static flatbuffers::TypeCode type_codes[] = {
|
||||
inline const flatbuffers::TypeTable *EquipmentTypeTable() {
|
||||
static const flatbuffers::TypeCode type_codes[] = {
|
||||
{ flatbuffers::ET_SEQUENCE, 0, -1 },
|
||||
{ flatbuffers::ET_SEQUENCE, 0, 0 }
|
||||
};
|
||||
static flatbuffers::TypeFunction type_refs[] = {
|
||||
static const flatbuffers::TypeFunction type_refs[] = {
|
||||
WeaponTypeTable
|
||||
};
|
||||
static const char *names[] = {
|
||||
static const char * const names[] = {
|
||||
"NONE",
|
||||
"Weapon"
|
||||
};
|
||||
static flatbuffers::TypeTable tt = {
|
||||
static const flatbuffers::TypeTable tt = {
|
||||
flatbuffers::ST_UNION, 2, type_codes, type_refs, nullptr, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
inline flatbuffers::TypeTable *Vec3TypeTable() {
|
||||
static flatbuffers::TypeCode type_codes[] = {
|
||||
inline const flatbuffers::TypeTable *Vec3TypeTable() {
|
||||
static const flatbuffers::TypeCode type_codes[] = {
|
||||
{ flatbuffers::ET_FLOAT, 0, -1 },
|
||||
{ flatbuffers::ET_FLOAT, 0, -1 },
|
||||
{ flatbuffers::ET_FLOAT, 0, -1 }
|
||||
};
|
||||
static const int32_t values[] = { 0, 4, 8, 12 };
|
||||
static const char *names[] = {
|
||||
static const char * const names[] = {
|
||||
"x",
|
||||
"y",
|
||||
"z"
|
||||
};
|
||||
static flatbuffers::TypeTable tt = {
|
||||
static const flatbuffers::TypeTable tt = {
|
||||
flatbuffers::ST_STRUCT, 3, type_codes, nullptr, values, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
inline flatbuffers::TypeTable *MonsterTypeTable() {
|
||||
static flatbuffers::TypeCode type_codes[] = {
|
||||
inline const flatbuffers::TypeTable *MonsterTypeTable() {
|
||||
static const flatbuffers::TypeCode type_codes[] = {
|
||||
{ flatbuffers::ET_SEQUENCE, 0, 0 },
|
||||
{ flatbuffers::ET_SHORT, 0, -1 },
|
||||
{ flatbuffers::ET_SHORT, 0, -1 },
|
||||
@@ -684,13 +684,13 @@ inline flatbuffers::TypeTable *MonsterTypeTable() {
|
||||
{ flatbuffers::ET_UTYPE, 0, 3 },
|
||||
{ flatbuffers::ET_SEQUENCE, 0, 3 }
|
||||
};
|
||||
static flatbuffers::TypeFunction type_refs[] = {
|
||||
static const flatbuffers::TypeFunction type_refs[] = {
|
||||
Vec3TypeTable,
|
||||
ColorTypeTable,
|
||||
WeaponTypeTable,
|
||||
EquipmentTypeTable
|
||||
};
|
||||
static const char *names[] = {
|
||||
static const char * const names[] = {
|
||||
"pos",
|
||||
"mana",
|
||||
"hp",
|
||||
@@ -702,22 +702,22 @@ inline flatbuffers::TypeTable *MonsterTypeTable() {
|
||||
"equipped_type",
|
||||
"equipped"
|
||||
};
|
||||
static flatbuffers::TypeTable tt = {
|
||||
static const flatbuffers::TypeTable tt = {
|
||||
flatbuffers::ST_TABLE, 10, type_codes, type_refs, nullptr, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
inline flatbuffers::TypeTable *WeaponTypeTable() {
|
||||
static flatbuffers::TypeCode type_codes[] = {
|
||||
inline const flatbuffers::TypeTable *WeaponTypeTable() {
|
||||
static const flatbuffers::TypeCode type_codes[] = {
|
||||
{ flatbuffers::ET_STRING, 0, -1 },
|
||||
{ flatbuffers::ET_SHORT, 0, -1 }
|
||||
};
|
||||
static const char *names[] = {
|
||||
static const char * const names[] = {
|
||||
"name",
|
||||
"damage"
|
||||
};
|
||||
static flatbuffers::TypeTable tt = {
|
||||
static const flatbuffers::TypeTable tt = {
|
||||
flatbuffers::ST_TABLE, 2, type_codes, nullptr, nullptr, names
|
||||
};
|
||||
return &tt;
|
||||
|
||||
Reference in New Issue
Block a user