A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/query__parse__panel_8cpp_source.html below:

NCBI C++ ToolKit: src/gui/widgets/data/query_parse_panel.cpp Source File

58 #include <wx/button.h> 59 #include <wx/animate.h> 60 #include <wx/statline.h> 61 #include <wx/stattext.h> 62 #include <wx/toolbar.h> 63 #include <wx/choice.h> 66 #include <wx/textctrl.h> 67 #include <wx/checkbox.h> 68 #include <wx/dataobj.h> 69 #include <wx/clipbrd.h> 70 #include <wx/choice.h> 71 #include <wx/settings.h> 80 #define ID_SEARCHCTRL 13001 81 #define ID_SELECT_ALL 13005 82 #define ID_QUERY_ANIMATIONCTRL 13007 83 #define ID_TOOLBAR 13010 84 #define ID_TOOLBAR2 13011 85 #define ID_CASE_SENSITIVE 13012 86 #define ID_STRING_SEARCH 13013 88 #define ID_STRING_MATCH_TYPE1 14014 97  "Regular Expression"

,

168  if

(!m_QExec.IsNull())

169  return

m_QExec->GetExceptionCount();

229

PopEventHandler(

true

);

240 #ifdef __WXOSX_COCOA__ 241

SetBackgroundStyle(wxBG_STYLE_COLOUR);

242

SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_FRAMEBK));

245

wxPanel::Create(parent,

id

, pos,

size

);

279

wxBoxSizer* panel_sizer =

new

wxBoxSizer(wxHORIZONTAL);

282  long

styles = wxTB_FLAT | wxTB_HORIZONTAL | wxTB_TEXT | wxTB_HORZ_LAYOUT;

285  long

styles = wxTB_FLAT | wxTB_HORIZONTAL;

288

wxDefaultPosition, wxSize(-1, -1), styles);

380  int

search_width = 180;

384  int

search_height = tool_text->GetFont().GetPointSize()+8;

386  int

search_height = -1;

391

wxDefaultPosition, wxSize(search_width, search_height),

392

wxTE_PROCESS_ENTER | wxTE_RICH );

395 1. A string to match against all fields\n\ 396 2. A query based on field names, e.g. :\n\ 397  dist > 0.2 and seq-id = \"NP_110296\""

));

401

wxBitmap bmp_selquery = wxArtProvider::GetBitmap(

wxT

(

"menu::query_sel"

));

402  m_ToolBar

->AddTool(

eCmdSelQuery

, wxEmptyString, bmp_selquery, wxNullBitmap, wxITEM_NORMAL,

wxT

(

"Select Query"

));

410  wxT

(

"Exact Match"

));

418

wxBitmap bmp_start = wxArtProvider::GetBitmap(

wxT

(

"menu::dm_start"

));

423

wxDefaultPosition, wxSize(22, 22));

424  m_Animation

->SetToolTip(

wxT

(

"Light moves while query is running"

));

430

wxBitmap bmp_stop = wxArtProvider::GetBitmap(

wxT

(

"menu::dm_stop"

));

436

wxBitmap bmp_filter = wxArtProvider::GetBitmap(

wxT

(

"menu::dm_filter"

));

437  m_ToolBar

->AddTool(

eCmdFilter

,

wxT

(

"Filter"

), bmp_filter, wxNullBitmap, wxITEM_CHECK,

wxT

(

"Only show query results"

));

441

wxDefaultPosition, wxDefaultSize, wxNO_BORDER );

443  m_pSelectAll

->SetToolTip(

wxT

(

"Check to show all matching nodes as selected\n\ 444 Uncheck to show one matching node at a time\n"

));

447

wxBitmap bmp_prev = wxArtProvider::GetBitmap(

wxT

(

"menu::back"

));

453

wxBitmap bmp_next = wxArtProvider::GetBitmap(

wxT

(

"menu::forward"

));

459

wxBitmap bmp_help = wxArtProvider::GetBitmap(

wxT

(

"menu::help"

));

464

panel_sizer->Add(

m_ToolBar

, 1, wxALL|wxGROW|wxALIGN_LEFT, 0);

466

SetSizerAndFit(panel_sizer);

534

vector<string> queries;

537  for

(

size_t i

=0;

i

<queries.size(); ++

i

) {

552

vector<string> queries;

554

vector<pair<string,string> >::const_iterator iter;

557

queries.push_back((*iter).second);

560  if

(queries.size() > 0)

573  if

(new_query !=

""

) {

581  if

(

arr

.size() > 0) {

582  string

last_token =

arr

[

arr

.size()-1];

587

new_query +=

" AND "

;

597

new_query +=

" "

+

str

;

611  unsigned int

query_idx = evt.GetId() -

ID_MRU1

;

621

wxCommandEvent evt_dummy;

649

::wxLaunchDefaultBrowser(

ToWxString

(help_addr));

659  bool

found_return =

false

;

660  for

(

size_t i

=0;

i

<evt.GetString().

size

(); ++

i

) {

661  if

(evt.GetString()[

i

] !=

wxT

(

'\n'

))

662

no_return += evt.GetString()[

i

];

664

found_return =

true

;

667  long

cursor =

m_pSearch

->GetInsertionPoint();

669

cursor =

std::max

(

long

(0), cursor-1);

673

wxCommandEvent dummy_evt;

682

vector<std::pair<size_t, size_t> > fields;

689

wxTextAttr attr(wxColour(wxString(

wxT

(

"black"

))));

690

attr.SetFlags(wxTEXT_ATTR_TEXT_COLOUR|wxTEXT_ATTR_FONT_WEIGHT);

698  size_t

tdelta =

str

.length() - truncated_str.length();

710  if

(valid || fields.size() > 0) {

711

wxTextAttr attr(wxColour(wxString(

wxT

(

"blue"

))));

712

attr.SetFlags(wxTEXT_ATTR_TEXT_COLOUR|wxTEXT_ATTR_FONT_WEIGHT);

715  for

(

size_t i

=0;

i

<fields.size(); ++

i

) {

717

(

long

)(fields[

i

].second + tdelta),

735

wxTextAttr attr(wxColour(wxString(

wxT

(

"blue"

))));

736

attr.SetFlags(wxTEXT_ATTR_TEXT_COLOUR|wxTEXT_ATTR_FONT_WEIGHT);

739

string::size_type idx;

761

wxMenu* m =

new

wxMenu();

763  unsigned int

max_id =

ID_MRU1

;

766

wxMenu* default_menu =

new

wxMenu();

772

m->AppendSubMenu(default_menu,

wxT

(

"Saved Queries"

));

843

wxMenu* m =

new

wxMenu();

846

m->SetTitle(

wxT

(

"String Matching Options"

));

851

m->AppendSeparator();

852

m->AppendCheckItem(max_id,

ToWxString

(

"Case Sensitive"

));

888

std::vector<std::pair<size_t, size_t> >

903

std::pair<size_t, size_t> field_position;

906

field_position.first = qnode.

GetLoc

().

pos

;

909

m_FieldPositions.push_back(field_position);

923

vector<std::pair<size_t, size_t> >& fields)

925  bool

valid = (

query

.length() > 0);

929  if

(

query

.length() > 5 &&

931

macro::CMacroRep* macro_rep =

NULL

;

936

macro::CMacroParser p;

938

p.SetSource(

query

.c_str());

939

p.Parse(

true

, qexec);

940

macro_rep = p.DetachMacroRep();

942  if

(macro_rep->GetWhereClause() !=

NULL

&&

943

macro_rep->GetDoTree() !=

NULL

) {

982

macro::CMacroParser p;

990

p.GetWhereFunctions());

1044

this->SetCursor(*wxSTANDARD_CURSOR);

1058

wxWindow* fwin = wxWindow::FindFocus();

1060  if

(fwin ==

NULL

) {

1064  if

(status !=

""

) {

1073

wxCommandEvent evt_dummy;

1079

macro::CMacroRep* macro_rep,

1081  const string

&

query

)

1083  string

result_status;

1145  _TRACE

(

"Query job start failed"

);

1161

this->SetCursor(*wxHOURGLASS_CURSOR);

1178  m_ToolBar

->SetCursor(*wxSTANDARD_CURSOR);

1179  m_ToolBar

->SetCursor(*wxSTANDARD_CURSOR);

1187

macro::CMacroParser p;

1199

macro::CMacroRep* macro_rep =

NULL

;

1200  bool

is_macro =

false

;

1205  if

(

query

.length() > 5 &&

1210

p.SetSource(

query

.c_str());

1211

p.Parse(

true

, qexec);

1213

macro_rep = p.DetachMacroRep();

1218

status_msg =

"Macro parsing failed: "

+ e.

GetMsg

();

1236

p.GetWhereFunctions());

1242

qtree->

Print

(strstrm);

1247

vector<string>

arr

;

1250  for

(

size_t i

= 0;

i

<

arr

.size(); ++

i

)

1261

status_msg =

"Query parsing failed: "

+ e.

GetMsg

();

1308  string

result_status;

1314  m_Job

->GetQueriedCount() <<

1315  " Number of query execution errors: "

<<

1316  m_Job

->GetExceptionCount() <<

1317  string

(

" Query Time: "

) <<

m_Job

->GetQueryTime());

1319

result_status =

string

(

"Number evaluated: "

) +

1321  string

(

". Number Selected: "

) +

1324  if

(

m_Job

->GetExceptionCount() > 0) {

1325

result_status +=

string

(

" Number with query errors: "

) +

1335  LOG_POST

(

Info

<<

"Number evaluated (for cancelled search): "

<<

1336  m_Job

->GetQueriedCount() <<

1337  " Number with query execution errors: "

<<

1338  m_Job

->GetExceptionCount());

1340

result_status =

string

(

"Number evaluated (for cancelled search): "

) +

1342  string

(

". Number Selected: "

) +

1344  if

(

m_Job

->GetExceptionCount() > 0) {

1345

result_status +=

string

(

" Number with query errors: "

) +

1378

vector<pair<string,string> >::iterator iter;

1380  if

((*iter).second == q) {

EVT_CHECKBOX(ID_CADJUSTFEATURES_CHECKBOX, CAdjustFeaturesForGaps::OnKnownUnknownSelected) EVT_CHECKBOX(ID_CADJUSTFEATURES_CHECKBOX1

void GUI_AsyncJoinFuture(const job_future_base &future, const string &msg)

Checksum and hash calculation classes.

IAppJobListener Interface for components that need to be notified about changes in Jobs.

CChecksum – Checksum calculator.

CRegistryWriteView GetWriteView(const string &section)

get a read-write view at a particular level.

static CGuiRegistry & GetInstance()

access the application-wide singleton

CRegistryReadView GetReadView(const string &section) const

get a read-only view at a particular level.

virtual bool EvalNext(macro::CMacroRep &)

virtual void GetFunctionNames(macro::CMacroParser &parser) const

CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:

class CQueryExecException

class CQueryExecPreProcessFunc

Class for extracting positions of data fields from the query.

std::vector< std::pair< size_t, size_t > > GetFieldPositions() const

CQueryHighlightFunction()

ETreeTraverseCode operator()(const CTreeNode< CQueryParseNode > &tr, int delta)

std::vector< std::pair< size_t, size_t > > m_FieldPositions

Job class used to run query on separate thread.

CStringMatching::EStringMatching m_StringCompare

string m_QueryString

For simple string queries.

macro::CMacroRep * m_Macro

int GetExceptionCount() const

CQueryParseTree * m_QueryTree

Parsed query tree.

size_t GetQueriedCount() const

Get stats on how many elements were checked and how many were checked but failed for some reason (suc...

void Execute(ICanceled &canceled)

CRef< CMacroQueryExec > m_QExec

Query execution object.

bool m_PrevCaseSensitive

Value of case-sensitive button last time query was executed.

string GetLastQuery() const

Get the text for the most recently executed query.

void OnButtonNext(wxCommandEvent &evt)

void OnToggleSelectAll(wxCommandEvent &evt)

virtual void SaveSettings() const

void OnSearchctrlSearchButtonClick(wxCommandEvent &evt)

void x_ExecuteQuery(int search_dir)

Parse query and determine how to execute.

CIRef< CQueryJob > m_Job

Current tree-query job.

bool x_IsValidQuery(string query, bool casesensitive, vector< std::pair< size_t, size_t > > &fields)

Return true if query parses correctly, putting field names in 'fields'.

static const int m_MaxRecentQueries

Max number of recent queries to include in list.

virtual void SetRegistryPath(const string &reg_path)

void OnIdle(wxIdleEvent &event)

void OnQuerySel(wxCommandEvent &evt)

void OnSearchctrlTextEnter(wxCommandEvent &evt)

static const int m_MaxDefaultQueries

wxCheckBox * m_pSelectAll

CStringMatching::EStringMatching m_StringCompare

How to compare strings in query - wildcards, exact match, etc.

void x_StartQueryJob(CRef< CMacroQueryExec > qexec, CQueryParseTree *qtree, macro::CMacroRep *macro_rep, bool casesensitive, const string &query)

Submit query job for asynch execution.

void OnStringMatchTypeSelected(wxCommandEvent &evt)

vector< pair< string, string > > m_RecentQueries

Set of recent queries.

void SetDefaultQueries(const TNamedQueries &q)

Set the set of default queries for the current data source.

void CompleteQuery(CMacroQueryExec *qexec, const string &status)

void HideSelectAll(void)

Hide the Select All checkbox.

bool IsSelectAll()

Return true if select all checkbox is checked.

virtual ~CQueryParsePanel()

void SetDataSource(IQueryDataSource *ds)

Set or update data source.

void OnButtonPrevious(wxCommandEvent &evt)

virtual void Create(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize)

Create window.

string m_PrevQuery

String of query last time query was executed.

void CreateControls()

Creates the controls and sizers.

void OnStringMatchTypeBtn(wxCommandEvent &evt)

CRichTextCtrl * m_pSearch

Widgets.

void x_CancelQueryInProgress()

If user presses cancel button, cancel running job.

void OnSearchHelp(wxCommandEvent &evt)

virtual void LoadSettings()

vector< pair< string, string > > TNamedQueries

string m_RegSection

Registry section for specific current data source (derived from columns)

IQueryWidget * m_QueryWidget

Interface to widget which will display query results.

std::string m_SearchString

current search string (as of previous update to m_pSearch)

string m_RegPath

Registry path for query panel.

void OnRecentQuery(wxCommandEvent &evt)

CStringMatching::EStringMatching m_PrevStringCompare

Value of string-matching selection last time query was executed.

wxAnimationCtrl * m_Animation

std::vector< std::pair< size_t, size_t > > m_SearchStringFields

positions of dictionary fields in current search string

CIRef< IQueryDataSource > m_QueryDataSource

Interface to data source that is being queried.

vector< pair< string, string > > m_DefaultQueries

Set of default queries.

void OnSearchctrlSearchStop(wxCommandEvent &evt)

void AddQueryText(const string &query_mod)

Add given string to currently displayed query text.

void OnCtrlKillFocus(wxFocusEvent &evt)

bool m_CaseSensitive

Current value for case-sensitive.

void Init()

Initialises member variables.

void OnToggleHideUnselected(wxCommandEvent &evt)

void x_AddRecentQuery(const std::string &q)

Add a query to the list of recently used queries, if it is unique.

void OnContextMenu(wxContextMenuEvent &)

wxStaticText * m_SearchType

static bool m_IconsInitialized

Only need to load icons into art provider once per run.

job_future< void > m_Future

Query tree and associated utility methods.

class CRegistryReadView provides a nested hierarchical view at a particular key.

void GetStringVec(const string &key, vector< string > &val) const

void Set(const string &key, int val)

access a named key at this level, with no recursion

CRichTextCtrl - a wrapper for wxRichTextCtrl that handles additional keyboard events (such as Clipboa...

EStringMatching

String matching algorithms.

@ eWildcardMatch

Wildcard pattern matching.

@ eRegex

Regular expression matching.

@ ePlainSearch

Plain search.

@ eMetaphone

Metaphone mathcing.

static wxString ResolvePath(const wxString &path, const wxString &rel_name)

Utility function to hide the platform specifics of locating our standard directories and files.

definition of a Culling tree

Interface for testing cancellation request in a long lasting operation.

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.

Base class for query node user defined object.

virtual void RegisterFileAlias(const wxArtID &anId, const wxArtClient &aClient, const wxSize &aSize, const wxString &aName, long aType=wxBITMAP_TYPE_ANY, int anIndex=-1)

static void simple_string(void)

static vector< string > arr

static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)

static const char * str(char *buf, int n)

void AddLine(const char *line, size_t len)

#define LOG_POST(message)

This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...

void Error(CExceptionArgs_Base &args)

#define NCBI_CATCH(message)

Catch CExceptions as well This macro is deprecated - use *_X or *_XX variant instead of it.

const string & GetMsg(void) const

Get message string.

void Info(CExceptionArgs_Base &args)

virtual bool Send(CEvent *evt, EDispatch disp_how=eDispatch_Default, int pool_name=ePool_Default)

Sends an event synchronously.

TObjectType * GetPointer(void) THROWS_NONE

Get pointer,.

void Reset(void)

Reset reference object.

bool IsNull(void) const THROWS_NONE

Check if pointer is null – same effect as Empty().

TObjectType * GetPointerOrNull(void) THROWS_NONE

Get pointer value.

const IQueryParseUserObject * GetUserObject() const

Get user object.

void Parse(const char *query_str, ECase case_sense=eCaseInsensitive, ESyntaxCheck syntax_check=eSyntaxCheck, bool verbose=false, const TFunctionNames &functions=TFunctionNames(0), unsigned line=0, unsigned linePos=0)

Query parser front-end function.

int GetQueriedCount() const

virtual bool EvalComplete()

unsigned pos

Position in the src line.

const TNode * GetQueryTree() const

void Print(CNcbiOstream &os) const

Print the query tree (debugging)

const string & GetStrValue() const

void Flatten_ParseTree(CQueryParseTree::TNode &node)

Flatten the AND and the OR subtrees transforming them from binary subtrees to n-ary subtrees.

const SSrcLoc & GetLoc() const

@ eCaseSensitiveUpper

Operators must come in upper case (AND)

@ eCaseInsensitive

Case insensitive parsing (AnD)

@ eSyntaxCheck

Best possible check for errors.

#define END_NCBI_SCOPE

End previously defined NCBI scope.

#define BEGIN_NCBI_SCOPE

Define ncbi namespace.

virtual bool IsCanceled(void) const =0

static string DoubleToString(double value, int precision=-1, TNumToStringFlags flags=0)

Convert double to string.

static int CompareNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)

Case-insensitive compare of a substring with another string.

static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)

Split a string using specified delimiters.

static void TruncateSpacesInPlace(string &str, ETrunc where=eTrunc_Both)

Truncate whitespace in a string (in-place)

static string IntToString(int value, TNumToStringFlags flags=0, int base=10)

Convert int to string.

static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)

Convert numeric value to string.

static string TruncateSpaces(const string &str, ETrunc where=eTrunc_Both)

Truncate whitespace in a string.

@ eTrunc_Begin

Truncate leading whitespace only.

@ eNocase

Case insensitive compare.

@ eCase

Case sensitive compare.

double Elapsed(void) const

Return time elapsed since first Start() or last Restart() call (in seconds).

void Start(void)

Start the timer.

Fun TreeDepthFirstTraverse(TTreeNode &tree_node, Fun func)

Depth-first tree traversal algorithm.

ETreeTraverseCode

Tree traverse code returned by the traverse predicate function.

unsigned int CountNodes(unsigned int depth=1, TCountNodes how=0) const

Count nodes of the tree of which this node is a root.

const TValue & GetValue(void) const

Return node's value.

@ eTreeTraverse

Keep traversal.

job_function_traits< _Fty >::future job_async(const _Fty &_Fnarg, const string &descr)

const struct ncbi::grid::netcache::search::fields::SIZE size

Int4 delta(size_t dimension_, const Int4 *score_)

Query string parsing components.

#define ID_STRING_MATCH_TYPE1

static const char * kRecentQueries

const char * kStringMatchTypes[kStringMatchTypesCount]

const int kStringMatchTypesCount

#define ID_QUERY_ANIMATIONCTRL

EVT_COMMAND_RANGE(13014, 13014+CQueryParsePanel::m_MaxRecentQueries+CQueryParsePanel::m_MaxDefaultQueries - 1, wxEVT_COMMAND_MENU_SELECTED, CQueryParsePanel::OnRecentQuery) EVT_COMMAND_RANGE(14014

static const char * kQueryPanel

CStringMatching::EStringMatching kStringMatchEnumTypes[kStringMatchTypesCount]

wxEVT_COMMAND_MENU_SELECTED

const char * kStringMatchTypesToolbar[kStringMatchTypesCount]

wxFileArtProvider * GetDefaultFileArtProvider()

wxString ToWxString(const string &s)

string GetMD5Digest(const CChecksum &cs)


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4