ClearLine PICoutManipulator
git-svn-id: svn://db.shs.com.ru/pip@66 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -138,6 +138,27 @@ PICout PICout::operator <<(const PICoutAction v) {
|
|||||||
SetConsoleCursorInfo(__Private__::hOut, &curinfo);
|
SetConsoleCursorInfo(__Private__::hOut, &curinfo);
|
||||||
#else
|
#else
|
||||||
printf("\e[?25l");
|
printf("\e[?25l");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case PICoutManipulators::ClearLine:
|
||||||
|
if (!PICout::buffer_) {
|
||||||
|
#ifdef WINDOWS
|
||||||
|
GetConsoleScreenBufferInfo(__Private__::hOut, &sbi);
|
||||||
|
coord = sbi.dwCursorPosition;
|
||||||
|
int dx = coord.X;
|
||||||
|
coord.X = 0;
|
||||||
|
SetConsoleCursorPosition(__Private__::hOut, coord);
|
||||||
|
if (dx > 0) {
|
||||||
|
char * line = new char[dx + 1];
|
||||||
|
memset(line, ' ', dx);
|
||||||
|
line[dx] = 0;
|
||||||
|
printf("%s", line);
|
||||||
|
delete line;
|
||||||
|
}
|
||||||
|
SetConsoleCursorPosition(__Private__::hOut, coord);
|
||||||
|
#else
|
||||||
|
printf("\e[0G\e[K");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ namespace PICoutManipulators {
|
|||||||
Backspace /*! Remove last symbol */,
|
Backspace /*! Remove last symbol */,
|
||||||
ShowCursor /*! Show cursor */,
|
ShowCursor /*! Show cursor */,
|
||||||
HideCursor /*! Hide cursor */,
|
HideCursor /*! Hide cursor */,
|
||||||
|
ClearLine /*! Clear current line */,
|
||||||
ClearScreen /*! Clear the screen */,
|
ClearScreen /*! Clear the screen */,
|
||||||
SaveContol /*! Save control flags, equivalent to \a saveControl() */,
|
SaveContol /*! Save control flags, equivalent to \a saveControl() */,
|
||||||
RestoreControl /*! Restore control flags, equivalent to \a restoreControl() */
|
RestoreControl /*! Restore control flags, equivalent to \a restoreControl() */
|
||||||
|
|||||||
@@ -35,10 +35,10 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
EVENT_HANDLER(void, ftevent) {
|
EVENT_HANDLER(void, ftevent) {
|
||||||
piCout << ft.stateString() << PIString::readableSize(ft.diagnostic().receiveBytesPerSec()) + "/s"
|
PICout(PICoutManipulators::AddSpaces) << PICoutManipulators::ClearLine << ft.stateString() << PIString::readableSize(ft.diagnostic().receiveBytesPerSec()) + "/s"
|
||||||
<< PIString::readableSize(ft.diagnostic().sendBytesPerSec()) + "/s"
|
<< PIString::readableSize(ft.diagnostic().sendBytesPerSec()) + "/s"
|
||||||
<< "(" << PIString::readableSize(ft.bytesFileCur()) << "/" << PIString::readableSize(ft.bytesFileAll()) << ", "
|
<< "(" << PIString::readableSize(ft.bytesFileCur()) << "/" << PIString::readableSize(ft.bytesFileAll()) << ", "
|
||||||
<< PIString::readableSize(ft.bytesCur()) << "/" << PIString::readableSize(ft.bytesAll()) << ")";
|
<< PIString::readableSize(ft.bytesCur()) << "/" << PIString::readableSize(ft.bytesAll()) << ")" << PICoutManipulators::Flush;
|
||||||
}
|
}
|
||||||
|
|
||||||
EVENT_HANDLER1(void, ftsend, PIByteArray &, data) {
|
EVENT_HANDLER1(void, ftsend, PIByteArray &, data) {
|
||||||
@@ -72,6 +72,7 @@ int main (int argc, char * argv[]) {
|
|||||||
piCout << "wait for receiving";
|
piCout << "wait for receiving";
|
||||||
}
|
}
|
||||||
WAIT_FOR_EXIT
|
WAIT_FOR_EXIT
|
||||||
|
PICout() << "\n";
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user