Added new classes for file system and interfaces for it + introduced CloseableFile.
authorRoland Haeder <roland@mxchange.org>
Thu, 27 Aug 2015 01:36:26 +0000 (03:36 +0200)
committerRoland Haeder <roland@mxchange.org>
Thu, 27 Aug 2015 01:36:26 +0000 (03:36 +0200)
Signed-off-by: Roland Häder <roland@mxchange.org>
inc/main/classes/file_directories/class_BaseAbstractFile.php
inc/main/classes/file_directories/class_BaseFileIo.php
inc/main/classes/filesystem/.htaccess [new file with mode: 0644]
inc/main/classes/filesystem/class_ [new file with mode: 0644]
inc/main/classes/filesystem/class_BaseFilesystem.php [new file with mode: 0644]
inc/main/interfaces/filesystem/.htaccess [new file with mode: 0644]
inc/main/interfaces/filesystem/class_Filesystem.php [new file with mode: 0644]
inc/main/interfaces/io/class_CloseableFile.php [new file with mode: 0644]

index e26c58bbcefd3b06b4c8364a6b902e8fafa889f9..862c725c47e7e06e4f2f99b15e9c673cdbaed712 100644 (file)
@@ -21,7 +21,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
-class BaseAbstractFile extends BaseFrameworkSystem {
+class BaseAbstractFile extends BaseFrameworkSystem implements FilePointer, CloseableFile {
        /**
         * Counter for total entries
         */
@@ -133,7 +133,7 @@ class BaseAbstractFile extends BaseFrameworkSystem {
         *
         * @return      void
         */
-       private function closeFile () {
+       public function closeFile () {
                // Debug message
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d]: fileName=%s - CALLED!', __METHOD__, __LINE__, $this->getFileName()));
 
index d52d02fa1b00c7e6d5ef8c9caa0d5eed68ef3967..2f9b6f8da33786d73cbb369db865de696bca74af 100644 (file)
@@ -21,7 +21,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
-class BaseFileIo extends BaseFrameworkSystem {
+class BaseFileIo extends BaseFrameworkSystem implements FilePointer, CloseableFile {
        /**
         * The current file we are working in
         */
@@ -67,7 +67,7 @@ class BaseFileIo extends BaseFrameworkSystem {
         * @throws      NullPointerException    If the file pointer instance is not set by setPointer()
         * @throws      InvalidResourceException        If there is being set
         */
-       private function closeFile () {
+       public function closeFile () {
                // Debug message
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(sprintf('[%s:%d]: fileName=%s - CALLED!', __METHOD__, __LINE__, $this->getFileName()));
 
diff --git a/inc/main/classes/filesystem/.htaccess b/inc/main/classes/filesystem/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/main/classes/filesystem/class_ b/inc/main/classes/filesystem/class_
new file mode 100644 (file)
index 0000000..5a72678
--- /dev/null
@@ -0,0 +1,51 @@
+<?php
+/**
+ * A ??? virtual file system class
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 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 <http://www.gnu.org/licenses/>.
+ */
+class ???Filesystem extends BaseFilesystem implements Filesystem {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this Filesystem class and prepares it for usage
+        *
+        * @param       $appInstance    A manageable application
+        * @return      $///Instance    An instance of this Filesystem class
+        */
+       public final static function create???Filesystem (ManageableApplication $appInstance) {
+               // Get a new instance
+               $///Instance = new ???Filesystem();
+
+               // Return the prepared instance
+               return $///Instance;
+       }
+}
+
+// [EOF]
+?>
diff --git a/inc/main/classes/filesystem/class_BaseFilesystem.php b/inc/main/classes/filesystem/class_BaseFilesystem.php
new file mode 100644 (file)
index 0000000..bbaea50
--- /dev/null
@@ -0,0 +1,39 @@
+<?php
+/**
+ * A general virtual file system class. For example the feature 'fuse' is using
+ * this heavily.
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 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 <http://www.gnu.org/licenses/>.
+ */
+class BaseFilesystem extends BaseFrameworkSystem {
+       /**
+        * Protected constructor
+        *
+        * @param       $className      Name of the class
+        * @return      void
+        */
+       protected function __construct ($className) {
+               // Call parent constructor
+               parent::__construct($className);
+       }
+}
+
+// [EOF]
+?>
diff --git a/inc/main/interfaces/filesystem/.htaccess b/inc/main/interfaces/filesystem/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/inc/main/interfaces/filesystem/class_Filesystem.php b/inc/main/interfaces/filesystem/class_Filesystem.php
new file mode 100644 (file)
index 0000000..e2c4ad5
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+/**
+ * A virtual file system interface
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 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 <http://www.gnu.org/licenses/>.
+ */
+interface Filesystem extends FrameworkInterface {
+}
+
+// [EOF]
+?>
diff --git a/inc/main/interfaces/io/class_CloseableFile.php b/inc/main/interfaces/io/class_CloseableFile.php
new file mode 100644 (file)
index 0000000..c2608e8
--- /dev/null
@@ -0,0 +1,37 @@
+<?php
+/**
+ * An interface for closeable files
+ *
+ * @author             Roland Haeder <webmaster@shipsimu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Core Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.shipsimu.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 <http://www.gnu.org/licenses/>.
+ */
+interface CloseableFile extends FrameworkInterface {
+       /**
+        * Close a file source and set it's instance to null and the file name
+        * to empty.
+        *
+        * @return      void
+        * @throws      NullPointerException    If the file pointer instance is not set by setPointer()
+        * @throws      InvalidResourceException        If there is being set
+        */
+       function closeFile ();
+}
+
+// [EOF]
+?>