diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-09-29 16:21:54 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-10-04 15:18:00 +0200 |
commit | 2c05d758b2b62c9df413e2514fb3cd233d0f3ec7 (patch) | |
tree | e0a23d3da6fb17ae97d18957fc14f4a4a8de2d3f /codemaker/source/cppumaker/cpputype.cxx | |
parent | a3088b1e72ef17babe3d3664c610afd02cfe0891 (diff) |
add << operator for css::uno::Exception
Change-Id: Ia23dafd07133779144965682df3b7125a3214235
Reviewed-on: https://gerrit.libreoffice.org/43046
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'codemaker/source/cppumaker/cpputype.cxx')
-rw-r--r-- | codemaker/source/cppumaker/cpputype.cxx | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/codemaker/source/cppumaker/cpputype.cxx b/codemaker/source/cppumaker/cpputype.cxx index 28efa3fbf1f9..dafbe682fd8b 100644 --- a/codemaker/source/cppumaker/cpputype.cxx +++ b/codemaker/source/cppumaker/cpputype.cxx @@ -2738,7 +2738,18 @@ void ExceptionType::dumpHppFile( out << "\n"; addDefaultHxxIncludes(includes); includes.dump(out, &name_, true); + + // for the output operator below + if (name_ == "com.sun.star.uno.Exception") + { + out << "#if defined LIBO_INTERNAL_ONLY\n"; + out << "#include <ostream>\n"; + out << "#include <typeinfo>\n"; + out << "#endif\n"; + } + out << "\n"; + if (codemaker::cppumaker::dumpNamespaceOpen(out, name_, false)) { out << "\n"; } @@ -2837,10 +2848,30 @@ void ExceptionType::dumpHppFile( out << indent() << "return *this;\n"; dec(); out << indent() << "}\n#endif\n\n"; + + // Provide an output operator for printing Exception information to SAL_WARN/SAL_INFO. + if (name_ == "com.sun.star.uno.Exception") + { + out << "#if defined LIBO_INTERNAL_ONLY\n"; + out << "template< typename charT, typename traits >\n"; + out << "inline ::std::basic_ostream<charT, traits> & operator<<(\n"; + out << " ::std::basic_ostream<charT, traits> & os, ::com::sun::star::uno::Exception const & exception)\n"; + out << "{\n"; + out << " // the class name is useful because exception throwing code does not always pass in a useful message\n"; + out << " os << typeid(exception).name();\n"; + out << " if (!exception.Message.isEmpty())\n"; + out << " os << \" msg: \" << exception.Message;\n"; + out << " return os;\n"; + out << "}\n"; + out << "#endif\n"; + out << "\n"; + } + if (codemaker::cppumaker::dumpNamespaceClose(out, name_, false)) { out << "\n"; } out << "\n"; + dumpGetCppuType(out); out << "\n#endif // "<< headerDefine << "\n"; } |