NCBI C++ ToolKit
td_query_data_source.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef GUI_OBJUTILS___TD_QUERY_DATA_SOURCE__HPP
2 #define GUI_OBJUTILS___TD_QUERY_DATA_SOURCE__HPP
3 
4 /* $Id: td_query_data_source.hpp 36811 2016-11-02 13:41:29Z falkrb $
5  * ===========================================================================
6  *
7  * PUBLIC DOMAIN NOTICE
8  * National Center for Biotechnology Information
9  *
10  * This software/database is a "United States Government Work" under the
11  * terms of the United States Copyright Act. It was written as part of
12  * the author's official duties as a United States Government employee and
13  * thus cannot be copyrighted. This software/database is freely available
14  * to the public for use. The National Library of Medicine and the U.S.
15  * Government have not placed any restriction on its use or reproduction.
16  *
17  * Although all reasonable efforts have been taken to ensure the accuracy
18  * and reliability of the software and data, the NLM and the U.S.
19  * Government do not and cannot warrant the performance or results that
20  * may be obtained by using this software or data. The NLM and the U.S.
21  * Government disclaim all warranties, express or implied, including
22  * warranties of performance, merchantability or fitness for any particular
23  * purpose.
24  *
25  * Please cite the author in any work or product based on this material.
26  *
27  * ===========================================================================
28  *
29  * Authors: Robert Falk
30  *
31  * File Description:
32  *
33  */
34 
35 #include <objmgr/scope.hpp>
36 #include <gui/gui_export.h>
37 
40 
42 
43 ////////////////////////////////////////////////////////////////////////////////
44 /// class IQueryDataSource
45 ///
46 /// This is an abstract interface for any datasource that wants to support
47 /// queries using CQueryParseTree and CQueryExec. This interface supports
48 /// searching the data source for a spcified string (when parsing is not being
49 /// used) and supports the creation of a query execution object that is
50 /// tailored for that data source. This interface also allows the user
51 /// to set and clear a set of selected results for the data source.
52 ///
54 {
55 public:
56  CTDQueryDataSource(ITableData& tabelData) : m_Table(&tabelData) {}
57 
58  /// @name IQueryDataSource interface implementation
59  /// @{
60  virtual string GetColumnLabel(size_t col) const;
61  virtual size_t GetColsCount() const;
62 
64  virtual void SetQueryResults(CMacroQueryExec* q);
65  virtual void ClearQueryResults();
66 
67  virtual void ExecuteStringQuery(const string &query, size_t& num_selected, size_t& num_queried, CStringMatching::EStringMatching string_matching = CStringMatching::ePlainSearch, NStr::ECase use_case = NStr::eCase);
68  /// @}
69 
70  std::vector<size_t> GetQueryResults() const { return m_QueryResults; }
71 
72 protected:
73  std::vector<size_t> m_QueryResults;
75 };
76 
78 
79 #endif // GUI_OBJUTILS___TD_QUERY_DATA_SOURCE__HPP
class CMacroQueryExec
CObject –.
Definition: ncbiobj.hpp:180
EStringMatching
String matching algorithms.
@ ePlainSearch
Plain search.
class IQueryDataSource
CIRef< ITableData > m_Table
std::vector< size_t > m_QueryResults
std::vector< size_t > GetQueryResults() const
CTDQueryDataSource(ITableData &tabelData)
class IQueryDataSource
virtual void ClearQueryResults()=0
Clear any current results from previous queries.
virtual string GetColumnLabel(size_t col) const =0
get number and names of columns in data source
virtual size_t GetColsCount() const =0
virtual void ExecuteStringQuery(const string &query, size_t &num_selected, size_t &num_queried, CStringMatching::EStringMatching string_matching=CStringMatching::ePlainSearch, NStr::ECase use_case=NStr::eCase)=0
Execute a string-matching query on the underlying data.
virtual void SetQueryResults(CMacroQueryExec *q)=0
Set selection results to be whatever elements are selected in 'q'.
virtual CMacroQueryExec * GetQueryExec(bool casesensitive, CStringMatching::EStringMatching matching)=0
Create an appropriate instance of a subclass of CQueryExec for that will be used to execute a query o...
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
ECase
Which type of string comparison.
Definition: ncbistr.hpp:1204
@ eCase
Case sensitive compare.
Definition: ncbistr.hpp:1205
#define NCBI_GUIOBJUTILS_EXPORT
Definition: gui_export.h:512
Defines to provide correct exporting from DLLs in Windows.
static string query
Modified on Fri Apr 12 17:14:39 2024 by modify_doxy.py rev. 669887