ALib C++ Framework
by
Library Version:
2605 R0
Documentation generated by
Loading...
Searching...
No Matches
ALib
src
alib
system
console.cpp
1
namespace
alib::system
{
2
3
// static instance representing current process
4
int
Console::lastReceivedWidth
= -1;
5
6
7
int
Console::GetWidth
(
bool
forceRedetect,
int
defaultWidth ) {
8
if
(
Console::lastReceivedWidth
> 0 && !forceRedetect )
9
return
Console::lastReceivedWidth
;
10
11
#if defined (_WIN32)
12
13
#elif defined(__GLIBC__) && defined(__unix__) || defined(__ANDROID_NDK__)
14
15
struct
winsize w;
16
if
( ioctl(STDOUT_FILENO, TIOCGWINSZ, &w) != 0 )
17
Console::lastReceivedWidth
= -1;
18
else
19
Console::lastReceivedWidth
= w.ws_col;
20
21
#elif defined (__APPLE__)
22
23
#else
24
#pragma message ("Unknown Platform in file: " __FILE__ )
25
#endif
26
27
return
Console::lastReceivedWidth
> 0 ?
Console::lastReceivedWidth
: defaultWidth;
28
}
29
30
}
// namespace [ alib::system]
alib::system::Console::GetWidth
static int GetWidth(bool forceRedetect=false, int defaultWidth=80)
Definition
console.cpp:7
alib::system::Console::lastReceivedWidth
static int lastReceivedWidth
Console text width.
Definition
console.hpp:17
alib::system
Definition
console.cpp:1