ObjFW
src/OFFile.h
00001 /*
00002  * Copyright (c) 2008, 2009, 2010, 2011, 2012
00003  *   Jonathan Schleifer <js@webkeks.org>
00004  *
00005  * All rights reserved.
00006  *
00007  * This file is part of ObjFW. It may be distributed under the terms of the
00008  * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
00009  * the packaging of this file.
00010  *
00011  * Alternatively, it may be distributed under the terms of the GNU General
00012  * Public License, either version 2 or 3, which can be found in the file
00013  * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
00014  * file.
00015  */
00016 
00017 #ifndef __STDC_LIMIT_MACROS
00018 # define __STDC_LIMIT_MACROS
00019 #endif
00020 #ifndef __STDC_CONSTANT_MACROS
00021 # define __STDC_CONSTANT_MACROS
00022 #endif
00023 
00024 #include <sys/types.h>
00025 
00026 #import "OFSeekableStream.h"
00027 
00028 @class OFArray;
00029 @class OFDate;
00030 
00031 #ifdef __cplusplus
00032 extern "C" {
00033 #endif
00034 extern void of_log(OFConstantString*, ...);
00035 #ifdef __cplusplus
00036 }
00037 #endif
00038 
00042 @interface OFFile: OFSeekableStream
00043 {
00044         int  fileDescriptor;
00045         BOOL closable;
00046         BOOL atEndOfStream;
00047 }
00048 
00056 + fileWithPath: (OFString*)path
00057           mode: (OFString*)mode;
00058 
00066 + fileWithFileDescriptor: (int)fileDescriptor;
00067 
00073 + (OFString*)currentDirectoryPath;
00074 
00081 + (BOOL)fileExistsAtPath: (OFString*)path;
00082 
00089 + (BOOL)directoryExistsAtPath: (OFString*)path;
00090 
00096 + (void)createDirectoryAtPath: (OFString*)path;
00097 
00104 + (OFArray*)filesInDirectoryAtPath: (OFString*)path;
00105 
00111 + (void)changeToDirectory: (OFString*)path;
00112 
00118 + (OFDate*)modificationDateOfFile: (OFString*)path;
00119 
00120 #ifndef _PSP
00121 
00130 + (void)changeModeOfFile: (OFString*)path
00131                   toMode: (mode_t)mode;
00132 #endif
00133 
00134 #if !defined(_WIN32) && !defined(_PSP)
00135 
00145 + (void)changeOwnerOfFile: (OFString*)path
00146                   toOwner: (OFString*)owner
00147                     group: (OFString*)group;
00148 #endif
00149 
00156 + (void)copyFileAtPath: (OFString*)source
00157                 toPath: (OFString*)destination;
00158 
00165 + (void)renameFileAtPath: (OFString*)source
00166                   toPath: (OFString*)destination;
00167 
00173 + (void)deleteFileAtPath: (OFString*)path;
00174 
00180 + (void)deleteDirectoryAtPath: (OFString*)path;
00181 
00182 #ifndef _WIN32
00183 
00191 + (void)linkFileAtPath: (OFString*)source
00192                 toPath: (OFString*)destination;
00193 #endif
00194 
00195 #if !defined(_WIN32) && !defined(_PSP)
00196 
00204 + (void)symlinkFileAtPath: (OFString*)source
00205                    toPath: (OFString*)destination;
00206 #endif
00207 
00215 - initWithPath: (OFString*)path
00216           mode: (OFString*)mode;
00217 
00224 - initWithFileDescriptor: (int)fileDescriptor;
00225 @end
00226 
00227 #ifdef __cplusplus
00228 extern "C" {
00229 #endif
00230 extern OFStream *of_stdin;
00231 extern OFStream *of_stdout;
00232 extern OFStream *of_stderr;
00233 #ifdef __cplusplus
00234 }
00235 #endif
 All Classes Functions Variables Properties