summaryrefslogtreecommitdiff
path: root/include/streams.h
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-03-23 18:48:24 +0100
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-03-23 18:48:24 +0100
commitd8b25fe2e585634567483124a33c3b779d2516f5 (patch)
tree3b46d9fd93b443d4c27f24ba01f9f46858a60f29 /include/streams.h
parent5852a65e876421b118de9e76a9f83388be590690 (diff)
implemented php output streams as was asked for in issue #51
Diffstat (limited to 'include/streams.h')
-rw-r--r--include/streams.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/include/streams.h b/include/streams.h
new file mode 100644
index 0000000..c4d5339
--- /dev/null
+++ b/include/streams.h
@@ -0,0 +1,34 @@
+/**
+ * Streams.h
+ *
+ * Just like the standard std::cout and std::cerr objects to output data, you
+ * can use similar stream objects for outputting data to PHP. Php::out is the
+ * C++ equivalent of the PHP echo() function, and Php::err() is the C++ stream
+ * that behaves like calling trigger_error() from PHP.
+ *
+ * Php::out << "this is example text" << std::endl;
+ * Php::err << "this is an error message" << std::endl;
+ *
+ * @author Emiel Bruijntjes <emiel.bruijntjes@copernica.com>
+ * @copyright 2014 Copernica BV
+ */
+
+/**
+ * Set up namespace
+ */
+namespace Php {
+
+/**
+ * Define the out and err objects
+ */
+extern std::ostream out;
+extern std::ostream error;
+extern std::ostream notice;
+extern std::ostream warning;
+extern std::ostream deprecated;
+
+/**
+ * End namespace
+ */
+}
+