ObjFW
Loading...
Searching...
No Matches
OFStdIOStream.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2008-2024 Jonathan Schleifer <js@nil.im>
3 *
4 * All rights reserved.
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU Lesser General Public License version 3.0 only,
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
13 * version 3.0 for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * version 3.0 along with this program. If not, see
17 * <https://www.gnu.org/licenses/>.
18 */
19
20#import "OFStream.h"
21#import "OFKernelEventObserver.h"
22
23#ifdef OF_AMIGAOS
24# include <dos/dos.h>
25#endif
26
27OF_ASSUME_NONNULL_BEGIN
28
31@class OFColor;
32
41#ifdef OF_STDIO_STREAM_WIN32_CONSOLE_H
42OF_SUBCLASSING_RESTRICTED
43#endif
45#if !defined(OF_WINDOWS) && !defined(OF_AMIGAOS) && !defined(OF_WII_U)
47#endif
48{
49#if defined(OF_AMIGAOS)
50 BPTR _handle;
51 bool _closable;
52#elif !defined(OF_WII_U)
53 int _fd;
54#endif
55 bool _atEndOfStream;
56}
57
61@property (readonly, nonatomic) bool hasTerminal;
62
67@property (readonly, nonatomic) int columns;
68
73@property (readonly, nonatomic) int rows;
74
75#if defined(OF_WII) || defined(OF_NINTENDO_DS) || defined(OF_NINTENDO_3DS) || \
76 defined(DOXYGEN)
83+ (void)setUpConsole;
84#endif
85
86- (instancetype)init OF_UNAVAILABLE;
87
94- (void)setForegroundColor: (OFColor *)color;
95
102- (void)setBackgroundColor: (OFColor *)color;
103
108- (void)reset;
109
114- (void)clear;
115
120- (void)eraseLine;
121
128- (void)setCursorColumn: (unsigned int)column;
129
136- (void)setCursorPosition: (OFPoint)position;
137
144- (void)setRelativeCursorPosition: (OFPoint)position;
145@end
146
147#ifdef __cplusplus
148extern "C" {
149#endif
155extern OFStdIOStream *_Nullable OFStdIn;
156
160extern OFStdIOStream *_Nullable OFStdOut;
161
165extern OFStdIOStream *_Nullable OFStdErr;
166
174extern void OFLog(OFConstantString *format, ...);
175
184extern void OFLogV(OFConstantString *format, va_list arguments);
185#ifdef __cplusplus
186}
187#endif
188
189OF_ASSUME_NONNULL_END
void OFLog(OFConstantString *format,...)
Logs the specified printf-style format to OFStdErr.
Definition OFStdIOStream.m:113
OFStdIOStream * OFStdIn
The standard input as an OFStream.
Definition OFStdIOStream.m:99
OFStdIOStream * OFStdOut
The standard output as an OFStream.
Definition OFStdIOStream.m:100
void OFLogV(OFConstantString *format, va_list arguments)
Logs the specified printf-style format to OFStdErr.
Definition OFStdIOStream.m:123
OFStdIOStream * OFStdErr
The standard error as an OFStream.
Definition OFStdIOStream.m:101
A class for storing a color.
Definition OFColor.h:30
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:45
A base class for different types of streams.
Definition OFStream.h:280
This protocol is implemented by classes which can be observed for readiness for reading by OFKernelEv...
Definition OFKernelEventObserver.h:83
This protocol is implemented by classes which can be observed for readiness for writing by OFKernelEv...
Definition OFKernelEventObserver.h:97
A point in 2D space.
Definition OFObject.h:161