From 57fd3f16226ca5a22b8d8dc07ae858415c0e8e9b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Thu, 14 Apr 2011 20:41:26 +0000 Subject: [PATCH] Added new general I/O stream classes and interfaces. Still the interfaces have no methods but they will be added soon --- .gitattributes | 8 ++++ .../interfaces/streams/input/.htaccess | 1 + .../streams/input/class_InputStreamable.php | 28 ++++++++++++++ .../interfaces/streams/output/.htaccess | 1 + .../streams/output/class_OutputStreamable.php | 28 ++++++++++++++ .../main/output/class_ConsoleOutput.php | 5 ++- inc/classes/main/output/class_WebOutput.php | 2 +- inc/classes/main/streams/class_ | 2 +- .../streams/crypto/class_NullCryptoStream.php | 2 +- inc/classes/main/streams/input/.htaccess | 1 + .../streams/input/class_BaseInputStream.php | 37 +++++++++++++++++++ inc/classes/main/streams/output/.htaccess | 1 + .../streams/output/class_BaseOutputStream.php | 37 +++++++++++++++++++ 13 files changed, 149 insertions(+), 4 deletions(-) create mode 100644 inc/classes/interfaces/streams/input/.htaccess create mode 100644 inc/classes/interfaces/streams/input/class_InputStreamable.php create mode 100644 inc/classes/interfaces/streams/output/.htaccess create mode 100644 inc/classes/interfaces/streams/output/class_OutputStreamable.php create mode 100644 inc/classes/main/streams/input/.htaccess create mode 100644 inc/classes/main/streams/input/class_BaseInputStream.php create mode 100644 inc/classes/main/streams/output/.htaccess create mode 100644 inc/classes/main/streams/output/class_BaseOutputStream.php diff --git a/.gitattributes b/.gitattributes index 4180940b..adabfe5b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -231,6 +231,10 @@ inc/classes/interfaces/streams/.htaccess -text svneol=unset#text/plain inc/classes/interfaces/streams/class_Streamable.php -text svneol=unset#text/plain inc/classes/interfaces/streams/crypto/.htaccess -text svneol=unset#text/plain inc/classes/interfaces/streams/crypto/class_EncryptableStream.php -text svneol=unset#text/plain +inc/classes/interfaces/streams/input/.htaccess svneol=native#text/plain +inc/classes/interfaces/streams/input/class_InputStreamable.php svneol=native#text/plain +inc/classes/interfaces/streams/output/.htaccess svneol=native#text/plain +inc/classes/interfaces/streams/output/class_OutputStreamable.php svneol=native#text/plain inc/classes/interfaces/template/.htaccess -text svneol=unset#text/plain inc/classes/interfaces/template/class_CompileableTemplate.php -text svneol=unset#text/plain inc/classes/interfaces/template/view/class_ViewHelper.php -text svneol=unset#text/plain @@ -523,6 +527,10 @@ inc/classes/main/streams/class_BaseStream.php -text svneol=unset#text/plain inc/classes/main/streams/crypto/.htaccess -text svneol=unset#text/plain inc/classes/main/streams/crypto/class_McryptStream.php -text svneol=unset#text/plain inc/classes/main/streams/crypto/class_NullCryptoStream.php -text svneol=unset#text/plain +inc/classes/main/streams/input/.htaccess svneol=native#text/plain +inc/classes/main/streams/input/class_BaseInputStream.php svneol=native#text/plain +inc/classes/main/streams/output/.htaccess svneol=native#text/plain +inc/classes/main/streams/output/class_BaseOutputStream.php svneol=native#text/plain inc/classes/main/template/.htaccess -text svneol=unset#text/plain inc/classes/main/template/class_ -text svneol=unset#text/plain inc/classes/main/template/class_BaseTemplateEngine.php -text svneol=unset#text/plain diff --git a/inc/classes/interfaces/streams/input/.htaccess b/inc/classes/interfaces/streams/input/.htaccess new file mode 100644 index 00000000..3a428827 --- /dev/null +++ b/inc/classes/interfaces/streams/input/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/interfaces/streams/input/class_InputStreamable.php b/inc/classes/interfaces/streams/input/class_InputStreamable.php new file mode 100644 index 00000000..bb0f5381 --- /dev/null +++ b/inc/classes/interfaces/streams/input/class_InputStreamable.php @@ -0,0 +1,28 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Core Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +interface InputStreamable extends Streamable { +} + +// [EOF] +?> diff --git a/inc/classes/interfaces/streams/output/.htaccess b/inc/classes/interfaces/streams/output/.htaccess new file mode 100644 index 00000000..3a428827 --- /dev/null +++ b/inc/classes/interfaces/streams/output/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/interfaces/streams/output/class_OutputStreamable.php b/inc/classes/interfaces/streams/output/class_OutputStreamable.php new file mode 100644 index 00000000..c3dbddba --- /dev/null +++ b/inc/classes/interfaces/streams/output/class_OutputStreamable.php @@ -0,0 +1,28 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Core Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +interface OutputStreamable extends Streamable { +} + +// [EOF] +?> diff --git a/inc/classes/main/output/class_ConsoleOutput.php b/inc/classes/main/output/class_ConsoleOutput.php index 9c21c444..38379b28 100644 --- a/inc/classes/main/output/class_ConsoleOutput.php +++ b/inc/classes/main/output/class_ConsoleOutput.php @@ -70,10 +70,13 @@ class ConsoleOutput extends BaseFrameworkSystem implements OutputStreamer { * @return $consoleInstance An instance of this class */ public static final function getInstance() { + // Is the self-instance already set? if (is_null(self::$consoleInstance)) { $contentType = FrameworkConfiguration::getInstance()->getConfigEntry('web_content_type'); self::$consoleInstance = ConsoleOutput::createConsoleOutput($contentType); - } + } // END - if + + // Return the instance return self::$consoleInstance; } diff --git a/inc/classes/main/output/class_WebOutput.php b/inc/classes/main/output/class_WebOutput.php index 9c44b06e..ff175d0b 100644 --- a/inc/classes/main/output/class_WebOutput.php +++ b/inc/classes/main/output/class_WebOutput.php @@ -45,7 +45,7 @@ class WebOutput extends BaseFrameworkSystem implements OutputStreamer, Registera * @return $debugInstance An instance of this middleware class */ public static final function createWebOutput (ManageableApplication $applicationInstance) { - // Is there no instance? + // Is the self-instance already set? if (is_null(self::$webInstance)) { // Get a new instance and set it self::$webInstance = new WebOutput(); diff --git a/inc/classes/main/streams/class_ b/inc/classes/main/streams/class_ index 5da46a42..d556b5ba 100644 --- a/inc/classes/main/streams/class_ +++ b/inc/classes/main/streams/class_ @@ -1,6 +1,6 @@ * @version 0.0.0 diff --git a/inc/classes/main/streams/crypto/class_NullCryptoStream.php b/inc/classes/main/streams/crypto/class_NullCryptoStream.php index b7c1cf2e..bcaab6f0 100644 --- a/inc/classes/main/streams/crypto/class_NullCryptoStream.php +++ b/inc/classes/main/streams/crypto/class_NullCryptoStream.php @@ -66,7 +66,7 @@ class NullCryptoStream extends BaseStream implements EncryptableStream { * @param $encrypted Encrypted string * @return $str The unencrypted string */ - function decryptStream ($encrypted) { + public function decryptStream ($encrypted) { // Just handle it over $str = (string) $encrypted; diff --git a/inc/classes/main/streams/input/.htaccess b/inc/classes/main/streams/input/.htaccess new file mode 100644 index 00000000..3a428827 --- /dev/null +++ b/inc/classes/main/streams/input/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/main/streams/input/class_BaseInputStream.php b/inc/classes/main/streams/input/class_BaseInputStream.php new file mode 100644 index 00000000..353eda9e --- /dev/null +++ b/inc/classes/main/streams/input/class_BaseInputStream.php @@ -0,0 +1,37 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class BaseInputStream extends BaseStream { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } +} + +// [EOF] +?> diff --git a/inc/classes/main/streams/output/.htaccess b/inc/classes/main/streams/output/.htaccess new file mode 100644 index 00000000..3a428827 --- /dev/null +++ b/inc/classes/main/streams/output/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/main/streams/output/class_BaseOutputStream.php b/inc/classes/main/streams/output/class_BaseOutputStream.php new file mode 100644 index 00000000..d76a1cbd --- /dev/null +++ b/inc/classes/main/streams/output/class_BaseOutputStream.php @@ -0,0 +1,37 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class BaseOutputStream extends BaseStream { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } +} + +// [EOF] +?> -- 2.30.2