00001
00002
00003
00004
00005
00006
00007
00008
00009
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
00037 typedef bool progress_dialogtype(long int,long int,const hk_string&);
00046 class hk_class
00047 {
00048 public:
00054 enum enum_interaction {noninteractive,interactive};
00055 #ifdef HK_DEBUG
00056
00060 void hkclassname(const hk_string& n);
00061 hk_string hkclassname(void)const ;
00066 void hkdebug(const hk_string& d)const ;
00067 void hkdebug(const hk_string& d, const hk_string& e)const ;
00068 void hkdebug(const hk_string& d, int i)const ;
00069 void hkdebug(const hk_string& d, double i)const ;
00073 void wanna_debug(bool d);
00074 bool wanna_debug(void)const ;
00079 static void set_generaldebug(bool d);
00080 bool generaldebug(void){return p_generaldebug;}
00081 #endif
00082
00086 static hk_string hk_translate(const hk_string& t);
00091 static void show_warningmessage(const hk_string& m);
00096 static void set_warningmessage(messagewindowtype* m);
00104 static bool show_yesnodialog(const hk_string& m, bool default_value);
00109 static void set_yesnodialog(yesno_dialogtype* d);
00117 static hk_string show_stringvaluedialog(const hk_string& t);
00122 static void set_stringvaluedialog(stringvalue_dialogtype* t);
00123 static void set_translatefunction(translatefunctiontype* t);
00129 static void set_showpedantic(bool s);
00130 static bool showpedantic(void){return p_showpedantic;}
00131 enum enum_measuresystem{cm,inch};
00132 static void set_measuresystem(enum_measuresystem);
00133 static enum_measuresystem measuresystem(void);
00137 virtual void savedata(ostream& s);
00141 virtual void loaddata(const hk_string& definition);
00142 enum enum_tagtype{normaltag,mastertag};
00152 static bool get_tagvalue(const hk_string &where, const hk_string &tag, hk_string &value, int position=1,enum_tagtype tagtype=normaltag);
00153 static bool get_tagvalue(const hk_string &where, const hk_string &tag, unsigned long &value, int position=1);
00154 static bool get_tagvalue(const hk_string &where, const hk_string &tag, unsigned int &value, int position=1);
00155 static bool get_tagvalue(const hk_string &where, const hk_string &tag, long &value, int position=1);
00156 static bool get_tagvalue(const hk_string &where, const hk_string &tag, int &value, int position=1);
00157 static bool get_tagvalue(const hk_string &where, const hk_string &tag, bool &value, int position=1);
00164 static void set_tagvalue(ostream& stream,const hk_string& tag,const hk_string& value);
00165 static void set_tagvalue(ostream& stream,const hk_string& tag,unsigned long value);
00166 static void set_tagvalue(ostream& stream,const hk_string& tag,unsigned int value);
00167 static void set_tagvalue(ostream& stream,const hk_string& tag,long value);
00168 static void set_tagvalue(ostream& stream,const hk_string& tag,int value);
00169 static void set_tagvalue(ostream& stream,const hk_string& tag,bool value);
00175 static void start_mastertag(ostream& stream,const hk_string& tag);
00179 static void end_mastertag(ostream& stream,const hk_string& tag);
00180 static void set_defaultdatetimeformat(const hk_string& timeformat,const hk_string& dateformat,const hk_string&datetimeformat);
00181 static hk_string defaultdateformat(void);
00182 static hk_string defaulttimeformat(void);
00183 static hk_string defaultdatetimeformat(void);
00184
00189 static void save_preferences(void);
00193 static bool runtime_only(void);
00198 static void set_locale(const hk_string& locale);
00199 static hk_string locale(void);
00200
00201 static void set_defaultdriver(const hk_string& d);
00202 static hk_string defaultdriver(void) ;
00203
00204 protected:
00205
00206 hk_class(void);
00207 virtual ~hk_class(void);
00208 hk_interpreter* new_interpreter(const hk_string& interpreter,hk_presentation*);
00209 static hk_string p_defaulttimeformat;
00210 static hk_string p_defaultdateformat;
00211 static hk_string p_defaultdatetimeformat;
00212 static bool p_runtime_only;
00213
00214 private:
00215 static void set_tag(const hk_string& tag);
00216 static void set_levelspace(ostream& stream);
00217 hk_string p_classname;
00218 #ifdef HK_DEBUG
00219 bool p_debug;
00220 #endif
00221 static yesno_dialogtype* p_yesno;
00222 static messagewindowtype* p_warning;
00223 static stringvalue_dialogtype* p_stringvalue;
00224 static translatefunctiontype* p_translate;
00225 static hk_string p_begintag_begin;
00226 static hk_string p_begintag_end;
00227 static hk_string p_endtag_begin;
00228 static hk_string p_endtag_end;
00229 static hk_string p_begintag;
00230 static hk_string p_endtag;
00231 static hk_string p_emptytag;
00232 static hk_string p_emptytag_begin;
00233 static hk_string p_emptytag_end;
00234 static unsigned int p_taglevel;
00235
00236 static bool p_showpedantic;
00237 static bool p_generaldebug;
00238 static hk_string p_locale;
00239 static hk_string p_defaultdriver;
00240 static enum_measuresystem p_defaultmeasuresystem;
00241
00242 };
00243 #endif