Databaseconnectionclasses  0.5.3
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Attributes | List of all members
hk_class Class Reference

basic class for all other defined classes. More...

#include <hk_class.h>

Inheritance diagram for hk_class:
Inheritance graph
[legend]

Public Types

enum  enum_interaction { noninteractive, interactive }
 
enum  enum_measuresystem { cm, inch }
 
enum  enum_tagtype { normaltag, mastertag }
 

Public Member Functions

void hkclassname (const hk_string &n)
 
hk_string hkclassname (void) const
 
void hkdebug (const hk_string &d) const
 
void hkdebug (const hk_string &d, const hk_string &e) const
 
void hkdebug (const hk_string &d, int i) const
 
void hkdebug (const hk_string &d, double i) const
 
void wanna_debug (bool d)
 
bool wanna_debug (void) const
 
bool generaldebug (void)
 
virtual void savedata (ostream &s)
 
virtual void loaddata (xmlNodePtr definition)
 

Static Public Member Functions

static void set_generaldebug (bool d)
 
static hk_string hk_translate (const hk_string &t)
 
static void show_warningmessage (const hk_string &m)
 
static void set_warningmessage (messagewindowtype *m)
 
static bool show_yesnodialog (const hk_string &m, bool default_value)
 
static void set_yesnodialog (yesno_dialogtype *d)
 
static hk_string show_stringvaluedialog (const hk_string &t)
 
static void set_stringvaluedialog (stringvalue_dialogtype *t)
 
static void set_translatefunction (translatefunctiontype *t)
 
static void set_filedialog (file_dialogtype *f)
 
static hk_string show_filedialog (const hk_string &f="", enum_operationmode m=file_open)
 
static void set_directorydialog (stringvalue_dialogtype *f)
 
static hk_string show_directorydialog (const hk_string &f="")
 
static void set_showpedantic (bool s)
 
static bool showpedantic (void)
 
static void set_measuresystem (enum_measuresystem)
 
static enum_measuresystem measuresystem (void)
 
static xmlNodePtr get_tagvalue (xmlNodePtr where, const hk_string &tag, hk_string &value, int position=1, enum_tagtype tagtype=normaltag)
 
static xmlNodePtr get_tagvalue (xmlNodePtr where, const hk_string &tag, unsigned long &value, int position=1)
 
static xmlNodePtr get_tagvalue (xmlNodePtr where, const hk_string &tag, unsigned int &value, int position=1)
 
static xmlNodePtr get_tagvalue (xmlNodePtr where, const hk_string &tag, long &value, int position=1)
 
static xmlNodePtr get_tagvalue (xmlNodePtr where, const hk_string &tag, int &value, int position=1)
 
static xmlNodePtr get_tagvalue (xmlNodePtr where, const hk_string &tag, bool &value, int position=1)
 
static xmlNodePtr get_tagvalue (xmlNodePtr &where, const hk_string &tag)
 
static void set_tagvalue (ostream &stream, const hk_string &tag, const hk_string &value)
 
static void set_tagvalue (ostream &stream, const hk_string &tag, unsigned long value)
 
static void set_tagvalue (ostream &stream, const hk_string &tag, unsigned int value)
 
static void set_tagvalue (ostream &stream, const hk_string &tag, long value)
 
static void set_tagvalue (ostream &stream, const hk_string &tag, int value)
 
static void set_tagvalue (ostream &stream, const hk_string &tag, bool value)
 
static void start_mastertag (ostream &stream, const hk_string &tag)
 
static void end_mastertag (ostream &stream, const hk_string &tag)
 
static void set_defaultdatetimeformat (const hk_string &timeformat, const hk_string &dateformat, const hk_string &datetimeformat)
 
static hk_string defaultdateformat (void)
 
static hk_string defaulttimeformat (void)
 
static hk_string defaultdatetimeformat (void)
 
static void save_preferences (void)
 
static bool runtime_only (void)
 
static void set_locale (const hk_string &locale)
 
static hk_string locale (void)
 
static void set_defaultdriver (const hk_string &d)
 
static hk_string defaultdriver (void)
 
static void set_default_automatic_data_update (bool)
 
static bool default_automatic_data_update (void)
 

Protected Member Functions

hk_interpreternew_interpreter (const hk_string &interpreter, hk_presentation *)
 

Static Protected Attributes

static hk_string p_defaulttimeformat ="h:m:s"
 
static hk_string p_defaultdateformat ="D.M.Y"
 
static hk_string p_defaultdatetimeformat ="D.M.Y h:m:s"
 
static bool p_runtime_only =false
 

Detailed Description

basic class for all other defined classes.

hk_class is the basic class for all other defined classes. It has some methods to support a simple debugging.

Version
Revision
1.49
Author
Horst Knorr (hk_cl.nosp@m.asse.nosp@m.s@kno.nosp@m.da.o.nosp@m.rg)

Member Enumeration Documentation

