aboutsummaryrefslogtreecommitdiff
path: root/libs/libbsarch/src/utils/convertible_ostream.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/libbsarch/src/utils/convertible_ostream.cpp')
-rw-r--r--libs/libbsarch/src/utils/convertible_ostream.cpp58
1 files changed, 58 insertions, 0 deletions
diff --git a/libs/libbsarch/src/utils/convertible_ostream.cpp b/libs/libbsarch/src/utils/convertible_ostream.cpp
new file mode 100644
index 0000000..d5ac238
--- /dev/null
+++ b/libs/libbsarch/src/utils/convertible_ostream.cpp
@@ -0,0 +1,58 @@
+/* Copyright (C) 2019 G'k
+ * 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 https://mozilla.org/MPL/2.0/. */
+#include "convertible_ostream.hpp"
+
+namespace libbsarch {
+convertible_ostream &convertible_ostream::operator<<(const std::string &rh)
+{
+ std::cout << rh;
+ return *this;
+}
+convertible_ostream &convertible_ostream::operator<<(const char *rh)
+{
+ std::cout << rh;
+ return *this;
+}
+convertible_ostream &convertible_ostream::operator<<(const char rh)
+{
+ std::cout << rh;
+ return *this;
+}
+convertible_ostream &convertible_ostream::operator<<(const std::wstring &rh)
+{
+ std::wcout << rh;
+ return *this;
+}
+convertible_ostream &convertible_ostream::operator<<(const void *rh)
+{
+ std::cout << rh;
+ return *this;
+}
+convertible_ostream &convertible_ostream::operator<<(const convertible_string &rh)
+{
+ return *this << std::string(rh);
+}
+
+convertible_ostream::operator std::ostream &()
+{
+ return std::cout;
+}
+convertible_ostream::operator std::wostream &()
+{
+ return std::wcout;
+}
+
+#ifdef LIBBSARCH_QT_SUPPORT
+convertible_ostream::operator QDebug()
+{
+ return qDebug();
+}
+convertible_ostream &convertible_ostream::operator<<(const QString &rh)
+{
+ qDebug() << rh;
+ return *this;
+}
+#endif
+} // namespace libbsarch