ARB
Classes | Macros | Typedefs | Enumerations | Functions | Variables
db_query.cxx File Reference
#include "db_query.h"
#include "db_query_local.h"
#include "query_expr.h"
#include <dbui.h>
#include <item_sel_list.h>
#include <awt_config_manager.hxx>
#include <awt_sel_boxes.hxx>
#include <aw_advice.hxx>
#include <aw_color_groups.hxx>
#include <aw_file.hxx>
#include <aw_msg.hxx>
#include <aw_awar.hxx>
#include <arb_progress.h>
#include <aw_root.hxx>
#include <aw_question.hxx>
#include <rootAsWin.h>
#include <ad_cb.h>
#include <arb_strbuf.h>
#include <arb_sort.h>
#include <arb_global_defs.h>
#include <Keeper.h>
#include <list>
#include <stack>
Include dependency graph for db_query.cxx:

Go to the source code of this file.

Classes

struct  hits_sort_params
 
class  TargetItem
 
class  FINAL_TYPE< SEQTYPE >
 xml element More...
 
struct  color_save_data
 

Macros

#define MAX_QUERY_LIST_LEN   100000
 
#define AWAR_COLORIZE   "tmp/dbquery_all/colorize"
 
#define AWAR_COLOR_LOADSAVE_NAME   "tmp/colorset/name"
 
#define KEY_Y_OFFSET   32
 

Typedefs

typedef Keeper< DbQuery * > QueryKeeper
 

Enumerations

enum  EXT_QUERY_TYPES { EXT_QUERY_NONE, EXT_QUERY_COMPARE_LINES, EXT_QUERY_COMPARE_WORDS }
 
enum  mark_mode { UNMARK, MARK, INVERT }
 
enum  loadsave_mode { SAVE, LOAD, OVERLAY, DELETE }
 

Functions

static void free_hit_description (long info)
 
void SET_QUERIED (GBDATA *gb_species, DbQuery *query, const char *hitInfo, size_t hitInfoLen=0)
 
void CLEAR_QUERIED (GBDATA *gb_species, DbQuery *query)
 
const chargetHitInfo (const char *item_id, DbQuery *query)
 
const chargetHitInfo (GBDATA *gb_species, DbQuery *query)
 
string keptHitReason (const string &currentHitReason, GBDATA *gb_item, DbQuery *query)
 
static void create_query_independent_awars (AW_root *aw_root, AW_default aw_def)
 
static int query_count_items (DbQuery *query, QUERY_RANGE range, QUERY_MODES mode)
 
static void split_sort_mask (unsigned long sort_mask, QUERY_RESULT_ORDER *order)
 
static QUERY_RESULT_ORDER find_display_determining_sort_order (QUERY_RESULT_ORDER *order)
 
static void remove_keydependent_sort_criteria (QUERY_RESULT_ORDER *order)
 
static void first_searchkey_changed_cb (AW_root *, DbQuery *query)
 
bool keep_criteria (QUERY_RESULT_ORDER old_criteria, QUERY_RESULT_ORDER new_criteria)
 
static void result_sort_order_changed_cb (AW_root *aw_root, DbQuery *query)
 
int numeric_string_cmp (const char *str1, const char *str2)
 
static int compare_hits (const void *cl_item1, const void *cl_item2, void *cl_param)
 
static void detectMaxNameLength (const char *key, long, void *cl_len)
 
bool SLOW_is_pseudo_key (const char *key)
 
bool is_pseudo_key (const char *key)
 
static void mark_queried_cb (AW_window *, DbQuery *query, int mark)
 
static void delete_queried_species_cb (AW_window *, DbQuery *query)
 
static GB_HASHcreate_ref_hash (const DbQuery *query, const char *key, bool split_words)
 
query_operator awarvalue2query_operator (const char *awarvalue)
 
static void perform_query_cb (AW_window *, DbQuery *query, EXT_QUERY_TYPES ext_query)
 
static void modify_fields_of_queried_cb (AW_window *, DbQuery *query)
 
static void predef_prg (AW_root *aw_root, DbQuery *query)
 
static void colorize_queried_cb (AW_window *, DbQuery *query)
 
static void colorize_marked_cb (AW_window *aww, BoundItemSel *cmd)
 
static void mark_colored_cb (AW_window *aww, BoundItemSel *cmd, mark_mode mode)
 
