summaryrefslogtreecommitdiff
path: root/include/comphelper/windowsdebugoutput.hxx
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2018-02-08 12:51:29 +0200
committerTor Lillqvist <tml@collabora.com>2018-02-08 12:54:11 +0200
commitceb082c94fd1a8bb308a2c2699699b1fc0f0e7fb (patch)
tree6c8aa40fc2b6805edfcf09d7456948f0a8676bb9 /include/comphelper/windowsdebugoutput.hxx
parentf9826620aae0f9f9fb1dd30216e6be317ecb103b (diff)
Add debug output operator for IID
This file is the place for future similar additions. Change-Id: Ibe168731ed97fe2366afb89409fe5ae2afa711e4
Diffstat (limited to 'include/comphelper/windowsdebugoutput.hxx')
-rw-r--r--include/comphelper/windowsdebugoutput.hxx41
1 files changed, 41 insertions, 0 deletions
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 <ostream>
+#include <prewin.h>
+#include <postwin.h>
+#include <rtl/ustring.hxx>
+
+template <typename charT, typename traits>
+inline std::basic_ostream<charT, traits>& operator<<(std::basic_ostream<charT, traits>& 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<sal_Unicode*>(pRiid));
+ CoTaskMemFree(pRiid);
+ return stream;
+}
+
+#endif // INCLUDED_COMPHELPER_WINDOWSDEBUGOUTPUT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */