NCBI C++ ToolKit
test_table.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: test_table.cpp 25633 2012-04-13 20:51:47Z katargir $
2 * ===========================================================================
3 *
4 * PUBLIC DOMAIN NOTICE
5 * National Center for Biotechnology Information
6 *
7 * This software/database is a "United States Government Work" under the
8 * terms of the United States Copyright Act. It was written as part of
9 * the author's official duties as a United States Government employee and
10 * thus cannot be copyrighted. This software/database is freely available
11 * to the public for use. The National Library of Medicine and the U.S.
12 * Government have not placed any restriction on its use or reproduction.
13 *
14 * Although all reasonable efforts have been taken to ensure the accuracy
15 * and reliability of the software and data, the NLM and the U.S.
16 * Government do not and cannot warrant the performance or results that
17 * may be obtained by using this software or data. The NLM and the U.S.
18 * Government disclaim all warranties, express or implied, including
19 * warranties of performance, merchantability or fitness for any particular
20 * purpose.
21 *
22 * Please cite the author in any work or product based on this material.
23 *
24 * ===========================================================================
25 *
26 *
27 * File Description:
28 *
29 */
30 
31 #include <ncbi_pch.hpp>
32 
34 
36 
37 wxString CProteinModel::GetColumnName( int aColIx ) const
38 {
39  static const wxString strMark ( wxT("Mark") );
40  static const wxString strOrganism ( wxT("Organism") );
41  static const wxString strName ( wxT("Name") );
42  static const wxString strUniProtName ( wxT("UniProtName") );
43  static const wxString strGeneLocusTag ( wxT("Gene Locus tag") );
44  static const wxString strGeneSynonym ( wxT("Gene Synonym") );
45  static const wxString strGeneLocus ( wxT("Gene Locus") );
46  static const wxString strAccession ( wxT("Accession") );
47  static const wxString strGeneID ( wxT("Gene ID") );
48  static const wxString strID ( wxT("ID") );
49  static const wxString strCDDs ( wxT("CDDs") );
50  static const wxString strHAMAPs ( wxT("HAMAPs") );
51  static const wxString strKOs ( wxT("KOs") );
52  static const wxString strPubs ( wxT("Pubs") );
53  static const wxString strArCOGs ( wxT("arCOGs") );
54  static const wxString strStructures ( wxT("Structures") );
55  static const wxString strUndefined ( wxT("Undefined Column") );
56 
57  switch (EColumns(aColIx)) {
58  case eMark: return strMark;
59  case eOrganism: return strOrganism;
60  case eName: return strName;
61  case eUniProtName: return strUniProtName;
62  case eGeneLocusTag: return strGeneLocusTag;
63  case eGeneSynonym: return strGeneSynonym;
64  case eGeneLocus: return strGeneLocus;
65  case eAccession: return strAccession;
66  case eGeneID: return strGeneID;
67  case eID: return strID;
68  case eCDDs: return strCDDs;
69  case eHAMAPs: return strHAMAPs;
70  case eKOs: return strKOs;
71  case ePubs: return strPubs;
72  case eArCOGs: return strArCOGs;
73  case eStructures: return strStructures;
74  case eNumColumns: break;
75  }
76  return strUndefined;
77 }
78 
80 {
81  m_Marked.resize( 5, false );
82 }
83 
85 {
86 }
87 
88 wxString CProteinModel::GetColumnType( int aColIx ) const
89 {
90  switch (EColumns(aColIx)) {
91  case eMark: return wxT("bool");
92  case eOrganism: return wxT("string");
93  case eName: return wxT("string");
94  case eUniProtName: return wxT("string");
95  case eGeneLocusTag: return wxT("string");
96  case eGeneSynonym: return wxT("string");
97  case eGeneLocus: return wxT("string");
98  case eAccession: return wxT("string");
99  case eGeneID: return wxT("string");
100  case eID: return wxT("int");
101  case eCDDs: return wxT("string");
102  case eHAMAPs: return wxT("string");
103  case eKOs: return wxT("string");
104  case ePubs: return wxT("int");
105  case eArCOGs: return wxT("string");
106  case eStructures: return wxT("int");
107  case eNumColumns: break;
108  }
109  return wxT("string");
110 }
111 
113 {
114  return eNumColumns;
115 }
116 
117 
119 {
120  return 5;
121 }
122 
123 bool CProteinModel::IsMarked(int row) const
124 {
125  return m_Marked[row];
126 }
127 void CProteinModel::SetMarked(int row, bool value)
128 {
129  m_Marked[row] = value;
130 }
131 
132 static int seed = 1;
133 
134 wxVariant CProteinModel::GetValueAt( int row, int column ) const
135 {
136  if( column == eMark ){
137  return IsMarked(row);
138  }
139 
140  wxString type = GetColumnType( column );
141  if( type == wxT("int") ){
142  return seed++;
143  }
144 
145  return wxString::Format( wxT("Str: %i"), seed++ );
146 }
147 
149 
150 
virtual wxVariant GetValueAt(int i, int j) const
Definition: test_table.cpp:134
virtual int GetNumRows() const
Returns the number of rows in the model.
Definition: test_table.cpp:118
virtual wxString GetColumnName(int aColIx) const
Returns a default name for the column using spreadsheet conventions: A, B, C, ...
Definition: test_table.cpp:37
vector< bool > m_Marked
Definition: test_table.hpp:79
virtual wxString GetColumnType(int aColIx) const
Tries to extract actual type from row 0 value if it exists.
Definition: test_table.cpp:88
bool IsMarked(int row) const
Definition: test_table.cpp:123
virtual int GetNumColumns() const
Returns the number of columns in the model.
Definition: test_table.cpp:112
void SetMarked(int row, bool value)
Definition: test_table.cpp:127
char value[7]
Definition: config.c:431
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define wxT(x)
Definition: muParser.cpp:41
Format
Definition: njn_ioutil.hpp:52
static const char * column
Definition: stats.c:23
Definition: type.c:6
static int seed
Definition: test_table.cpp:132
Modified on Mon Mar 04 05:13:34 2024 by modify_doxy.py rev. 669887