GBDATAget_colorset_root (BoundItemSel *bsel)
 
static void update_colorset_selection_list (const color_save_data *csd)
 
static void colorset_changed_cb (GBDATA *, const color_save_data *csd, GB_CB_TYPE cbt)
 
static void create_colorset_representation (BoundItemSel *bsel, AW_root *aw_root, StrArray &colordefs, GB_ERROR &error)
 
static GB_ERROR clear_all_colors (BoundItemSel *bsel, AW_root *aw_root)
 
static void clear_all_colors_cb (AW_window *aww, BoundItemSel *bsel)
 
static GB_ERROR restore_colorset_representation (BoundItemSel *bsel, CharPtrArray &colordefs)
 
static void loadsave_colorset_cb (AW_window *aws, BoundItemSel *bsel, loadsave_mode mode)
 
static AW_windowcreate_loadsave_colored_window (AW_root *aw_root, color_save_data *csd)
 
static AW_windowcreate_colorize_window (AW_root *aw_root, GBDATA *gb_main, DbQuery *query, ItemSelector *sel)
 
static AW_windowcreate_colorize_queried_window (AW_root *aw_root, DbQuery *query)
 
static void setup_modify_fields_config (AWT_config_definition &cdef, const DbQuery *query)
 
static AW_windowcreate_modify_fields_window (AW_root *aw_root, DbQuery *query)
 
static void set_field_of_queried_cb (AW_window *, DbQuery *query, bool append)
 
static AW_windowcreate_writeFieldOfListed_window (AW_root *aw_root, DbQuery *query)
 
static void set_protection_of_queried_cb (AW_window *, DbQuery *query)
 
static AW_windowcreate_set_protection_window (AW_root *aw_root, DbQuery *query)
 
static void toggle_flag_cb (AW_window *aww, DbQuery *query)
 
static void new_selection_made_cb (AW_root *aw_root, const char *awar_selection, DbQuery *query)
 
static void query_box_setup_config (AWT_config_definition &cdef, DbQuery *query)
 
template<typename CB >
static void query_rel_menu_entry (AW_window *aws, const char *id, const char *query_id, const char *label, const char *mnemonic, const char *helpText, AW_active Mask, const CB &cb)
 
static void destroyKeptQueries ()
 
static void keepQuery (GBDATA *gbmain, DbQuery *q)
 

Variables

const int MAX_CRITERIA = int(sizeof(unsigned long)*8/QUERY_SORT_CRITERIA_BITS)
 
static SmartPtr< QueryKeeperqueryKeeper
 

Macro Definition Documentation

#define MAX_QUERY_LIST_LEN   100000

Definition at line 43 of file db_query.cxx.

Referenced by QUERY::DbQuery_update_list().

#define AWAR_COLORIZE   "tmp/dbquery_all/colorize"
#define AWAR_COLOR_LOADSAVE_NAME   "tmp/colorset/name"

Definition at line 1614 of file db_query.cxx.

Referenced by create_loadsave_colored_window(), and loadsave_colorset_cb().

#define KEY_Y_OFFSET   32

Referenced by QUERY::create_query_box().

Typedef Documentation

Definition at line 2338 of file db_query.cxx.

Enumeration Type Documentation

Enumerator
EXT_QUERY_NONE 
EXT_QUERY_COMPARE_LINES 
EXT_QUERY_COMPARE_WORDS 

Definition at line 114 of file db_query.cxx.

enum mark_mode
Enumerator
UNMARK 
MARK 
INVERT 

Definition at line 1560 of file db_query.cxx.

Enumerator
SAVE 
LOAD 
OVERLAY 
DELETE 

Definition at line 1745 of file db_query.cxx.

Function Documentation

static void free_hit_description ( long  info)
static

Definition at line 47 of file db_query.cxx.

Referenced by QUERY::create_query_box().

void SET_QUERIED ( GBDATA gb_species,
DbQuery query,
const char hitInfo,
size_t  hitInfoLen = 0 
)
inline
void CLEAR_QUERIED ( GBDATA gb_species,
DbQuery query 
)
inline
const char* getHitInfo ( const char item_id,
DbQuery query 
)
inline
const char* getHitInfo ( GBDATA gb_species,
DbQuery query 
)
inline
string keptHitReason ( const string currentHitReason,
GBDATA gb_item,
DbQuery query 
)
inline