this enum will be used from other class members if their behaviour should be different e.g. if called from the command line in a script (then they should be noninteractive) or as a GUI application, where the user should interactively enter a password when the previous login failed.

Member Function Documentation

void hk_class::end_mastertag ( ostream &  stream,
const hk_string &  tag 
)
static
xmlNodePtr hk_class::get_tagvalue ( xmlNodePtr  where,
const hk_string &  tag,
hk_string &  value,
int  position = 1,
enum_tagtype  tagtype = normaltag 
)
static

called from loaddata to load a variable value originally stored with set_tagvalue

Parameters
wherea text where the wished value has to be filtered out
tagthe tag name. See set_tagvalue for details
valuethe found value will be returned in this parameter
positionif there are more than one values for a variable (i.e. a list of columnnames),first position is 1 give the wished position of the value.
Returns
true if the tag was found and the value could be set else false

Referenced by hk_reportsectionpair::clear_countingfields(), hk_colour::loaddata(), hk_dsgrid::loaddata(), hk_column::save_to_file(), hk_dsgrid::set_gridcolumns(), and hk_reportsection::set_subreport().

hk_string hk_class::hk_translate ( const hk_string &  t)
static

tries to translate the message t by using the translatingfunction set with set_translatefunction.

Returns
the translated message. If translating was not possible it will return the parameter t unchanged.

Referenced by hk_importcsv::add_columnname(), hk_column::asstring_at(), hk_column::columntype_name(), hk_mysqltable::driver_specific_enable(), hk_mysqldatasource::driver_specific_enable(), hk_importcsv::execute(), hk_colour::loaddata(), hk_storagedatasource::memory_error(), set_locale(), hk_reportsection::set_replacefunction(), show_yesnodialog(), and hk_font::text2lines().

void hk_class::hkclassname ( const hk_string &  n)

The classname is for internal debugging use only It will be shown in front of all debugging messages.

References hkclassname(), and hkdebug().

Referenced by hk_mysqldatasource::driver_specific_columns(), hkclassname(), hk_database::load_datasource(), and hk_presentation::new_datasource().

void hk_class::hkdebug ( const hk_string &  d) const

if wanna_debug is true hkdebug prints on standard output the classname and the message d.

Parameters
dis the message that will be printed.

Referenced by hk_reportsection::actual_string(), hk_importcsv::add_columnname(), hk_reportsection::add_depending_fields(), hk_reportsection::add_sectioncountfunctiontype(), hk_importcsv::before_columns_deleted(), hk_dbvisible::before_source_vanishes(), hk_dsgrid::change_columnposition(), hk_reportsectionpair::clear_countingfields(), hk_dsgrid::columnscount(), hk_importcsv::create_valuelist(), hk_dsgrid::datasource_disable(), hk_dsgrid::datasource_enable(), hk_datetime::date_asstring(), hk_datetime::datetime_asstring(), hk_mysqldatasource::driver_specific_columns(), hk_storagedatasource::driver_specific_columns(), hk_mysqltable::driver_specific_enable(), hk_mysqldatasource::driver_specific_enable(), hk_storagedatasource::driver_specific_enable(), hk_mysqldatabase::driver_specific_tablelist(), hk_importcsv::execute(), hk_column::find(), hk_dsgrid::gridcolumn(), hkclassname(), hk_reportsection::horizontal2relativ(), hk_reportsectionpair::init_sections(), hk_column::is_findstring(), hk_column::load_from_file(), hk_dsgrid::loaddata(), hk_data::name(), hk_reportsection::new_data(), hk_reportsection::new_uniquevalue(), hk_reportsection::relativ2horizontal(), hk_reportsection::relativ2vertical(), hk_column::reset_changed_data(), hk_reportsection::reset_count(), hk_column::save_to_file(), hk_dsgrid::savedata(), hk_mysqlconnection::server_needs(), hk_importcsv::set_append_rows(), hk_column::set_asbinary(), hk_column::set_asbool(), hk_column::set_asstring(), hk_column::set_columntype(), hk_reportsection::set_datasource(), hk_datetime::set_date(), hk_datetime::set_date_asstring(), hk_datetime::set_dateformat(), hk_datetime::set_datetime(), hk_datetime::set_datetime_asstring(), hk_datetime::set_datetimeformat(), hk_dsgrid::set_enablingbehaviour(), hk_importcsv::set_filedefinition(), hk_importcsv::set_filename(), hk_importcsv::set_firstrow_contains_fieldnames(), hk_dsgrid::set_gridcolumns(), hk_dsgrid::set_gridcolumnwidth(), hk_dsgrid::set_hold_rowdefinition(), hk_column::set_name(), hk_column::set_notnull(), hk_datetime::set_now(), hk_column::set_primary(), hk_column::set_readonly(), hk_reportsection::set_replacefunction(), hk_reportsectionpair::set_sections(), hk_column::set_size(), hk_reportsection::set_subreport(), hk_datetime::set_time(), hk_datetime::set_time_asstring(), hk_datetime::set_timeformat(), hk_reportsection::set_unique(), hk_datetime::time_asstring(), and hk_reportsection::vertical2relativ().

