2 Copyright (C) 2000-2004 SKYRIX Software AG
4 This file is part of OpenGroupware.org.
6 OGo is free software; you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 OGo is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with OGo; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
22 #ifndef __NGStreams_NGCTextStream_H__
23 #define __NGStreams_NGCTextStream_H__
25 #include <NGStreams/NGStreamsDecls.h>
26 #include <NGStreams/NGStream.h>
27 #include <NGStreams/NGTextStream.h>
28 #include <NGStreams/NGTextStreamProtocols.h>
29 #include <NGStreams/NGFilterStream.h>
33 NGStreams_EXPORT id<NGExtendedTextInputStream> NGTextIn;
34 NGStreams_EXPORT id<NGExtendedTextOutputStream> NGTextOut;
35 NGStreams_EXPORT id<NGExtendedTextOutputStream> NGTextErr;
36 NGStreams_EXPORT void NGInitTextStdio(void);
41 NGCTextStream is a text stream which operates in the operation systems
42 default encoding (it returns the bytes read from the source as characters).
43 Note that the results of the unicode-methods do not necessarily represent a
44 valid unicode character. This is only the case for character codes in the
46 NGCTextStream never returns a character value above 255.
48 To retrieve correctly converted unicode characters use the NGTextStream
52 @interface NGCTextStream : NGTextStream
55 id<NGStream> source; // retained
56 NGIOReadMethodType readBytes;
57 NGIOWriteMethodType writeBytes;
58 BOOL (*flushBuffer)(id, SEL);
61 + (id)textStreamWithInputSource:(id<NGInputStream>)_source;
62 + (id)textStreamWithOutputSource:(id<NGOutputStream>)_source;
63 + (id)textStreamWithSource:(id<NGStream>)_stream;
64 - (id)initWithSource:(id<NGStream>)_stream;
65 - (id)initWithInputSource:(id<NGInputStream>)_source;
66 - (id)initWithOutputSource:(id<NGOutputStream>)_source;
70 - (id<NGStream>)source;
74 - (BOOL)close; // forwarded to source
76 // NGTextInputStream, NGExtendedTextInputStream
78 - (unichar)readCharacter;
79 - (unsigned char)readChar;
81 - (NSString *)readLineAsString;
85 - (NSEnumerator *)lineEnumerator;
87 // NGTextOutputStream, NGExtendedTextOutputStream
89 - (BOOL)writeCharacter:(unichar)_character;
90 - (BOOL)writeString:(NSString *)_string;
97 #endif /* __NGStreams_NGCTextStream_H__ */