aboutsummaryrefslogtreecommitdiff
path: root/source/print.h
diff options
context:
space:
mode:
authorKenneth Benzie (Benie) <k.benzie@codeplay.com>2015-05-22 18:26:19 +0100
committerKenneth Benzie (Benie) <k.benzie@codeplay.com>2015-05-22 18:26:19 +0100
commit83e5a29b06e8e5b379b8fbc261d909457179c995 (patch)
treedd8dde701a2905938dbaccd3235c83ce5ce33d14 /source/print.h
downloadspirv-tools-83e5a29b06e8e5b379b8fbc261d909457179c995.tar.gz
Code drop of the Codeplay spirv-tools source.
This commit contains the source for the SPIRV static library, spirv-as, spirv-dis, and spirv-val tools.
Diffstat (limited to 'source/print.h')
-rw-r--r--source/print.h77
1 files changed, 77 insertions, 0 deletions
diff --git a/source/print.h b/source/print.h
new file mode 100644
index 00000000..6e20da5d
--- /dev/null
+++ b/source/print.h
@@ -0,0 +1,77 @@
+// Copyright (c) 2015 The Khronos Group Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and/or associated documentation files (the
+// "Materials"), to deal in the Materials without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Materials, and to
+// permit persons to whom the Materials are furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Materials.
+//
+// MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
+// KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
+// SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
+// https://www.khronos.org/registry/
+//
+// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+// MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+
+#ifndef _LIBSPIRV_PRINT_H_
+#define _LIBSPIRV_PRINT_H_
+
+#include <iostream>
+#include <sstream>
+
+/// @brief Wrapper for out stream selection
+class out_stream {
+ public:
+ out_stream() : pStream(nullptr) {}
+ out_stream(std::stringstream &stream) : pStream(&stream) {}
+
+ std::ostream &get() {
+ if (pStream) {
+ return *pStream;
+ }
+ return std::cout;
+ }
+
+ private:
+ std::stringstream *pStream;
+};
+
+namespace clr {
+/// @brief Reset console color
+struct reset {
+ operator const char *();
+};
+/// @brief Set console color to grey
+struct grey {
+ operator const char *();
+};
+/// @brief Set console color to red
+struct red {
+ operator const char *();
+};
+/// @brief Set console color to green
+struct green {
+ operator const char *();
+};
+/// @brief Set console color to yellow
+struct yellow {
+ operator const char *();
+};
+/// @brief Set console color to blue
+struct blue {
+ operator const char *();
+};
+}
+
+#endif