ObjFW
OFStdIOStream.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008-2021 Jonathan Schleifer <js@nil.im>
3  *
4  * All rights reserved.
5  *
6  * This file is part of ObjFW. It may be distributed under the terms of the
7  * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
8  * the packaging of this file.
9  *
10  * Alternatively, it may be distributed under the terms of the GNU General
11  * Public License, either version 2 or 3, which can be found in the file
12  * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
13  * file.
14  */
15 
16 #import "OFStream.h"
17 #import "OFKernelEventObserver.h"
18 
19 #ifdef OF_AMIGAOS
20 # include <dos/dos.h>
21 #endif
22 
23 OF_ASSUME_NONNULL_BEGIN
24 
27 @class OFColor;
28 
37 #ifdef OF_STDIO_STREAM_WIN32_CONSOLE_H
38 OF_SUBCLASSING_RESTRICTED
39 #endif
41 #if !defined(OF_WINDOWS) && !defined(OF_AMIGAOS)
43 #endif
44 {
45 #ifndef OF_AMIGAOS
46  int _fd;
47 #else
48  BPTR _handle;
49  bool _closable;
50 #endif
51  bool _atEndOfStream;
52 }
53 
57 @property (readonly, nonatomic) bool hasTerminal;
58 
63 @property (readonly, nonatomic) int columns;
64 
69 @property (readonly, nonatomic) int rows;
70 
71 - (instancetype)init OF_UNAVAILABLE;
72 
79 - (void)setForegroundColor: (OFColor *)color;
80 
87 - (void)setBackgroundColor: (OFColor *)color;
88 
93 - (void)reset;
94 
99 - (void)clear;
100 
105 - (void)eraseLine;
106 
113 - (void)setCursorColumn: (unsigned int)column;
114 
121 - (void)setCursorPosition: (of_point_t)position;
122 
129 - (void)setRelativeCursorPosition: (of_point_t)position;
130 @end
131 
132 #ifdef __cplusplus
133 extern "C" {
134 #endif
140 extern OFStdIOStream *_Nullable of_stdin;
141 
145 extern OFStdIOStream *_Nullable of_stdout;
146 
150 extern OFStdIOStream *_Nullable of_stderr;
151 
158 extern void of_log(OFConstantString *format, ...);
159 #ifdef __cplusplus
160 }
161 #endif
162 
163 OF_ASSUME_NONNULL_END
void of_log(OFConstantString *format,...)
Log the specified printf-style format to of_stderr.
Definition: OFStdIOStream.m:78
OFStdIOStream *_Nullable of_stdout
The standard output as an OFStream.
Definition: OFStdIOStream.m:65
OFStdIOStream *_Nullable of_stderr
The standard error as an OFStream.
Definition: OFStdIOStream.m:66
OFStdIOStream *_Nullable of_stdin
The standard input as an OFStream.
Definition: OFStdIOStream.m:64
A class for storing a color.
Definition: OFColor.h:26
A class for storing constant strings using the @"" literal.
Definition: OFConstantString.h:42
A class for providing standard input, output and error as OFStream.
Definition: OFStdIOStream.h:41
A base class for different types of streams.
Definition: OFStream.h:191
This protocol is implemented by classes which can be observed for readiness for reading by OFKernelEv...
Definition: OFKernelEventObserver.h:85
This protocol is implemented by classes which can be observed for readiness for writing by OFKernelEv...
Definition: OFKernelEventObserver.h:100
A point.
Definition: OFObject.h:145