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 *rescan_pos_fig; // rescan label |
---|
54 | const char *key_pos_fig; // the key |
---|
55 | const char *query_pos_fig; // the query |
---|
56 | |
---|
57 | |
---|
58 | const char *result_pos_fig; // the result box |
---|
59 | const char *count_pos_fig; |
---|
60 | |
---|
61 | const char *do_query_pos_fig; |
---|
62 | const char *config_pos_fig; |
---|
63 | const char *do_mark_pos_fig; |
---|
64 | const char *do_unmark_pos_fig; |
---|
65 | const char *do_delete_pos_fig; |
---|
66 | const char *do_set_pos_fig; // multi set a key |
---|
67 | const char *open_parser_pos_fig; |
---|
68 | const char *do_refresh_pos_fig; |
---|
69 | |
---|
70 | popup_info_window_cb popup_info_window; |
---|
71 | |
---|
72 | const char *info_box_pos_fig; |
---|
73 | |
---|
74 | bool is_queried(GBDATA *gb_item) const; |
---|
75 | }; |
---|
76 | |
---|
77 | void copy_selection_list_2_query_box(DbQuery *query, AW_selection_list *srclist, const char *hit_description); |
---|
78 | DbQuery *create_query_box(AW_window *aws, query_spec *awtqs, const char *query_id); // create the query box |
---|
79 | void search_duplicated_field_content(AW_window *dummy, DbQuery *query, bool tokenize); |
---|
80 | long count_queried_items(DbQuery *query, QUERY_RANGE range); |
---|
81 | void unquery_all(void *dummy, DbQuery *query); |
---|
82 | |
---|
83 | ItemSelector& get_queried_itemtype(DbQuery *query); |
---|
84 | |
---|
85 | inline bool IS_QUERIED(GBDATA *gb_item, const query_spec *aqs) { return aqs->is_queried(gb_item); } |
---|
86 | bool IS_QUERIED(GBDATA *gb_item, const DbQuery *query); |
---|
87 | |
---|
88 | void DbQuery_update_list(DbQuery *query); |
---|
89 | |
---|
90 | AW_window *create_colorize_items_window(AW_root *aw_root, GBDATA *gb_main, ItemSelector& sel); |
---|
91 | |
---|
92 | GBDATA *query_get_gb_main(DbQuery *query); |
---|
93 | |
---|
94 | }; |
---|
95 | |
---|
96 | #else |
---|
97 | #error db_query.h included twice |
---|
98 | #endif // DB_QUERY_H |
---|