Definition at line 95 of file db_query.cxx.

References getHitInfo(), and string().

Referenced by QUERY::copy_selection_list_2_query_box(), and perform_query_cb().

static void create_query_independent_awars ( AW_root aw_root,
AW_default  aw_def 
)
static

Definition at line 102 of file db_query.cxx.

References AWAR_COLORIZE, and AW_root::awar_int().

Referenced by create_colorize_window(), and QUERY::create_query_box().

static int query_count_items ( DbQuery query,
QUERY_RANGE  range,
QUERY_MODES  mode 
)
static
static void split_sort_mask ( unsigned long  sort_mask,
QUERY_RESULT_ORDER order 
)
static
static QUERY_RESULT_ORDER find_display_determining_sort_order ( QUERY_RESULT_ORDER order)
static
static void remove_keydependent_sort_criteria ( QUERY_RESULT_ORDER order)
static
static void first_searchkey_changed_cb ( AW_root ,
DbQuery query 
)
static
bool keep_criteria ( QUERY_RESULT_ORDER  old_criteria,
QUERY_RESULT_ORDER  new_criteria 
)
inline

Definition at line 258 of file db_query.cxx.

References QUERY::QUERY_SORT_NONE, and QUERY::QUERY_SORT_REVERSE.

Referenced by result_sort_order_changed_cb().

static void result_sort_order_changed_cb ( AW_root aw_root,
DbQuery query 
)
static
int numeric_string_cmp ( const char str1,
const char str2 
)
inline

Definition at line 315 of file db_query.cxx.

References cmp, and double_cmp().

Referenced by compare_hits().

static int compare_hits ( const void *  cl_item1,
const void *  cl_item2,
void *  cl_param 
)
static
static void detectMaxNameLength ( const char key,
long  ,
void *  cl_len 
)
static

Definition at line 459 of file db_query.cxx.

Referenced by QUERY::DbQuery_update_list().

bool SLOW_is_pseudo_key ( const char key)
inline
bool is_pseudo_key ( const char key)
inline
static void mark_queried_cb ( AW_window ,
DbQuery query,
int  mark 
)
static
static void delete_queried_species_cb ( AW_window ,
DbQuery query 
)
static
static GB_HASH* create_ref_hash ( const DbQuery query,
const char key,
bool  split_words 
)
static
query_operator awarvalue2query_operator ( const char awarvalue)
inline

Definition at line 891 of file db_query.cxx.

References AND, ILLEGAL, and OR.

Referenced by QUERY::DbQuery::buildQueryExpr().

static void perform_query_cb ( AW_window ,
DbQuery query,
EXT_QUERY_TYPES  ext_query 
)
static

Definition at line 926 of file db_query.cxx.

References TargetItem::aimTo(), aw_message(), AW_root::awar(), QUERY::DbQuery::awar_by, QUERY::DbQuery::awar_ere, QUERY::DbQuery::awar_keys, QUERY::DbQuery::awar_queries, QUERY::DbQuery::awar_where, QUERY::DbQuery::aws, QUERY::DbQuery::buildQueryExpr(), CLEAR_QUERIED(), create_ref_hash(), dbq_assert, QUERY::DbQuery_update_list(), arb_progress::done(), DOWNCAST_REFERENCE, error(), QUERY::DbQuery::expect_hit_in_ref_list, EXT_QUERY_COMPARE_LINES, EXT_QUERY_COMPARE_WORDS, EXT_QUERY_NONE, fputc(), fputs(), GB_failedTo_error(), QUERY::DbQuery::gb_main, GB_pop_transaction(), GB_push_transaction(), GB_read_as_string(), GB_read_flag(), QUERY::DbQuery::gb_ref, GBS_free_hash(), GBS_global_string(), GBS_hash_elements(), GBS_read_hash(), GBT_get_name_or_description(), MutableItemSelector::generate_item_id, MutableItemSelector::get_first_item, MutableItemSelector::get_first_item_container, QueryExpr::get_key(), QueryExpr::get_key_type(), MutableItemSelector::get_next_item, MutableItemSelector::get_next_item_container, AW_window::get_root(), QueryExpr::getError(), arb_progress::inc_and_check_user_abort(), QUERY::IS_QUERIED(), keptHitReason(), QueryExpr::matches(), QueryExpr::negate(), NULp, QKEY_EXPLICIT, QUERY_ALL_ITEMS, query_count_items(), QUERY::QUERY_DONT_MATCH, QUERY::QUERY_ENLARGE, QUERY::QUERY_GENERATE, QUERY::QUERY_MARKED, QUERY::QUERY_MATCH, QUERY::QUERY_REDUCE, AW_awar::read_int(), AW_awar::read_string(), QUERY::DbQuery::selector, SET_QUERIED(), and type.

