/* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ /* $Source: src/include/usr/util/utilfile.H $ */ /* */ /* OpenPOWER HostBoot Project */ /* */ /* COPYRIGHT International Business Machines Corp. 2003,2014 */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); */ /* you may not use this file except in compliance with the License. */ /* You may obtain a copy of the License at */ /* */ /* http://www.apache.org/licenses/LICENSE-2.0 */ /* */ /* Unless required by applicable law or agreed to in writing, software */ /* distributed under the License is distributed on an "AS IS" BASIS, */ /* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ /* implied. See the License for the specific language governing */ /* permissions and limitations under the License. */ /* */ /* IBM_PROLOG_END_TAG */ #ifndef UTILFILE_H #define UTILFILE_H /** * @file utilfile.H * * @brief File Stream manipulation * * Used for creating and manipulating file streams * */ /*****************************************************************************/ // I n c l u d e s /*****************************************************************************/ // Utility Includes #include #include #include /*****************************************************************************/ // File Stream class /*****************************************************************************/ /** * @brief Utility file stream class * * Used for file streams * */ class UtilFile : public UtilStream { public: /** * @brief Default Constructor * * Initializes internals to NULL and will thus cause an exception if * an invalid operation is performed ( such as writing to the file * without opening it ) * */ UtilFile(); /** * @brief Constructor * * Initializes internals of the file stream object with the file path name. * */ UtilFile(const char * i_filePathName); /** * @brief Destructor * * 1. Closes the file ( if it's open ) * 2. Deletes allocated resources * 3. Deletes any pending error logs ( effectively aborting ) * */ virtual ~UtilFile(); /** * @brief Determines if the file is available in the filesystem * * Attempts to open the file for readonly to determine if it exists * in the file system. Secondary failures are not reported by * this interface. * * @return * Bool: true, the file exists. false, it doesn't exist or a * secondary failure occurred while making the determination. * */ bool exists( void ) const; /** * @brief Determines if the file is available in the filesystem * * This is a static function that to determine if it exists * in the file system and is a REGULAR file. * Secondary failures are not reported by this interface. * * @return * Bool: true, the file exists. false, it doesn't exist or a * secondary failure occurred while making the determination. * */ static bool exists(const char * ); /** * @brief Open the file associated with the object * * Opens the file based off of the file name associated with the object * with the specified file mode by calling Open with the flag set to false * to always open the flash file by default. * * @return * Nothing. Errors are deferred until the user calls getLastError * */ void Open( const char * i_mode ///