Mercurial > mercurial > hgweb_searcher03.cgi
comparison include/dndfile.h @ 4:fdba695b99f1
More fast ( read from DB ).
Improve the precision of marksheet judgement.
author | pyon@macmini |
---|---|
date | Wed, 11 Sep 2013 19:09:14 +0900 |
parents | 1a64119ab257 |
children | bc2e2b304095 |
comparison
equal
deleted
inserted
replaced
3:1a64119ab257 | 4:fdba695b99f1 |
---|---|
1 // Filename : dndfile.h | 1 // Filename : dndfile.h |
2 // Last Change: 27-Aug-2013. | 2 // Last Change: 11-Sep-2013. |
3 // | 3 // |
4 | 4 |
5 #include "db.h" | 5 #include "db.h" |
6 | 6 |
7 class DnDFile : public wxFileDropTarget | 7 class DnDFile : public wxFileDropTarget |
8 { | 8 { |
9 public: | 9 public: |
10 DnDFile( wxGrid *grid ) | 10 DnDFile( wxGrid *grid ) |
11 { | |
12 m_grid = grid; | |
13 } | |
14 virtual bool OnDropFiles( wxCoord x, wxCoord y, const wxArrayString& filenames ) | |
15 { | |
16 size_t nFiles = filenames.GetCount(); | |
17 if ( nFiles != 1 ) return false; | |
18 | |
19 m_grid->ClearGrid(); | |
20 | |
21 // ファイルから被保番リストを生成 | |
22 wxTextFile csv; | |
23 csv.Open( filenames[0] ); | |
24 | |
25 wxRegEx reHhs( wxT("^0[1238][0-9]{8}$") ); | |
26 wxArrayString hhs; | |
27 for ( int n = 0; n < csv.GetLineCount(); n++ ) { | |
28 wxString hhsno = csv.GetLine( n ).BeforeFirst( ',', NULL ); | |
29 if ( ! reHhs.Matches( hhsno ) ) | |
30 continue; | |
31 hhs.Add( hhsno ); | |
32 } | |
33 csv.Close(); | |
34 | |
35 // | |
36 int d = hhs.GetCount() - m_grid->GetNumberRows(); | |
37 if ( d > 0 ) | |
38 m_grid->AppendRows( d, true ); | |
39 | |
40 // グリッドに情報を読込み | |
41 wxArrayString res = GetHhsInfoAndPathByHhsNoList( hhs ); | |
42 for ( int r = 0; r < res.GetCount(); r++ ) { | |
43 wxArrayString data = wxSplit( res[r], '_', '\\' ); | |
44 m_grid->SetCellValue( r, 0, data[0] ); | |
45 m_grid->SetCellValue( r, 1, data[1] ); | |
46 m_grid->SetCellValue( r, 2, data[2] ); | |
47 } | |
48 | |
49 return true; | |
50 } | |
51 | |
52 private: | |
53 wxGrid* m_grid; | |
54 }; | |
55 | |
56 class DnDFile2 : public wxFileDropTarget | |
57 { | |
58 public: | |
59 DnDFile2( wxGrid *grid ) | |
11 { | 60 { |
12 m_grid = grid; | 61 m_grid = grid; |
13 } | 62 } |
14 virtual bool OnDropFiles( wxCoord x, wxCoord y, const wxArrayString& filenames ) | 63 virtual bool OnDropFiles( wxCoord x, wxCoord y, const wxArrayString& filenames ) |
15 { | 64 { |