Referenced by QUERY::create_query_box().

static void modify_fields_of_queried_cb ( AW_window ,
DbQuery query 
)
static
static void predef_prg ( AW_root aw_root,
DbQuery query 
)
static
static void colorize_queried_cb ( AW_window ,
DbQuery query 
)
static
static void colorize_marked_cb ( AW_window aww,
BoundItemSel cmd 
)
static
static void mark_colored_cb ( AW_window aww,
BoundItemSel cmd,
mark_mode  mode 
)
static
GBDATA* get_colorset_root ( BoundItemSel bsel)
inline
static void update_colorset_selection_list ( const color_save_data csd)
static
static void colorset_changed_cb ( GBDATA ,
const color_save_data csd,
GB_CB_TYPE  cbt 
)
static

Definition at line 1636 of file db_query.cxx.

References GB_CB_CHANGED, and update_colorset_selection_list().

Referenced by create_loadsave_colored_window().

static void create_colorset_representation ( BoundItemSel bsel,
AW_root aw_root,
StrArray &  colordefs,
GB_ERROR error 
)
static
static GB_ERROR clear_all_colors ( BoundItemSel bsel,
AW_root aw_root 
)
static
static void clear_all_colors_cb ( AW_window aww,
BoundItemSel bsel 
)
static
static GB_ERROR restore_colorset_representation ( BoundItemSel bsel,
CharPtrArray colordefs 
)
static
static void loadsave_colorset_cb ( AW_window aws,
BoundItemSel bsel,
loadsave_mode  mode 
)
static
static AW_window* create_loadsave_colored_window ( AW_root aw_root,
color_save_data csd 
)
static
static AW_window* create_colorize_window ( AW_root aw_root,
GBDATA gb_main,
DbQuery query,
ItemSelector sel 
)
static
static AW_window* create_colorize_queried_window ( AW_root aw_root,
DbQuery query 
)
static

Definition at line 1959 of file db_query.cxx.

References create_colorize_window(), QUERY::DbQuery::gb_main, and NULp.

Referenced by QUERY::create_query_box().

static void setup_modify_fields_config ( AWT_config_definition cdef,
const DbQuery query 
)
static
static AW_window* create_modify_fields_window ( AW_root aw_root,
DbQuery query 
)
static
static void set_field_of_queried_cb ( AW_window ,
DbQuery query,
bool  append 
)
static
static AW_window* create_writeFieldOfListed_window ( AW_root aw_root,
DbQuery query 
)
static
static void set_protection_of_queried_cb ( AW_window ,
DbQuery query 
)
static
static AW_window* create_set_protection_window ( AW_root aw_root,
DbQuery query 
)
static
static void toggle_flag_cb ( AW_window aww,
DbQuery query 
)
static
static void new_selection_made_cb ( AW_root aw_root,
const char awar_selection,
DbQuery query 
)
static
static void query_box_setup_config ( AWT_config_definition cdef,
DbQuery query 
)
static
template<typename CB >
static void query_rel_menu_entry ( AW_window aws,
const char id,
const char query_id,
const char label,
const char mnemonic,
const char helpText,
AW_active  Mask,
const CB &  cb 
)
static

Definition at line 2287 of file db_query.cxx.

References GBS_global_string_copy(), and AW_window::insert_menu_topic().

Referenced by QUERY::create_query_box().

static void destroyKeptQueries ( )
static

Definition at line 2341 of file db_query.cxx.

References SmartPtr< T, C >::setNull().

Referenced by keepQuery().

static void keepQuery ( GBDATA gbmain,
DbQuery q 
)
static

Variable Documentation

const int MAX_CRITERIA = int(sizeof(unsigned long)*8/QUERY_SORT_CRITERIA_BITS)
SmartPtr<QueryKeeper> queryKeeper
static

Definition at line 2340 of file db_query.cxx.