Closed agladilin closed 3 weeks ago
Could you add the code below in order to support the using namespace directive?
using namespace
diff --git a/pub/cppwriter.h b/pub/cppwriter.h index 5b9e3a81..e2541d48 100644 --- a/pub/cppwriter.h +++ b/pub/cppwriter.h @@ -66,6 +66,9 @@ public: virtual void emitUsingDecl(const CppUsingDecl* usingDecl, std::ostream& stm, CppIndent indentation = CppIndent()) const; + virtual void emitUsingNamespaceDecl(const CppUsingNamespaceDecl* usingDecl, + std::ostream& stm, + CppIndent indentation = CppIndent()) const; virtual void emitTypedefList(const CppTypedefList* typedefList, std::ostream& stm, CppIndent indentation = CppIndent()) const; diff --git a/src/cppwriter.cpp b/src/cppwriter.cpp index 89034bcd..2ed6a738 100644 --- a/src/cppwriter.cpp +++ b/src/cppwriter.cpp @@ -106,6 +106,8 @@ void CppWriter::emit(const CppObj* cppObj, std::ostream& stm, CppIndent indentat return emitDocComment((CppDocComment*) cppObj, stm, indentation); case CppObjType::kUsingDecl: return emitUsingDecl((CppUsingDecl*) cppObj, stm, indentation); + case CppObjType::kUsingNamespaceDecl: + return emitUsingNamespaceDecl((CppUsingNamespaceDecl*) cppObj, stm, indentation); case CppObjType::kTypedefName: return emitTypedef((CppTypedefName*) cppObj, stm, indentation); case CppObjType::kTypedefNameList: @@ -411,6 +413,13 @@ void CppWriter::emitUsingDecl(const CppUsingDecl* usingDecl, stm << ";\n"; } +void CppWriter::emitUsingNamespaceDecl(const CppUsingNamespaceDecl* usingDecl, + std::ostream& stm, + CppIndent indentation /* = CppIndent()*/) const +{ + stm << indentation << "using namespace " << usingDecl->name_ << ";\n"; +} + void CppWriter::emitTypedefList(const CppTypedefList* typedefList, std::ostream& stm, CppIndent indentation /* = CppIndent()*/) const
With the latest update this is already supported.
Could you add the code below in order to support the
using namespace
directive?