Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

hk_class.h

00001 // ****************************************************************************
00002 // copyright (c) 2000-2005 Horst Knorr <hk_classes@knoda.org>
00003 // This file is part of the hk_classes library.
00004 // This file may be distributed and/or modified under the terms of the
00005 // GNU Library Public License version 2 as published by the Free Software
00006 // Foundation and appearing in the file COPYING included in the
00007 // packaging of this file.
00008 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00009 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00010 // ****************************************************************************
00011 #ifndef HK_CLASS
00012 #define HK_CLASS
00013 #include "hk_definitions.h"
00014 #ifdef HAVE_CONFIG_H
00015 #include "config.h"
00016 #endif
00017 #ifdef NO_IOSTREAM
00018 #include <iostream.h>
00019 #include <fstream.h>
00020 #else
00021 #include <fstream>
00022 #include <iostream>
00023 #endif                                            //HAVE_IOSTREAM
00024 
00025 using namespace std;
00026 class hk_connection;
00027 class hk_presentation;
00028 class hk_interpreter;
00029 
00030 typedef void  messagewindowtype(const hk_string&);
00031 typedef bool  yesno_dialogtype(const hk_string&, bool );
00032 typedef hk_string translatefunctiontype(const hk_string&);
00033 typedef void password_dialogtype(hk_connection*,struct_connectionfields*);
00034 typedef bool newpassword_dialogtype(hk_string&);
00035 typedef hk_string stringvalue_dialogtype(const hk_string&);
00036 enum enum_operationmode{file_open,file_save};
00037 typedef hk_string file_dialogtype(const hk_string&,enum_operationmode);
00038                                                   //to display the progress of an action,returns true if cancel is pressed progress(currentposition,max);
00039 typedef bool progress_dialogtype(long int,long int,const hk_string&);
00048 class hk_class
00049 {
00050     public:
00056 enum enum_interaction {noninteractive,interactive};
00057 #ifdef  HK_DEBUG
00058 
00062         void hkclassname(const hk_string& n);
00063         hk_string hkclassname(void)const ;
00068         void hkdebug(const hk_string& d)const ;
00069         void hkdebug(const hk_string& d, const hk_string& e)const ;
00070         void hkdebug(const hk_string& d, int i)const ;
00071         void hkdebug(const hk_string& d, double i)const ;
00075         void wanna_debug(bool d);
00076         bool wanna_debug(void)const ;
00081         static  void set_generaldebug(bool d);
00082         bool generaldebug(void){return p_generaldebug;}
00083 #endif
00084 
00088         static  hk_string hk_translate(const hk_string& t);
00093         static  void show_warningmessage(const hk_string& m);
00098         static  void set_warningmessage(messagewindowtype* m);
00106         static  bool show_yesnodialog(const hk_string& m, bool default_value);
00111         static  void set_yesnodialog(yesno_dialogtype* d);
00119         static  hk_string show_stringvaluedialog(const hk_string& t);
00124         static  void set_stringvaluedialog(stringvalue_dialogtype* t);
00125         static  void set_translatefunction(translatefunctiontype* t);
00126 
00127         static  void set_filedialog(file_dialogtype* f);
00128         static  hk_string show_filedialog(const hk_string& f="",enum_operationmode m=file_open);
00129 
00130         static  void set_directorydialog(stringvalue_dialogtype* f);
00131         static  hk_string show_directorydialog(const hk_string& f="");
00132 
00133 
00139         static  void set_showpedantic(bool s);
00140         static  bool    showpedantic(void){return p_showpedantic;}
00141         enum enum_measuresystem{cm,inch};
00142         static void set_measuresystem(enum_measuresystem);
00143         static enum_measuresystem measuresystem(void);
00147         virtual void  savedata(ostream& s);
00151         virtual void  loaddata(const hk_string& definition);
00152         enum enum_tagtype{normaltag,mastertag};
00162         static  bool get_tagvalue(const hk_string &where, const hk_string &tag, hk_string &value, int position=1,enum_tagtype tagtype=normaltag);
00163         static  bool get_tagvalue(const hk_string &where, const hk_string &tag, unsigned long &value, int position=1);
00164         static  bool get_tagvalue(const hk_string &where, const hk_string &tag, unsigned int &value, int position=1);
00165         static  bool get_tagvalue(const hk_string &where, const hk_string &tag, long &value, int position=1);
00166         static  bool get_tagvalue(const hk_string &where, const hk_string &tag, int &value, int position=1);
00167         static  bool get_tagvalue(const hk_string &where, const hk_string &tag, bool &value, int position=1);
00174         static  void set_tagvalue(ostream& stream,const hk_string& tag,const hk_string& value);
00175         static  void set_tagvalue(ostream& stream,const hk_string& tag,unsigned long value);
00176         static  void set_tagvalue(ostream& stream,const hk_string& tag,unsigned int value);
00177         static  void set_tagvalue(ostream& stream,const hk_string& tag,long value);
00178         static  void set_tagvalue(ostream& stream,const hk_string& tag,int value);
00179         static  void set_tagvalue(ostream& stream,const hk_string& tag,bool value);
00185         static  void start_mastertag(ostream& stream,const hk_string& tag);
00189         static  void end_mastertag(ostream& stream,const hk_string& tag);
00190         static  void set_defaultdatetimeformat(const hk_string& timeformat,const hk_string& dateformat,const hk_string&datetimeformat);
00191         static  hk_string defaultdateformat(void);
00192         static  hk_string defaulttimeformat(void);
00193         static  hk_string defaultdatetimeformat(void);
00194 
00199         static  void save_preferences(void);
00203         static  bool runtime_only(void);
00208         static void set_locale(const hk_string& locale);
00209         static hk_string locale(void);
00210 
00211         static void set_defaultdriver(const hk_string& d);
00212         static hk_string defaultdriver(void) ;
00213 
00214     protected:
00215 
00216         hk_class(void);
00217         virtual ~hk_class(void);
00218  hk_interpreter* new_interpreter(const hk_string& interpreter,hk_presentation*);
00219         static  hk_string p_defaulttimeformat;
00220         static  hk_string p_defaultdateformat;
00221         static  hk_string p_defaultdatetimeformat;
00222         static  bool        p_runtime_only;
00223 
00224     private:
00225         static  void set_tag(const hk_string& tag);
00226         static  void set_levelspace(ostream& stream);
00227         hk_string p_classname;
00228 #ifdef HK_DEBUG
00229         bool p_debug;
00230 #endif
00231         static  yesno_dialogtype*   p_yesno;
00232         static  messagewindowtype*  p_warning;
00233         static  stringvalue_dialogtype* p_stringvalue;
00234         static  translatefunctiontype* p_translate;
00235         static  file_dialogtype* p_filedialog;
00236         static  stringvalue_dialogtype* p_directorydialog;
00237         static  hk_string p_begintag_begin;
00238         static  hk_string p_begintag_end;
00239         static  hk_string p_endtag_begin;
00240         static  hk_string p_endtag_end;
00241         static  hk_string p_begintag;
00242         static  hk_string p_endtag;
00243         static  hk_string p_emptytag;
00244         static  hk_string p_emptytag_begin;
00245         static  hk_string p_emptytag_end;
00246         static unsigned int p_taglevel;
00247 
00248         static  bool    p_showpedantic;
00249         static  bool    p_generaldebug;
00250         static  hk_string p_locale;
00251         static  hk_string p_defaultdriver;
00252         static  enum_measuresystem p_defaultmeasuresystem;
00253 
00254 };
00255 
00256   void show_warningmessage(const hk_string& m);
00257   bool show_yesnodialog(const hk_string& m, bool default_value);
00258   hk_string show_filedialog(const hk_string& f="",enum_operationmode m=file_open);
00259   hk_string show_directorydialog(const hk_string& t);
00260   hk_string show_stringvaluedialog(const hk_string& t);
00261 
00262 
00263 
00264 #endif

Generated on Tue Sep 13 00:58:19 2005 for Databaseconnectionclasses by  doxygen 1.4.4