本文整理汇总了C++中DString::getChars方法的典型用法代码示例。如果您正苦于以下问题:C++ DString::getChars方法的具体用法?C++ DString::getChars怎么用?C++ DString::getChars使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DString
的用法示例。
在下文中一共展示了DString::getChars方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: view
//.........这里部分代码省略.........
for(int li = 0; li < len; li++)
buffer[Y*csbi.dwSize.X + X + li].Attributes = color;
};
};
COORD coor;
coor.X = coor.Y = 0;
SMALL_RECT sr;
sr.Left = 0;
sr.Right = csbi.dwSize.X-1;
sr.Top = 0;
sr.Bottom = csbi.dwSize.Y-1;
if (!unc_fault && !WriteConsoleOutputW(hCon, buffer, csbi.dwSize, coor, &sr)) {
unc_fault = true;
continue;
};
if (unc_fault) WriteConsoleOutputA(hCon, buffer, csbi.dwSize, coor, &sr);
// managing the keyboard
do {
DWORD tmp;
ReadConsoleInput(hConI, &ir, 1, &tmp);
if (ir.EventType == WINDOW_BUFFER_SIZE_EVENT) {
GetConsoleScreenBufferInfo(hCon, &csbi);
delete[] buffer;
buffer = new CHAR_INFO[csbi.dwSize.X * csbi.dwSize.Y];
break;
};
if (ir.EventType == MOUSE_EVENT && ir.Event.MouseEvent.dwEventFlags == 0x4) {
switch(ir.Event.MouseEvent.dwButtonState) {
case 0x780000:
topline-=csbi.dwSize.Y;
if (topline < 0) topline = 0;
break;
case 0xFF880000:
topline += csbi.dwSize.Y;
if (topline > textLinesStore->getLineCount() - csbi.dwSize.Y) topline = textLinesStore->getLineCount() - csbi.dwSize.Y;
if (topline < 0) topline = 0;
break;
};
break;
};
if (ir.EventType == KEY_EVENT && ir.Event.KeyEvent.bKeyDown) {
// moving view position
switch(ir.Event.KeyEvent.wVirtualKeyCode) {
case VK_UP:
if (topline) topline--;
break;
case VK_DOWN:
if (topline+csbi.dwSize.Y < textLinesStore->getLineCount()) topline++;
break;
case VK_LEFT:
leftpos--;
if (ir.Event.KeyEvent.dwControlKeyState & (RIGHT_CTRL_PRESSED|LEFT_CTRL_PRESSED))
leftpos -= 15;
if (leftpos < 0) leftpos = 0;
break;
case VK_RIGHT:
leftpos++;
if (ir.Event.KeyEvent.dwControlKeyState & (RIGHT_CTRL_PRESSED|LEFT_CTRL_PRESSED))
leftpos += 15;
break;
case VK_PRIOR:
topline-=csbi.dwSize.Y;
if (topline < 0) topline = 0;
break;
case VK_NEXT:
case VK_SPACE:
topline += csbi.dwSize.Y;
if (topline > textLinesStore->getLineCount() - csbi.dwSize.Y) topline = textLinesStore->getLineCount() - csbi.dwSize.Y;
if (topline < 0) topline = 0;
break;
case VK_HOME:
leftpos = topline = 0;
break;
case VK_END:
topline = textLinesStore->getLineCount()-csbi.dwSize.Y;
if (topline < 0) topline = 0;
leftpos = 0;
break;
};
break;
};
} while(true);
} while(ir.Event.KeyEvent.wVirtualKeyCode != VK_ESCAPE);
delete[] buffer;
SetConsoleActiveScreenBuffer(GetStdHandle(STD_OUTPUT_HANDLE));
CloseHandle(hCon);
#else
printf("unix edition doesn't support interactive text viewing\n\n");
for(int i = 0; i < textLinesStore->getLineCount(); i++) {
DString line = textLinesStore->getLine(i);
printf("%s\n", line.getChars());
};
#endif
};