9#if !defined (HPP_ALOX_WINDOWS_CONSOLE_LOGGER)
17# if !defined (HPP_ALIB_ALOXMODULE)
20# if !defined (HPP_ALIB_STRINGS_UTIL_TOKENIZER)
23# if !defined(HPP_ALIB_STRINGS_UTIL_SPACES)
27# if !defined(HPP_ALIB_ENUMS_SERIALIZATION)
30# if !defined(HPP_ALIB_CAMP_MESSAGE_REPORT)
33# if !defined (_GLIBCXX_IOSTREAM) && !defined(_IOSTREAM_)
36# if !defined (_STRING_H) && !defined(_INC_STRING)
44using namespace detail;
49 #define W32C_FOREGROUND_MASK 0xFFF0
50 #define W32C_BACKGROUND_MASK 0xFF0F
53 #define W32C_RED FOREGROUND_RED
54 #define W32C_GREEN FOREGROUND_GREEN
55 #define W32C_BLUE FOREGROUND_BLUE
56 #define W32C_CYAN FOREGROUND_GREEN | FOREGROUND_BLUE
57 #define W32C_MAGENTA FOREGROUND_RED | FOREGROUND_BLUE
58 #define W32C_YELLOW FOREGROUND_RED | FOREGROUND_GREEN
59 #define W32C_WHITE FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY
61 #define W32C_GRAY_LIGHT FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE
62 #define W32C_GRAY_DARK FOREGROUND_INTENSITY
84 WORD actualAttributes;
86 HANDLE H= GetStdHandle(STD_OUTPUT_HANDLE);
87 CONSOLE_SCREEN_BUFFER_INFO info;
88 GetConsoleScreenBufferInfo( H, &info );
89 actualAttributes= info.wAttributes;
103 ALIB_WARNING(
"ALOX",
"Unknown value specified in variable: {} = {!Q'}.",
139 HANDLE H= GetStdHandle(STD_OUTPUT_HANDLE);
143 WORD actualAttributes;
145 CONSOLE_SCREEN_BUFFER_INFO info;
146 GetConsoleScreenBufferInfo( H, &info );
147 actualAttributes= info.wAttributes;
149 WORD previousAttributes= actualAttributes;
165 #if !ALIB_CHARACTERS_WIDE
166 WriteConsoleA( H, actual.
Buffer(), (DWORD) actual.
Length(), &ignore, NULL );
168 WriteConsoleW( H, actual.
Buffer(), (DWORD) actual.
Length(), &ignore, NULL );
180 bool isForeGround=
true;
181 if( c ==
'C' || c ==
'c' )
183 isForeGround= c==
'c';
193 if ( colNo >= 0 && colNo < 6) attr= (win32Cols[colNo] | light);
195 else if ( colNo == 6 ) attr= W32C_BLACK;
196 else if ( colNo == 7 ) attr= W32C_WHITE;
197 else if ( colNo == 8 ) attr= light ? W32C_GRAY_LIGHT : W32C_GRAY_DARK;
205 actualAttributes= isForeGround ? ( actualAttributes & W32C_FOREGROUND_MASK ) | attr
206 : ( actualAttributes & W32C_BACKGROUND_MASK ) | (attr << 4);
220 else if ( c ==
't' || c ==
'A' )
223 int extraSpace= c >=
'0' && c <=
'9' ? (int) ( c -
'0' )
224 : (int) ( c -
'A' ) + 10;
228 integer qtySpaces= tabStop - column;
233 while ( qtySpaces > 0 )
237 #if !ALIB_CHARACTERS_WIDE
238 WriteConsoleA( H, spaces.
Buffer(), (DWORD) nextQty, &ignore, NULL );
240 WriteConsoleW( H, spaces.
Buffer(), (DWORD) nextQty, &ignore, NULL );
261 ALIB_WARNING(
"ALOX",
"WindowsConsoleLogger: Unknown ESC code" );
272 std::cout << std::endl;
ALIB_API Priorities Load(Variable &variable)
ALIB_API const String & Fullname()
ALIB_API Variable & Declare(const VariableDecl &declaration, const Box &replacements)
const String & GetString(int idx=0)
ALIB_API integer GetInteger(int idx=0)
config::Configuration & GetConfig()
static constexpr character RED[4]
Select red color for foreground.
static constexpr character GRAY[4]
Select gray color for foreground.
static constexpr character BLUE[4]
Select blue color for foreground.
String16 VerbosityVerbose
String16 VerbosityWarning
@ Foreground
Use light colors for foreground.
@ Never
Never use light colors.
@ Background
Use light colors for background.
textlogger::MetaInfo * MetaInfo
WORD originalConsoleAttributes
virtual ALIB_API void logText(detail::Domain &domain, Verbosity verbosity, AString &msg, detail::ScopeInfo &scope, int lineNumber)
virtual ALIB_API ~WindowsConsoleLogger()
ALIB_API WindowsConsoleLogger(const NString &name=nullptr)
LightColorUsage UseLightColors
TAString & _(const TString< TChar > &src, integer regionStart, integer regionLength=MAX_LEN)
ALIB_API integer SearchAndReplace(TChar needle, TChar replacement, integer startIdx=0)
constexpr bool IsNotEmpty() const
constexpr integer Length() const
TString< TChar > Substring(integer regionStart, integer regionLength=MAX_LEN) const
constexpr const TChar * Buffer() const
integer WStringLength() const
TSubstring & Trim(const TCString< TChar > &whiteSpaces=TT_StringConstants< TChar >::DefaultWhitespaces())
@ Tabstop
denotes a tab stop entry.
integer Next(Types type, integer requestedSize, integer growthPadding)
static String & Get(integer minLength=128)
ALIB_API TSubstring< TChar > & Next(lang::Whitespaces trimming=lang::Whitespaces::Trim, TChar newDelim='\0')
TSubstring< TChar > Actual
#define ALIB_WARNING(...)
#define ALIB_ASSERT_RESULT_NOT_EQUALS( func, value)
#define ALIB_ASSERT_WARNING(cond,...)
@ Keep
Keep whitespaces in string.
characters::character character
Type alias in namespace alib.
lang::integer integer
Type alias in namespace alib.