00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef HK_DEFINITIONS
00012 #define HK_DEFINITIONS
00013 #include "hk_string.h"
00014 #include <list>
00015 #include <stdlib.h>
00016 #include <stdio.h>
00017
00018 using namespace std;
00019
00020 #define HK_DEBUG
00021 #define HK_VERSION "080"
00022
00023
00024
00025
00026
00027
00028
00029 #ifdef HK_VERSION_NUMBER
00030 # undef HK_VERSION_NUMBER
00031 #endif
00032 #define HK_VERSION_NUMBER 0008000
00033
00034
00035 #ifdef HAVE_NO_SSTREAM
00036 #include <strstream.h>
00037 #define STRINGSTREAM strstream
00038 #else
00039 #include <sstream>
00040 #define STRINGSTREAM stringstream
00041 #endif
00042
00046 enum filetype{ft_table=1,ft_query=2,ft_form=3,ft_report=4,ft_view=6,ft_referentialintegrity=7};
00047 enum listtype{lt_table=1,lt_query=2,lt_form=3,lt_report=4,lt_index=5,lt_view=6};
00048
00049 enum datasourcetype {dt_table=1,dt_query=2,dt_view=3};
00050 enum objecttype{ot_database=0,ot_table=1,ot_query=2,ot_form=3,ot_report=4,ot_view=6};
00051
00056 typedef class struct_raw_data
00057 {
00058 public:
00059 struct_raw_data(){length=0;data=NULL;}
00060 unsigned long length;
00061 char* data;
00062
00063 } ;
00064
00065 typedef class struct_connectionfields
00066 {
00067 public:
00068 struct_connectionfields(){cancel=false;save=false;allowdatabaseselect=true;};
00069 hk_string host;
00070 hk_string user;
00071 hk_string password;
00072 hk_string sql_delimiter;
00073 hk_string port;
00074 hk_string database;
00075 bool allowdatabaseselect;
00076 bool cancel;
00077 bool save;
00078 bool emulateboolean;
00079 } ;
00080
00081
00082 class struct_commands;
00083
00084 typedef class struct_commandlinefields
00085 {
00086 public:
00087 struct_commandlinefields()
00088 {
00089 runtime_only=false;
00090 p_guicommands=NULL;
00091 };
00092 hk_string driver;
00093 hk_string database;
00094 hk_string form;
00095
00096 hk_string host;
00097 hk_string user;
00098 hk_string password;
00099 hk_string port;
00100 bool runtime_only;
00101 struct_commands* p_guicommands;
00102 } ;
00103
00104
00105 int hk_random(int min,int max);
00106
00107 class hk_column;
00111 bool is_numerictype(hk_column*);
00115 bool is_integertype(hk_column*);
00119 bool is_realtype(hk_column*);
00120 double inch2cm(double);
00121 double cm2inch(double);
00122
00123 class hk_report;
00124 class hk_reportdata;
00125 class hk_reportsection;
00126
00127 typedef hk_string recodefunctiontype(const hk_string&,hk_report*);
00128 typedef hk_string data_replacefunctiontype(hk_reportdata*,const hk_string&);
00129 typedef bool report_configurefunction(hk_report*,int);
00130 typedef bool reporttypefunction(hk_report*,bool);
00131 typedef unsigned long reportsectioncounttype(hk_reportsection*);
00132 typedef void reportsectionautomaticcreatedatatype(hk_reportsection*);
00133 typedef unsigned long reportdatacounttype(hk_reportdata*);
00134 typedef void data_configurefunctiontype(hk_reportdata*);
00135
00136 typedef void voidfunction(void);
00137
00138 union number
00139 {
00140 long integer;
00141 double real;
00142 };
00143
00144 union longnumber
00145 {
00146 long int integer;
00147 long double real;
00148 };
00149
00150
00151 typedef class
00152 {
00153 public:
00154 hk_string dependingfield;
00155 hk_string masterfield;
00156 } dependingclass;
00157
00158
00159 typedef class referentialclass
00160 {
00161 public:
00162 referentialclass();
00163 bool operator=(const referentialclass&);
00164
00165
00166 hk_string p_name;
00167 hk_string p_masterdatasource;
00168 list<dependingclass> p_fields;
00169 bool p_deletecascade;
00170 bool p_updatecascade;
00171 } ;
00172
00173
00174 bool load_file(const hk_string& filename, struct_raw_data* result);
00175 bool save_file(const hk_string& filename, const struct_raw_data* data);
00176 bool save_textfile(const hk_string& filename, const hk_string& data);
00177 bool file_exists(const hk_string& filename);
00178 bool data2hex(struct_raw_data* data, hk_string& result);
00179 bool hex2data( const hk_string& data,unsigned long maxbytes, struct_raw_data* result);
00180 const hk_string charsets[]=
00181 {
00182 "UTF8","UTF16","ISO88591","ISO88592","ISO88593","ISO88594","ISO88595","ISO88596","ISO88597","ISO88598",
00183 "ISO88599","ISO885910","ISO885911","ISO885913","ISO885914","ISO885915","KOI8","KOI8R","KOI8U","LATIN1",
00184 "LATIN2","LATIN3","LATIN4","LATIN5","LATIN6","LATIN7","LATIN8","LATIN10","WINDOWS-31J","WINDOWS-874",
00185 "WINDOWS-936","WINDOWS-1250","WINDOWS-1251","WINDOWS-1252","WINDOWS-1253","WINDOWS-1254","WINDOWS-1255",
00186 "WINDOWS-1256","WINDOWS-1257","WINDOWS-1258",
00187 "CP037","CP038","CP273","CP274","CP275","CP278","CP280","CP281","CP282","CP284","CP285","CP290","CP297","CP367",
00188 "CP420","CP423","CP424","CP437","CP500","CP737",
00189 "CP775","CP813","CP819","CP850","CP851","CP852","CP855","CP856","CP857","CP860","CP861","CP862","CP863","CP864","CP865",
00190 "CP866","CP866NAV","CP868","CP869","CP870","CP871","CP874","CP875","CP880","CP891","CP903","CP904","CP905","CP912"
00191 ,"CP915","CP916","CP918","CP920","CP922","CP930","CP932","CP933","CP935","CP936","CP937","CP939","CP949","CP950",
00192 "CP1004","CP1026","CP1046","CP1047","CP1070","CP1079","CP1081","CP1084","CP1089","CP1124","CP1125","CP1129","CP1132",
00193 "CP1133","CP1160","CP1161","CP1162","CP1163","CP1164","CP1250","CP1251","CP1252","CP1253","CP1254","CP1255","CP1256",
00194 "CP1257","CP1258","CP1361","CP10007"
00195
00196 };
00197
00198
00199 const hk_string locales[]=
00200 {
00201 "C","aa_DJ","aa_ER","aa_ET","af_ZA","am_ET","an_ES","ar_AE","ar_BH","ar_DZ","ar_EG","ar_IN","ar_IQ","ar_JO","ar_KW",
00202 "ar_LB","ar_LY","ar_MA","ar_OM","ar_QA","ar_SA","ar_SD","ar_SY","ar_TN","ar_YE","be_BY","bg_BG","bn_BD","bn_IN",
00203 "br_FR","bs_BA","byn_ER","ca_ES","cs_CZ","cy_GB","da_DK","de_AT","de_BE","de_CH","de_DE","de_LU","el_GR","en_AU","en_BE","en_BW","en_CA","en_DK","en_GB","en_HK","en_IE","en_IN","en_NZ","en_PH","en_SG",
00204 "en_US","en_ZA","en_ZW","es_AR","es_BO","es_CL","es_CO","es_CR","es_DO","es_EC","es_ES","es_GT",
00205 "es_HN","es_MX","es_NI","es_PA","es_PE","es_PR","es_PY","es_SV","es_US","es_UY","es_VE","et_EE","eu_ES",
00206 "fa_IR","fi_FI","fo_FO","fr_BE","fr_CA","fr_CH","fr_FR","fr_LU",
00207 "ga_IE","gd_GB","gez_ER","gez_ET","gl_ES","gu_IN","gv_GB",
00208 "he_IL","hi_IN","hr_HR","hu_HU","id_ID","is_IS","it_CH","it_IT","iw_IL","ka_GE","kk_KZ","kl_GL","kn_IN",
00209 "kw_GB","lg_UG","lo_LA","lt_LT","lv_LV","mi_NZ","mk_MK","ml_IN","mn_MN","mr_IN","ms_MY","mt_MT","nb_NO","ne_NP",
00210 "nl_BE","nl_NL","nn_NO","no_NO","oc_FR","om_ET","om_KE","pa_IN","pl_PL","POSIX","pt_BR","pt_PT",
00211 "ro_RO","ru_RU","ru_UA","se_NO","sh_YU","sid_ET","sk_SK","sl_SI","so_DJ","so_ET","so_KE","so_SO","sq_AL",
00212 "st_ZA","sv_FI","sv_SE","ta_IN","te_IN","tg_TJ","th_TH","ti_ER","ti_ET","tig_ER","tl_PH","tr_TR","uk_UA",
00213 "ur_PK","uz_UZ","vi_VN","wa_BE","xh_ZA","yi_US","zh_CN","zh_HK","zh_SG","zh_TW","zu_ZA"
00214
00215 };
00216
00217
00218 #endif //HK_DEFINITIONS
00219
00220
00221