ObjFW
OFStdIOStream.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008-2023 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) && !defined(OF_WII_U)
43 #endif
44 {
45 #if defined(OF_AMIGAOS)
46  BPTR _handle;
47  bool _closable;
48 #elif !defined(OF_WII_U)
49  int _fd;
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: (OFPoint)position;
122 
129 - (void)setRelativeCursorPosition: (OFPoint)position;
130 @end
131 
132 #ifdef __cplusplus
133 extern "C" {
134 #endif
135 
140 extern OFStdIOStream *_Nullable OFStdIn;
141 
145 extern OFStdIOStream *_Nullable OFStdOut;
146 
150 extern OFStdIOStream *_Nullable OFStdErr;
151 
159 extern void OFLog(OFConstantString *format, ...);
160 
169 extern void OFLogV(OFConstantString *format, va_list arguments);
170 #ifdef __cplusplus
171 }
172 #endif
173 
174 OF_ASSUME_NONNULL_END
void OFLogV(OFConstantString *format, va_list arguments)
Logs the specified printf-style format to OFStdErr.
Definition: OFStdIOStream.m:96
This protocol is implemented by classes which can be observed for readiness for reading by OFKernelEv...
A class for storing a color.
Definition: OFColor.h:25
A class for storing constant strings using the @"" literal.
Definition: OFConstantString.h:37
OFStdIOStream * OFStdIn
The standard input as an OFStream.
Definition: OFStdIOStream.m:72
OFStdIOStream * OFStdOut
The standard output as an OFStream.
Definition: OFStdIOStream.m:73
A base class for different types of streams.
Definition: OFStream.h:186
OFStdIOStream * OFStdErr
The standard error as an OFStream.
Definition: OFStdIOStream.m:74
A class for providing standard input, output and error as OFStream.
Definition: OFStdIOStream.h:40
This protocol is implemented by classes which can be observed for readiness for writing by OFKernelEv...
void OFLog(OFConstantString *format,...)
Logs the specified printf-style format to OFStdErr.
Definition: OFStdIOStream.m:86
A point in 2D space.
Definition: OFObject.h:157