From ceb082c94fd1a8bb308a2c2699699b1fc0f0e7fb Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Thu, 8 Feb 2018 12:51:29 +0200 Subject: Add debug output operator for IID This file is the place for future similar additions. Change-Id: Ibe168731ed97fe2366afb89409fe5ae2afa711e4 --- include/comphelper/windowsdebugoutput.hxx | 41 +++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 include/comphelper/windowsdebugoutput.hxx (limited to 'include/comphelper/windowsdebugoutput.hxx') diff --git a/include/comphelper/windowsdebugoutput.hxx b/include/comphelper/windowsdebugoutput.hxx new file mode 100644 index 000000000000..5efda11e7271 --- /dev/null +++ b/include/comphelper/windowsdebugoutput.hxx @@ -0,0 +1,41 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +/* Debug output operators for Windows-specific types. For use in SAL_INFO(), SAL_WARN(), and + * friends. The exact format of the generated output is not guaranteed to be stable or contain + * complete information. + */ + +#ifndef INCLUDED_COMPHELPER_WINDOWSDEBUGOUTPUT_HXX +#define INCLUDED_COMPHELPER_WINDOWSDEBUGOUTPUT_HXX + +#include +#include +#include +#include + +template +inline std::basic_ostream& operator<<(std::basic_ostream& stream, + const IID& rIid) +{ + LPOLESTR pRiid; + if (StringFromIID(rIid, &pRiid) != S_OK) + return stream << "?"; + + // TODO: Maybe look up a descriptive name for the service or interface, from HKCR\CLSID or + // HKCR\Interface? + + stream << OUString(reinterpret_cast(pRiid)); + CoTaskMemFree(pRiid); + return stream; +} + +#endif // INCLUDED_COMPHELPER_WINDOWSDEBUGOUTPUT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit