OW_FileSystem.hpp

Go to the documentation of this file.
00001 /*******************************************************************************
00002 * Copyright (C) 2001-2004 Vintela, Inc. All rights reserved.
00003 *
00004 * Redistribution and use in source and binary forms, with or without
00005 * modification, are permitted provided that the following conditions are met:
00006 *
00007 *  - Redistributions of source code must retain the above copyright notice,
00008 *    this list of conditions and the following disclaimer.
00009 *
00010 *  - Redistributions in binary form must reproduce the above copyright notice,
00011 *    this list of conditions and the following disclaimer in the documentation
00012 *    and/or other materials provided with the distribution.
00013 *
00014 *  - Neither the name of Vintela, Inc. nor the names of its
00015 *    contributors may be used to endorse or promote products derived from this
00016 *    software without specific prior written permission.
00017 *
00018 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
00019 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00020 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00021 * ARE DISCLAIMED. IN NO EVENT SHALL Vintela, Inc. OR THE CONTRIBUTORS
00022 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00023 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00024 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00025 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00026 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00027 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00028 * POSSIBILITY OF SUCH DAMAGE.
00029 *******************************************************************************/
00030 
00036 #ifndef OW_FILESYSTEM_HPP_INCLUDE_GUARD_
00037 #define OW_FILESYSTEM_HPP_INCLUDE_GUARD_
00038 #include "OW_config.h"
00039 #include "OW_Types.hpp"
00040 #include "OW_ArrayFwd.hpp"
00041 #include "OW_Exception.hpp"
00042 #include "OW_CommonFwd.hpp"
00043 
00044 #ifdef OW_HAVE_SYS_PARAM_H
00045 #include <sys/param.h>
00046 #endif
00047 #ifndef MAXPATHLEN
00048 #ifdef PATH_MAX
00049 #define MAXPATHLEN PATH_MAX
00050 #else
00051 #define MAXPATHLEN 1024
00052 #endif
00053 #endif
00054 
00055 namespace OW_NAMESPACE
00056 {
00057 
00058 OW_DECLARE_APIEXCEPTION(FileSystem, OW_COMMON_API)
00059 
00060 
00064 namespace FileSystem
00065 {
00070    OW_COMMON_API File openFile(const String& path);
00078    OW_COMMON_API File createFile(const String& path);
00085    OW_COMMON_API File openOrCreateFile(const String& path);
00092    OW_COMMON_API int changeFileOwner(const String& filename,
00093       const UserId& userId);
00097    OW_COMMON_API bool exists(const String& path);
00098 #ifndef OW_WIN32
00099 
00107    OW_COMMON_API bool isExecutable(const String& path);
00108 #endif
00109 
00112    OW_COMMON_API bool canRead(const String& path);
00116    OW_COMMON_API bool canWrite(const String& path);
00117 #ifndef OW_WIN32
00118 
00126    OW_COMMON_API bool isLink(const String& path);
00127 #endif
00128 
00131    OW_COMMON_API bool isDirectory(const String& path);
00137    OW_COMMON_API bool changeDirectory(const String& path);
00144    OW_COMMON_API bool makeDirectory(const String& path, int mode=0777);
00151    OW_COMMON_API bool getFileSize(const String& path, off_t& size);
00157    OW_COMMON_API bool removeDirectory(const String& path);
00163    OW_COMMON_API bool removeFile(const String& path);
00170    OW_COMMON_API bool getDirectoryContents(const String& path,
00171       StringArray& dirEntries);
00178    OW_COMMON_API bool renameFile(const String& oldFileName,
00179       const String& newFileName);
00191    OW_COMMON_API size_t read(const FileHandle& hdl, void* bfr, size_t numberOfBytes,
00192       off_t offset=-1L);
00203    OW_COMMON_API size_t write(FileHandle& hdl, const void* bfr,
00204       size_t numberOfBytes, off_t offset=-1L);
00216    OW_COMMON_API off_t seek(const FileHandle& hdl, off_t offset, int whence);
00222    OW_COMMON_API off_t tell(const FileHandle& hdl);
00228    OW_COMMON_API void rewind(const FileHandle& hdl);
00234    OW_COMMON_API int close(const FileHandle& hdl);
00239    OW_COMMON_API int flush(FileHandle& hdl);
00245    OW_COMMON_API void initRandomFile(const String& file) OW_DEPRECATED;
00253    OW_COMMON_API String getFileContents(const String& filename);
00254    
00262    OW_COMMON_API StringArray getFileLines(const String& filename);
00263 
00270    OW_COMMON_API String readSymbolicLink(const String& path);
00271 
00272    namespace Path
00273    {
00284       OW_COMMON_API String realPath(const String& path);
00285 
00296       OW_COMMON_API String dirname(const String& filename);
00297 
00304       OW_COMMON_API String getCurrentWorkingDirectory();
00305 
00306 
00307    } // end namespace Path
00308 
00309 } // end namespace FileSystem
00310 
00311 } // end namespace OW_NAMESPACE
00312 
00313 #endif

Generated on Thu Feb 9 08:47:59 2006 for openwbem by  doxygen 1.4.6