mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-28 05:08:04 +00:00
clangFormating base class
This commit is contained in:
@@ -39,8 +39,8 @@ class BaseGenerator {
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
BaseGenerator(const Parser &parser, const std::string &path,
|
BaseGenerator(const Parser &parser, const std::string &path,
|
||||||
const std::string &file_name,
|
const std::string &file_name,
|
||||||
const std::string qualifying_start,
|
const std::string qualifying_start,
|
||||||
const std::string qualifying_separator)
|
const std::string qualifying_separator)
|
||||||
: parser_(parser),
|
: parser_(parser),
|
||||||
path_(path),
|
path_(path),
|
||||||
@@ -86,15 +86,18 @@ class BaseGenerator {
|
|||||||
|
|
||||||
const std::string LastNamespacePart(const Namespace &ns) {
|
const std::string LastNamespacePart(const Namespace &ns) {
|
||||||
auto &namespaces = ns.components;
|
auto &namespaces = ns.components;
|
||||||
if (namespaces.size()) return *(namespaces.end() - 1); else return std::string("");
|
if (namespaces.size())
|
||||||
|
return *(namespaces.end() - 1);
|
||||||
|
else
|
||||||
|
return std::string("");
|
||||||
}
|
}
|
||||||
|
|
||||||
// tracks the current namespace for early exit in WrapInNameSpace
|
// tracks the current namespace for early exit in WrapInNameSpace
|
||||||
// c++, java and csharp returns a different namespace from
|
// c++, java and csharp returns a different namespace from
|
||||||
// the following default (no early exit, always fully qualify),
|
// the following default (no early exit, always fully qualify),
|
||||||
// which works for js and php
|
// which works for js and php
|
||||||
virtual const Namespace *CurrentNameSpace() { return nullptr; }
|
virtual const Namespace *CurrentNameSpace() { return nullptr; }
|
||||||
|
|
||||||
// Ensure that a type is prefixed with its namespace whenever it is used
|
// Ensure that a type is prefixed with its namespace whenever it is used
|
||||||
// outside of its namespace.
|
// outside of its namespace.
|
||||||
std::string WrapInNameSpace(const Namespace *ns, const std::string &name) {
|
std::string WrapInNameSpace(const Namespace *ns, const std::string &name) {
|
||||||
|
|||||||
Reference in New Issue
Block a user