mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-27 14:32:18 +00:00
Use ConvertCase instead of Make{Upper,Lower,Snake} implementations (#7127)
* Unified name case conversion to single method * Convert bfbs_gen to use ConvertCase * convert rust to use ConvertCase * Convert idl_parser to use ConvertCase * Convert MakeScreamingCamel to ConvertCase * Replaced MakeCamel with ConvertCase * minor fixes
This commit is contained in:
@@ -93,20 +93,6 @@ static bool IsVector(const reflection::BaseType base_type) {
|
||||
return base_type == reflection::Vector;
|
||||
}
|
||||
|
||||
static std::string MakeCamelCase(const std::string &in,
|
||||
bool uppercase_first = true) {
|
||||
std::string s;
|
||||
for (size_t i = 0; i < in.length(); i++) {
|
||||
if (!i && uppercase_first)
|
||||
s += static_cast<char>(::toupper(static_cast<unsigned char>(in[0])));
|
||||
else if (in[i] == '_' && i + 1 < in.length())
|
||||
s += static_cast<char>(::toupper(static_cast<unsigned char>(in[++i])));
|
||||
else
|
||||
s += in[i];
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
static std::string Denamespace(const flatbuffers::String *name,
|
||||
std::string &ns) {
|
||||
const size_t pos = name->str().find_last_of('.');
|
||||
|
||||
Reference in New Issue
Block a user