#include "Console.h"
#if defined VCZH_MSVC
#include <Windows.h>
#elif defined VCZH_GCC
#include <iostream>
#include <string>
using namespace std;
#endif
namespace
{
namespace
{
void
::
(
const
wchar_t
*
,
)
{
#if defined VCZH_MSVC
HANDLE outHandle=GetStdHandle(STD_OUTPUT_HANDLE);
=
0
;
=
0
;
if((GetFileType(outHandle) & FILE_TYPE_CHAR) && GetConsoleMode(outHandle, &fileMode))
if
((
(
outHandle
) &
0x0002
) &&
(
outHandle
, &
fileMode
))
{
WriteConsole(outHandle, string, (int)length, &written,0);
(
outHandle
,
, (
int
)
, &
written
,
0
);
}
else
{
int
=
();
int
=
(
codePage
,
0
,
, -
1
,
0
,
0
,
0
,
0
);
char
*
=
new
char
[
charCount
];
(
codePage
,
0
,
, -
1
,
codePageBuffer
,
charCount
,
0
,
0
);
(
outHandle
,
codePageBuffer
,
charCount
-
1
, &
written
,
0
);
delete
[]
codePageBuffer
;
}
#elif defined VCZH_GCC
wstring s(string, string+length);
wcout<<s<<ends;
#endif
}
void
::
(
const
wchar_t
*
)
{
(
,
(
));
}
void
::
(
const
&
)
{
(
.
(),
.
());
}
void
::
(
const
&
)
{
(
);
(
L"\r\n"
);
}
::
()
{
#if defined VCZH_MSVC
;
;
for
(;;)
{
wchar_t
;
ReadConsole(GetStdHandle(STD_INPUT_HANDLE),&buffer,1,&count,0);
(
(((
)-
10
)),&
buffer
,
1
,&
count
,
0
);
if
(
buffer
==
L'\r'
)
{
ReadConsole(GetStdHandle(STD_INPUT_HANDLE),&buffer,1,&count,0);
(
(((
)-
10
)),&
buffer
,
1
,&
count
,
0
);
break
;
}
else
if
(
buffer
==
L'\n'
)
{
break
;
}
else
{
result
=
result
+
buffer
;
}
}
return
result
;
#elif defined VCZH_GCC
wstring s;
getline(wcin, s, L'\n');
return s.c_str();
#endif
}
void
::
(
bool
,
bool
,
bool
,
bool
)
{
#if defined VCZH_MSVC
=
0
;
if(red)attribute |=FOREGROUND_RED;
if(green)attribute |=FOREGROUND_GREEN;
if(blue)attribute |=FOREGROUND_BLUE;
if(light)attribute |=FOREGROUND_INTENSITY;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),attribute);
SetConsoleTextAttribute(GetStdHandle(STD_INPUT_HANDLE),attribute);
#elif defined VCZH_GCC
int color = (blue?1:0)*4 + (green?1:0)*2 + (red?1:0);
if(light)
wprintf(L"\x1B[00;3%dm", color);
else
wprintf(L"\x1B[01;3%dm", color);
#endif
}
void
::
(
const
&
)
{
#if defined VCZH_MSVC
SetConsoleTitle(string.Buffer());
#endif
}
}
}