~ubuntu-branches/ubuntu/edgy/sope/edgy

« back to all changes in this revision

Viewing changes to libFoundation/Foundation/NSConcreteFileHandle.h

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Ley
  • Date: 2005-08-19 16:53:31 UTC
  • Revision ID: james.westby@ubuntu.com-20050819165331-hs683wz1osm708pw
Tags: upstream-4.4rc.2
ImportĀ upstreamĀ versionĀ 4.4rc.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
   NSConcreteFileHandle.h
 
3
 
 
4
   Copyright (C) 1995, 1996, 1997 Ovidiu Predescu and Mircea Oancea.
 
5
   All rights reserved.
 
6
 
 
7
   Author: Ovidiu Predescu <ovidiu@net-community.com>
 
8
   Date: May 1997
 
9
 
 
10
   This file is part of libFoundation.
 
11
 
 
12
   Permission to use, copy, modify, and distribute this software and its
 
13
   documentation for any purpose and without fee is hereby granted, provided
 
14
   that the above copyright notice appear in all copies and that both that
 
15
   copyright notice and this permission notice appear in supporting
 
16
   documentation.
 
17
 
 
18
   We disclaim all warranties with regard to this software, including all
 
19
   implied warranties of merchantability and fitness, in no event shall
 
20
   we be liable for any special, indirect or consequential damages or any
 
21
   damages whatsoever resulting from loss of use, data or profits, whether in
 
22
   an action of contract, negligence or other tortious action, arising out of
 
23
   or in connection with the use or performance of this software.
 
24
*/
 
25
#ifndef __NSConcreteFileHandle_h__
 
26
#define __NSConcreteFileHandle_h__
 
27
 
 
28
#include <Foundation/NSPosixFileDescriptor.h>
 
29
#include <Foundation/NSFileHandle.h>
 
30
 
 
31
@class NSPosixFileDescriptor;
 
32
 
 
33
typedef enum {
 
34
    NSFileHandleNoOperation = 0,
 
35
    NSFileHandleAcceptOperation,
 
36
    NSFileHandleReadOperation,
 
37
    NSFileHandleReadToEndOfFileOperation
 
38
} NSFileHandleOperation;
 
39
 
 
40
typedef enum {
 
41
    NSFileHandleNoType = 0,
 
42
    NSFileHandleSocket,
 
43
    NSFileHandleUnixFile
 
44
} NSFileHandleType;
 
45
 
 
46
@class NSArray;
 
47
@class NSData;
 
48
@class NSMutableData;
 
49
 
 
50
@interface NSConcreteFileHandle : NSPosixFileDescriptor
 
51
{
 
52
    int                   blockSize;
 
53
    BOOL                  closeOnDealloc;
 
54
    BOOL                  isOpened;
 
55
    NSFileHandleOperation operation;
 
56
    NSFileHandleType      type;
 
57
    NSArray               *modes;
 
58
}
 
59
 
 
60
/* Creating an NSFileHandle */
 
61
- (id)initWithFileDescriptor:(int)fd;
 
62
- (id)initWithFileDescriptor:(int)fd closeOnDealloc:(BOOL)flag;
 
63
- (id)initWithPath:(NSString *)aPath flags:(int)flags createMode:(int)mode;
 
64
 
 
65
@end
 
66
 
 
67
 
 
68
@interface NSConcreteFileHandle (NSFileHandleOperations)
 
69
 
 
70
/* Getting a file descriptor */
 
71
- (int)fileDescriptor;
 
72
 
 
73
/* Reading from an NSFileHandle */
 
74
- (NSData *)availableData;
 
75
- (NSData *)readDataToEndOfFile;
 
76
- (NSData *)readDataOfLength:(unsigned int)length;
 
77
 
 
78
/* Writing to an NSFileHandle */
 
79
- (void)writeData:(NSData *)data;
 
80
 
 
81
/* Communicating asynchronously in the background */
 
82
- (void)acceptConnectionInBackgroundAndNotifyForModes:(NSArray *)modes;
 
83
- (void)acceptConnectionInBackgroundAndNotify;
 
84
- (void)readInBackgroundAndNotifyForModes:(NSArray *)modes;
 
85
- (void)readInBackgroundAndNotify;
 
86
- (void)readToEndOfFileInBackgroundAndNotifyForModes:(NSArray *)modes;
 
87
- (void)readToEndOfFileInBackgroundAndNotify;
 
88
 
 
89
/* Seeking within a file */
 
90
- (unsigned long long)offsetInFile;
 
91
- (unsigned long long)seekToEndOfFile;
 
92
- (void)seekToFileOffset:(unsigned long long)offset;
 
93
 
 
94
/* Operating on a file */
 
95
- (void)closeFile;
 
96
- (void)synchronizeFile;
 
97
- (void)truncateFileAtOffset:(unsigned long long)offset;
 
98
 
 
99
@end
 
100
 
 
101
 
 
102
@interface NSNullDeviceFileHandle : NSFileHandle
 
103
@end
 
104
 
 
105
@interface NSConcretePipeFileHandle : NSFileHandle
 
106
{
 
107
    int  fd;
 
108
    BOOL closeOnDealloc;
 
109
}
 
110
 
 
111
@end
 
112
 
 
113
#endif /* __NSConcreteFileHandle_h__ */
 
114
 
 
115
/*
 
116
  Local Variables:
 
117
  c-basic-offset: 4
 
118
  tab-width: 8
 
119
  End:
 
120
*/