void hk_class::loaddata ( xmlNodePtr  definition)
virtual

loads the object's values out of the definition string. Especially used to load queries, forms and reports

Reimplemented in hk_database, hk_connection, hk_report, hk_form, hk_visible, hk_button, hk_label, hk_presentation, hk_dsgrid, hk_qbe, hk_subform, hk_dsdatavisible, hk_dscombobox, hk_font, hk_dsgridcolumn, hk_colour, hk_tabvisible, hk_dsvisible, hk_module, hk_dsquery, and hk_dsimage.

Referenced by hk_connection::maxcharsize().

bool hk_class::runtime_only ( void  )
static

true if widgets can't get in design mode

Referenced by hk_importcsv::execute().

void hk_class::save_preferences ( void  )
static

This function stores all preferences of the hk_classes library in the file ~/.hk_classes/preferences like the defaultdateformat, and hk_report::printcommand

References end_mastertag(), set_tagvalue(), and start_mastertag().

void hk_class::savedata ( ostream &  s)
virtual

stores the object's values to stream s. Especially used to store queries, forms and reports

Reimplemented in hk_database, hk_connection, hk_report, hk_form, hk_visible, hk_button, hk_label, hk_presentation, hk_dsgrid, hk_qbe, hk_subform, hk_dsdatavisible, hk_dscombobox, hk_font, hk_dsgridcolumn, hk_colour, hk_tabvisible, hk_dsvisible, hk_module, hk_dsquery, and hk_dsimage.

Referenced by hk_connection::maxcharsize().

void hk_class::set_generaldebug ( bool  d)
static
Parameters
dif true hk_debug will print messages of ALL classes even if wanna_debug is false for a particular class.
void hk_class::set_locale ( const hk_string &  locale)
static

sets the locale which is used for the regional formats (e.g. dataformat). Default is "" that means that the environment variable is queried and set

References hk_translate(), show_stringvaluedialog(), show_warningmessage(), and show_yesnodialog().

void hk_class::set_showpedantic ( bool  s)
static

if true all dialogs and messages will be shown. if false only important messages(errors and warnings) will be shown.

Parameters
sdefault = true
void hk_class::set_stringvaluedialog ( stringvalue_dialogtype *  t)
static

you can write your own GUI dependend function to print a string value dialog by defining a function of stringvalue_dialogtype

void hk_class::set_tagvalue ( ostream &  stream,
const hk_string &  tag,
const hk_string &  value 
)
static

Each value will be stored between delimiting tags in the form <tag>value</tag>

Parameters
streama stream to which the value will be written
tagthe tag name
valuethe value to be stored

Referenced by hk_reportsectionpair::clear_countingfields(), save_preferences(), hk_column::save_to_file(), hk_colour::savedata(), hk_dsgrid::savedata(), and hk_reportsection::set_subreport().

void hk_class::set_warningmessage ( messagewindowtype *  m)
static

you can write your own GUI dependend function to print warning messages by defining a function of messagewindowtype

void hk_class::set_yesnodialog ( yesno_dialogtype *  d)
static

you can write your own GUI dependend function to print yes_no message by defining a function of dialogtype

hk_string hk_class::show_stringvaluedialog ( const hk_string &  t)
static

prints a question by using a function set with set_stringvaluedialog. If none is set the question will be print to standard error (cerr). The user has to answer the question by entering a string (i.e. a filename).

Parameters
tthe shown question
Returns
the string the user gave as an answer

Referenced by set_locale().

void hk_class::show_warningmessage ( const hk_string &  m)
static
bool hk_class::show_yesnodialog ( const hk_string &  m,
bool  default_value 
)
static

prints a question by using a function set with set_yesnomessage. If none is set the question will be print to standard error (cerr). The user has either to answer the question with yes or no.

Parameters
mthe shown question
default_valueif set_show_pedantic == false the default_value will be returned without asking.

References hk_translate().

Referenced by hk_importcsv::execute(), and set_locale().

void hk_class::start_mastertag ( ostream &  stream,
const hk_string &  tag 
)
static

just writes <tag> to a stream. Use this function if you want to begin a section. Don't forget to call end_mastertag

Referenced by hk_reportsectionpair::clear_countingfields(), save_preferences(), hk_column::save_to_file(), hk_colour::savedata(), hk_dsgrid::savedata(), hk_dsgrid::set_gridcolumns(), and hk_reportsection::set_subreport().

void hk_class::wanna_debug ( bool  d)
Parameters
dif true hk_debug will print messages of the class else there is no output.

References wanna_debug().

Referenced by hk_importcsv::create_valuelist(), and wanna_debug().


The documentation for this class was generated from the following files: