ARB
db_query.h
Go to the documentation of this file.
1 // ============================================================ //
2 // //
3 // File : db_query.h //
4 // Purpose : Database queries //
5 // //
6 // Institute of Microbiology (Technical University Munich) //
7 // http://www.arb-home.de/ //
8 // //
9 // ============================================================ //
10 
11 #ifndef DB_QUERY_H
12 #define DB_QUERY_H
13 
14 #ifndef ITEMS_H
15 #include <items.h>
16 #endif
17 #ifndef AW_BASE_HXX
18 #include <aw_base.hxx>
19 #endif
20 
21 
22 class AW_selection_list;
23 
24 namespace QUERY {
25 
26  typedef const char *AwarName;
27  typedef void (*popup_info_window_cb)(AW_root *aw_root, GBDATA *gb_main);
28 
29  class DbQuery;
30 
31  class query_spec {
32  ItemSelector& selector; // which kind of item do we handle?
33 
34  public:
35  query_spec(ItemSelector& selector_);
36 
37  ItemSelector& get_queried_itemtype() const { return selector; }
38 
39  GBDATA *gb_main; // the main database (in merge tool: source db in left query; dest db in right query)
40  GBDATA *gb_ref; // second reference database (only used by merge tool; dest db in left query; source db in right query)
41  bool expect_hit_in_ref_list; // merge-tool: when searching dups in fields: match only if hit exists in other DBs hitlist (true for target-DB-query)
42  AwarName species_name; // awar containing current species name
43  AwarName tree_name; // awar containing current tree name
44 
45  int select_bit; // one of 1 2 4 8 .. 128 (one for each query box)
46  int use_menu; // put additional commands in menu
47 
48  const char *ere_pos_fig; // rebuild enlarge reduce
49  const char *where_pos_fig; // current, marked or all species (used for sub-items of species)
50  const char *by_pos_fig; // fit query don't fit, marked
51 
52  const char *qbox_pos_fig; // key box for queries
53  const char *key_pos_fig; // the key
54  const char *query_pos_fig; // the query
55 
56 
57  const char *result_pos_fig; // the result box
58  const char *count_pos_fig;
59 
60  const char *do_query_pos_fig;
61  const char *config_pos_fig;
62  const char *do_mark_pos_fig;
63  const char *do_unmark_pos_fig;
64  const char *do_delete_pos_fig;
65  const char *do_set_pos_fig; // multi set a key
66  const char *open_parser_pos_fig;
67  const char *do_refresh_pos_fig;
68 
70 
71  const char *info_box_pos_fig;
72 
73  bool is_queried(GBDATA *gb_item) const;
74  };
75 
76  void copy_selection_list_2_query_box(DbQuery *query, AW_selection_list *srclist, const char *hit_description);
77  DbQuery *create_query_box(AW_window *aws, query_spec *awtqs, const char *query_id); // create the query box
78  void search_duplicated_field_content(AW_window *dummy, DbQuery *query, bool tokenize);
79  long count_queried_items(DbQuery *query, QUERY_RANGE range);
80  void unquery_all(void *dummy, DbQuery *query);
81 
83 
84  inline bool IS_QUERIED(GBDATA *gb_item, const query_spec *aqs) { return aqs->is_queried(gb_item); }
85  bool IS_QUERIED(GBDATA *gb_item, const DbQuery *query);
86 
87  void DbQuery_update_list(DbQuery *query);
88 
90 
91  GBDATA *query_get_gb_main(DbQuery *query);
92 
93 };
94 
95 #else
96 #error db_query.h included twice
97 #endif // DB_QUERY_H
const char * config_pos_fig
Definition: db_query.h:61
AwarName species_name
Definition: db_query.h:42
void DbQuery_update_list(DbQuery *query)
Definition: db_query.cxx:485
const char * key_pos_fig
Definition: db_query.h:53
GBDATA * query_get_gb_main(DbQuery *query)
Definition: db_query.cxx:106
const char * ere_pos_fig
Definition: db_query.h:48
void copy_selection_list_2_query_box(DbQuery *query, AW_selection_list *srclist, const char *hit_description)
Definition: db_query.cxx:1130
const char * where_pos_fig
Definition: db_query.h:49
const char * AwarName
Definition: db_query.h:26
DbQuery * create_query_box(AW_window *aws, query_spec *awtqs, const char *query_id)
Definition: db_query.cxx:2346
const char * result_pos_fig
Definition: db_query.h:57
void unquery_all(void *dummy, DbQuery *query)
Definition: db_query.cxx:620
long count_queried_items(DbQuery *query, QUERY_RANGE range)
Definition: db_query.cxx:159
const char * open_parser_pos_fig
Definition: db_query.h:66
ItemSelector & get_queried_itemtype(DbQuery *query)
Definition: db_query.cxx:110
GBDATA * gb_ref
Definition: db_query.h:40
const char * qbox_pos_fig
Definition: db_query.h:52
void(* popup_info_window_cb)(AW_root *aw_root, GBDATA *gb_main)
Definition: db_query.h:27
const char * count_pos_fig
Definition: db_query.h:58
const char * by_pos_fig
Definition: db_query.h:50
bool expect_hit_in_ref_list
Definition: db_query.h:41
void search_duplicated_field_content(AW_window *dummy, DbQuery *query, bool tokenize)
Definition: db_query.cxx:1194
Definition: db_query.h:24
QUERY_RANGE
Definition: items.h:40
TokLPtr tokenize(const std::string &description, TokLPtr tokenLP)
AW_window * create_colorize_items_window(AW_root *aw_root, GBDATA *gb_main, ItemSelector &sel)
Definition: db_query.cxx:1959
popup_info_window_cb popup_info_window
Definition: db_query.h:69
const char * do_mark_pos_fig
Definition: db_query.h:62
bool IS_QUERIED(GBDATA *gb_item, const query_spec *aqs)
Definition: db_query.h:84
query_spec(ItemSelector &selector_)
Definition: db_query.cxx:120
const char * query_pos_fig
Definition: db_query.h:54
const char * do_query_pos_fig
Definition: db_query.h:60
const char * info_box_pos_fig
Definition: db_query.h:71
GBDATA * gb_main
Definition: db_query.h:39
GBDATA * gb_main
Definition: adname.cxx:33
ItemSelector & get_queried_itemtype() const
Definition: db_query.h:37
const char * do_set_pos_fig
Definition: db_query.h:65
bool is_queried(GBDATA *gb_item) const
Definition: db_query.cxx:151
AwarName tree_name
Definition: db_query.h:43
const char * do_delete_pos_fig
Definition: db_query.h:64
const char * do_unmark_pos_fig
Definition: db_query.h:63
const char * do_refresh_pos_fig
Definition: db_query.h:67