本文整理汇总了C++中CsvReader::getRowCount方法的典型用法代码示例。如果您正苦于以下问题:C++ CsvReader::getRowCount方法的具体用法?C++ CsvReader::getRowCount怎么用?C++ CsvReader::getRowCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CsvReader
的用法示例。
在下文中一共展示了CsvReader::getRowCount方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OpenSaveDialog
//Display the openfile common dialog
BOOL OpenSaveDialog(HWND hwnd){
OPENFILENAME ofn;
TCHAR szFile[MAX_PATH];
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.lpstrFile = szFile;
ofn.lpstrFile[0] = '\0';
ofn.hwndOwner = hwnd;
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = TEXT("EXCEL csv files(*.csv)\0*.csv\0");
ofn.nFilterIndex = 1;
ofn.lpstrInitialDir = NULL;
ofn.lpstrFileTitle = _T("123.csv");
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
wstring s1, s2;
if (GetSaveFileName(&ofn)){
s1 += L"正在保存:";
s2 += ofn.lpstrFile;
s1 += s2;
SendMessage((HWND)GetWindowLongPtr(hWnd, GWLP_USERDATA), SB_SETTEXT, 1, (LPARAM)s1.c_str());
SaveCSV(ofn.lpstrFile);
}
std::wostringstream s;
s << L"已经保存" << s2 << " " << L"共保存了" << csvReader.getRowCount() << L"条";
wstring r(s.str());
SendMessage((HWND)GetWindowLongPtr(hWnd, GWLP_USERDATA), SB_SETTEXT, 0, (LPARAM)L"编辑中");
SendMessage((HWND)GetWindowLongPtr(hWnd, GWLP_USERDATA), SB_SETTEXT, 1, (LPARAM)r.c_str());
return TRUE;
}
示例2: OpenDialog
//Display the openfile common dialog
BOOL OpenDialog(HWND hwnd){
OPENFILENAME ofn;
TCHAR szFile[MAX_PATH];
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.lpstrFile = szFile;
ofn.lpstrFile[0] = '\0';
ofn.hwndOwner = hwnd;
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = TEXT("EXCEL csv files(*.csv)\0*.csv\0");
ofn.nFilterIndex = 1;
ofn.lpstrInitialDir = NULL;
ofn.lpstrFileTitle = NULL;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
wstring s1, s2;
if (GetOpenFileName(&ofn)){
s1 += L"正在打开:";
s2 += ofn.lpstrFile;
s1 += s2;
SendMessage((HWND)GetWindowLongPtr(hWnd, GWLP_USERDATA), SB_SETTEXT, 1, (LPARAM)s1.c_str());
LoadCSV(ofn.lpstrFile);
}
std::wostringstream s;
s << L"已经打开了" << s2 << " " << L"共读取了" << csvReader.getRowCount() << L"条";
wstring r(s.str());
SendMessage((HWND)GetWindowLongPtr(hWnd, GWLP_USERDATA), SB_SETTEXT, 0, (LPARAM)L"编辑中");
SendMessage((HWND)GetWindowLongPtr(hWnd, GWLP_USERDATA), SB_SETTEXT, 1, (LPARAM)r.c_str());
SetScrollRange(hwnd, SB_VERT, 0, csvReader.getRowCount(), FALSE);
const int columnCount = csvReader.getHeadRow()->getColumnSize();
HMENU hmRand = GetSubMenu(hMenu, 1);
assert(hmRand != NULL);
for (int i = 0; i < columnCount; i++){
wstring s(L"以“");
s += csvReader.getHeadRow()->getColumn(i);
s += L"”随机排序";
AppendMenu(hmRand, MF_STRING, IDM_RANDOMSORT_ITEM_1 + i,s.c_str());
}
SetMenu(hWnd, hMenu);
GetSystemMenu(hWnd, TRUE);
return TRUE;
}
示例3: WndProc
//.........这里部分代码省略.........
}
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
// TODO: Add any drawing code here...
TCHAR buffer[20];
s += L"Text Height";
wsprintf(buffer, L"%d ", cyChar);
s.append(buffer);
s += L" Text Width";
wsprintf(buffer, L"%d ", cxChar);
s += buffer;
//TextOut(hdc, 0, 20, s.c_str(), s.length());
if (csvReader.isOpened()){
const int columnCount = csvReader.getHeadRow()->getColumnSize();
wstring *heads = new wstring[columnCount];
for (int i = 0; i < columnCount; i++){
heads[i].append(csvReader.getHeadRow()->getColumn(i));
}
TextOut(hdc, 0, 0, (LPWSTR)csvReader.getHeader(), lstrlen(csvReader.getHeader()));
int curStart = 0;
EditRow *per;
int count;
curStart = iScollPos;
int end = curStart + cyClient / cyChar;
for (int i = curStart ; i < end; i++){
csvReader.getRow(i,&per);
count = per->getColumnSize();
int j;
for (j = 0; j < count-1; j++){
TextOut(hdc, j*COLUMN_WIDTH, (i-curStart + 1)*cyChar, per->getColumn(j),lstrlen(per->getColumn(j)));
}
wstring sTailRow(per->getColumn(j));
int fpos = -1;
if (fpos = sTailRow.find(_T("\n"))){
sTailRow.erase(fpos, 2);
}
TextOut(hdc, j*COLUMN_WIDTH, (i - curStart + 1)*cyChar,
sTailRow.c_str(),
sTailRow.length());
}
}
EndPaint(hWnd, &ps);
break;
case WM_VSCROLL:
switch (LOWORD(wParam)){
case SB_LINEUP:
iScollPos -= 1;
break;
case SB_LINEDOWN:
iScollPos += 1;
break;
case SB_PAGEUP:
iScollPos -= cyClient / cyChar;
break;
case SB_PAGEDOWN:
iScollPos += cyClient / cyChar;
break;
case SB_THUMBPOSITION:
iScollPos = HIWORD(wParam);
break;
default:
break;
}
iScollPos =max(0, min(iScollPos, csvReader.getRowCount()));
if (iScollPos != GetScrollPos(hWnd, SB_VERT))
{
SetScrollPos(hWnd, SB_VERT, iScollPos, TRUE);
InvalidateRect(hWnd, NULL, TRUE);
}
break;
case WM_SIZE:
cxClient = LOWORD(lParam);
cyClient = HIWORD(lParam);
//InvalidateRect(hStatusbar, NULL, TRUE);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}