mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-18 10:24:27 +00:00
[JS] Add getFullyQualifiedName() (#6119)
This optionally generates a static `getFullyQualifiedName()` function to get the fully-qualified name of a type in JavaScript and TypeScript in a similar fashion to the C++ codegen.
This commit is contained in:
@@ -202,6 +202,9 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) Rapunzel FLATBUFFERS_FINAL_CLASS {
|
||||
static const flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return RapunzelTypeTable();
|
||||
}
|
||||
static FLATBUFFERS_CONSTEXPR const char *GetFullyQualifiedName() {
|
||||
return "Rapunzel";
|
||||
}
|
||||
Rapunzel()
|
||||
: hair_length_(0) {
|
||||
}
|
||||
@@ -235,6 +238,9 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) BookReader FLATBUFFERS_FINAL_CLASS {
|
||||
static const flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return BookReaderTypeTable();
|
||||
}
|
||||
static FLATBUFFERS_CONSTEXPR const char *GetFullyQualifiedName() {
|
||||
return "BookReader";
|
||||
}
|
||||
BookReader()
|
||||
: books_read_(0) {
|
||||
}
|
||||
@@ -262,6 +268,9 @@ inline bool operator!=(const BookReader &lhs, const BookReader &rhs) {
|
||||
|
||||
struct AttackerT : public flatbuffers::NativeTable {
|
||||
typedef Attacker TableType;
|
||||
static FLATBUFFERS_CONSTEXPR const char *GetFullyQualifiedName() {
|
||||
return "AttackerT";
|
||||
}
|
||||
int32_t sword_attack_damage;
|
||||
AttackerT()
|
||||
: sword_attack_damage(0) {
|
||||
@@ -284,6 +293,9 @@ struct Attacker FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||
static const flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return AttackerTypeTable();
|
||||
}
|
||||
static FLATBUFFERS_CONSTEXPR const char *GetFullyQualifiedName() {
|
||||
return "Attacker";
|
||||
}
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_SWORD_ATTACK_DAMAGE = 4
|
||||
};
|
||||
@@ -333,6 +345,9 @@ flatbuffers::Offset<Attacker> CreateAttacker(flatbuffers::FlatBufferBuilder &_fb
|
||||
|
||||
struct MovieT : public flatbuffers::NativeTable {
|
||||
typedef Movie TableType;
|
||||
static FLATBUFFERS_CONSTEXPR const char *GetFullyQualifiedName() {
|
||||
return "MovieT";
|
||||
}
|
||||
CharacterUnion main_character;
|
||||
std::vector<CharacterUnion> characters;
|
||||
MovieT() {
|
||||
@@ -356,6 +371,9 @@ struct Movie FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||
static const flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return MovieTypeTable();
|
||||
}
|
||||
static FLATBUFFERS_CONSTEXPR const char *GetFullyQualifiedName() {
|
||||
return "Movie";
|
||||
}
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_MAIN_CHARACTER_TYPE = 4,
|
||||
VT_MAIN_CHARACTER = 6,
|
||||
|
||||
@@ -94,6 +94,13 @@ Attacker.prototype.mutate_sword_attack_damage = function(value) {
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
Attacker.getFullyQualifiedName = function() {
|
||||
return 'Attacker';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
*/
|
||||
@@ -171,6 +178,13 @@ Rapunzel.prototype.mutate_hair_length = function(value) {
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
Rapunzel.getFullyQualifiedName = function() {
|
||||
return 'Rapunzel';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
* @param {number} hair_length
|
||||
@@ -224,6 +238,13 @@ BookReader.prototype.mutate_books_read = function(value) {
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
BookReader.getFullyQualifiedName = function() {
|
||||
return 'BookReader';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
* @param {number} books_read
|
||||
@@ -348,6 +369,13 @@ Movie.prototype.charactersLength = function() {
|
||||
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
Movie.getFullyQualifiedName = function() {
|
||||
return 'Movie';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
*/
|
||||
|
||||
@@ -107,6 +107,13 @@ mutate_sword_attack_damage(value:number):boolean {
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns string
|
||||
*/
|
||||
static getFullyQualifiedName():string {
|
||||
return 'Attacker';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param flatbuffers.Builder builder
|
||||
*/
|
||||
@@ -207,6 +214,13 @@ mutate_hair_length(value:number):boolean {
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns string
|
||||
*/
|
||||
static getFullyQualifiedName():string {
|
||||
return 'Rapunzel';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param flatbuffers.Builder builder
|
||||
* @param number hair_length
|
||||
@@ -289,6 +303,13 @@ mutate_books_read(value:number):boolean {
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns string
|
||||
*/
|
||||
static getFullyQualifiedName():string {
|
||||
return 'BookReader';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param flatbuffers.Builder builder
|
||||
* @param number books_read
|
||||
@@ -442,6 +463,13 @@ charactersLength():number {
|
||||
return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns string
|
||||
*/
|
||||
static getFullyQualifiedName():string {
|
||||
return 'Movie';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param flatbuffers.Builder builder
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user