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 | |
---|
69 | popup_info_window_cb popup_info_window; |
---|
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 | |
---|
82 | ItemSelector& get_queried_itemtype(DbQuery *query); |
---|
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 | |
---|
89 | AW_window *create_colorize_items_window(AW_root *aw_root, GBDATA *gb_main, ItemSelector& sel); |
---|
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 |
---|