Skip to content
Snippets Groups Projects
Commit 96f0fdad authored by Chris Manton's avatar Chris Manton
Browse files

flatbuffers: Add FlatbufferTypeText

Bug: 216499488
Tag: #refactor
Test: gd/cert/run
BYPASS_LONG_LINES_REASON: Bluetooth likes 120 lines

Change-Id: Icbb43c362e222dafaa2cdcb8532d9a2e11da78eb
parent d58e7d78
No related branches found
No related tags found
No related merge requests found
......@@ -15,6 +15,8 @@
*/
#pragma once
#include <base/strings/stringprintf.h>
#include <string>
#include "flatbuffers/flatbuffers.h"
......@@ -118,6 +120,34 @@ bool FilterTypeFloat(const reflection::Field& field, flatbuffers::Table* table,
bool FilterTypeString(const reflection::Field& field, flatbuffers::Table* table, PrivacyLevel privacy_level);
bool FilterTypeStruct(const reflection::Field& field, flatbuffers::Table* table, PrivacyLevel privacy_level);
#define CASE_RETURN_TEXT(code) \
case code: \
return #code
inline std::string FlatbufferTypeText(const flatbuffers::BaseType& type) {
switch (type) {
CASE_RETURN_TEXT(flatbuffers::BASE_TYPE_NONE);
CASE_RETURN_TEXT(flatbuffers::BASE_TYPE_BOOL);
CASE_RETURN_TEXT(flatbuffers::BASE_TYPE_CHAR);
CASE_RETURN_TEXT(flatbuffers::BASE_TYPE_UCHAR);
CASE_RETURN_TEXT(flatbuffers::BASE_TYPE_SHORT);
CASE_RETURN_TEXT(flatbuffers::BASE_TYPE_USHORT);
CASE_RETURN_TEXT(flatbuffers::BASE_TYPE_INT);
CASE_RETURN_TEXT(flatbuffers::BASE_TYPE_UINT);
CASE_RETURN_TEXT(flatbuffers::BASE_TYPE_LONG);
CASE_RETURN_TEXT(flatbuffers::BASE_TYPE_ULONG);
CASE_RETURN_TEXT(flatbuffers::BASE_TYPE_FLOAT);
CASE_RETURN_TEXT(flatbuffers::BASE_TYPE_DOUBLE);
CASE_RETURN_TEXT(flatbuffers::BASE_TYPE_STRING);
CASE_RETURN_TEXT(flatbuffers::BASE_TYPE_VECTOR);
CASE_RETURN_TEXT(flatbuffers::BASE_TYPE_STRUCT);
CASE_RETURN_TEXT(flatbuffers::BASE_TYPE_UNION);
default:
return base::StringPrintf("UNKNOWN[%d]", (int)type);
}
}
#undef CASE_RETURN_TEXT
} // namespace internal
} // namespace dumpsys
} // namespace bluetooth
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment