Here is my fbs:
namespace Vibranium;
enum LOGIN_STATUS : int {
INVALID_CREDENTIALS,
LOGIN_SUCCESS,
ACCOUNT_LOGGEDIN,
ACCOUNT_INGAME,
ACCOUNT_BANNED,
ACCOUNT_LOCKED
}
table LoginRequest{
email:string;
password:string;
client_hash:string;
connection_id:uint32;
}
table LoginResponse{
account_id:uint32;
status:LOGIN_STATUS;
}
root_type LoginRequest;
This generates function called VerifyLoginRequestBuffer
however there is no function called VerifyLoginResponseBuffer
so I do not now how to verify LoginResponse
.
My question is:
How in C++ I can verify table which is not marked as root_type
?
Can anyone write an example as answer if it is even possible?
P.S. I tried creating some unique function which can check all possible types like so:
template<typename T>
bool VerifyBuffer(flatbuffers::Verifier &verifier){
verifier.VerifyBuffer<T>(nullptr);
}
So my plan was to provide LoginResponse
like so:
bool check = VerifyBuffer<Vibranium::LoginResponse>(&verifier);
However LoginResponse
inherits from private flatbuffers::Table
which is a problem. So I am stuck inhere.
Functions like VerifyLoginRequestBuffer
are "convenience" functions generated for the rout type. You can look at their (small) implementation, and call the exact same function for any other table type.