hk_definitions.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_DEFINITIONS
00012 #define HK_DEFINITIONS
00013 #include "hk_string.h"
00014 #include <list>
00015 #include <stdlib.h>
00016 #include <stdio.h>
00082 using namespace std;
00083 
00084 #define  HK_DEBUG
00085 #define HK_VERSION "082"
00086 /*
00087 ** The HK_VERSION_NUMBER is an integer with the value
00088 ** (X*100000 + Y*1000 + Z). For example, for version "3.1.2",
00089 ** HK_VERSION_NUMBER is set to 3001002. To detect if they are using
00090 ** version 0.7.2 or greater at compile time, programs may use the test
00091 ** (HK_VERSION_NUMBER>=0007002).
00092 */
00093 #ifdef HK_VERSION_NUMBER
00094 # undef HK_VERSION_NUMBER
00095 #endif
00096 #define HK_VERSION_NUMBER 0008002
00097 
00098 
00099 #ifdef HAVE_NO_SSTREAM
00100 #include <strstream.h>
00101 #define STRINGSTREAM  strstream
00102 #else
00103 #include <sstream>
00104 #define STRINGSTREAM stringstream
00105 #endif
00106 
00107 
00108 
00112 enum filetype{ft_table=1,ft_query=2,ft_form=3,ft_report=4,           ft_view=6,ft_module=7,ft_referentialintegrity=8};
00113 enum listtype{lt_table=1,lt_query=2,lt_form=3,lt_report=4,lt_index=5,lt_view=6,lt_module=7};
00114 
00115 enum datasourcetype {dt_table=1,dt_query=2,dt_view=3};
00116 enum objecttype{ot_database=0,ot_table=1,ot_query=2,ot_form=3,ot_report=4,ot_view=6,ot_module=7};
00117 
00122 typedef class struct_raw_data
00123 {
00124     public:
00125         struct_raw_data(){length=0;data=NULL;}
00126         unsigned long   length;
00127         char* data;
00128 
00129 } ;
00130 
00131 typedef class struct_connectionfields
00132 {
00133     public:
00134         struct_connectionfields(){cancel=false;save=false;allowdatabaseselect=true;};
00135         hk_string host;
00136         hk_string user;
00137         hk_string password;
00138         hk_string sql_delimiter;
00139         hk_string port;
00140         hk_string database;
00141         bool allowdatabaseselect;
00142         bool cancel;
00143         bool save;
00144         bool emulateboolean;
00145 } ;
00146 
00147 
00148 class struct_commands;
00149 
00150 typedef class struct_commandlinefields
00151 {
00152     public:
00153         struct_commandlinefields()
00154             {
00155                runtime_only=false;
00156                p_guicommands=NULL;
00157             };
00158         hk_string driver;
00159         hk_string database;
00160         hk_string form;
00161 
00162         hk_string host;
00163         hk_string user;
00164         hk_string password;
00165         hk_string port;
00166         bool runtime_only;
00167         struct_commands* p_guicommands;
00168 } ;
00169 
00170 
00171 int hk_random(int min,int max);
00172 
00173 class hk_column;
00177 bool is_numerictype(hk_column*);
00181 bool is_integertype(hk_column*);
00185 bool is_realtype(hk_column*);
00186 double inch2cm(double);
00187 double cm2inch(double);
00188 //the following functions and datatypes are all needed for hk_report
00189 class hk_report;
00190 class hk_reportdata;
00191 class hk_reportsection;
00192 
00193 typedef hk_string   recodefunctiontype(const hk_string&,hk_report*);
00194 typedef hk_string   data_replacefunctiontype(hk_reportdata*,const hk_string&);
00195 typedef bool report_configurefunction(hk_report*,int);
00196 typedef bool reporttypefunction(hk_report*,bool);
00197 typedef unsigned long reportsectioncounttype(hk_reportsection*);
00198 typedef void reportsectionautomaticcreatedatatype(hk_reportsection*);
00199 typedef unsigned long reportdatacounttype(hk_reportdata*);
00200 typedef void    data_configurefunctiontype(hk_reportdata*);
00201 
00202 typedef void voidfunction(void);
00203 
00204 typedef struct_raw_data* psimagedatatype(struct_raw_data* imgdata,const hk_string& file,hk_string& errormsg);
00205 union number
00206 {
00207     long integer;
00208     double real;
00209 };
00210 
00211 union longnumber
00212 {
00213     long int integer;
00214     long double real;
00215 };
00216 
00217 
00218 typedef class
00219 {
00220  public:
00221  hk_string dependingfield;
00222  hk_string masterfield;
00223 } dependingclass;
00224 
00225 
00226 typedef class referentialclass
00227 {
00228 public:
00229 referentialclass();
00230 bool operator=(const referentialclass&);
00231 
00232 
00233 hk_string p_name;
00234 hk_string p_masterdatasource;
00235 list<dependingclass> p_fields;
00236 bool p_deletecascade;
00237 bool p_updatecascade;
00238 } ;
00239 
00240 
00241 bool load_file(const hk_string& filename, struct_raw_data* result);
00242 bool save_file(const hk_string& filename, const struct_raw_data* data);
00243 bool save_textfile(const hk_string& filename, const hk_string& data);
00244 bool file_exists(const hk_string& filename);
00245 bool data2hex(struct_raw_data* data, hk_string& result);
00246 bool hex2data( const hk_string& data,unsigned long maxbytes, struct_raw_data* result);
00247 const hk_string charsets[]=
00248 {
00249 "UTF8","UTF16","ISO88591","ISO88592","ISO88593","ISO88594","ISO88595","ISO88596","ISO88597","ISO88598",
00250 "ISO88599","ISO885910","ISO885911","ISO885913","ISO885914","ISO885915","KOI8","KOI8R","KOI8U","LATIN1",
00251 "LATIN2","LATIN3","LATIN4","LATIN5","LATIN6","LATIN7","LATIN8","LATIN10","WINDOWS-31J","WINDOWS-874",
00252 "WINDOWS-936","WINDOWS-1250","WINDOWS-1251","WINDOWS-1252","WINDOWS-1253","WINDOWS-1254","WINDOWS-1255",
00253 "WINDOWS-1256","WINDOWS-1257","WINDOWS-1258",
00254 "CP037","CP038","CP273","CP274","CP275","CP278","CP280","CP281","CP282","CP284","CP285","CP290","CP297","CP367",
00255 "CP420","CP423","CP424","CP437","CP500","CP737",
00256 "CP775","CP813","CP819","CP850","CP851","CP852","CP855","CP856","CP857","CP860","CP861","CP862","CP863","CP864","CP865",
00257 "CP866","CP866NAV","CP868","CP869","CP870","CP871","CP874","CP875","CP880","CP891","CP903","CP904","CP905","CP912"
00258 ,"CP915","CP916","CP918","CP920","CP922","CP930","CP932","CP933","CP935","CP936","CP937","CP939","CP949","CP950",
00259 "CP1004","CP1026","CP1046","CP1047","CP1070","CP1079","CP1081","CP1084","CP1089","CP1124","CP1125","CP1129","CP1132",
00260 "CP1133","CP1160","CP1161","CP1162","CP1163","CP1164","CP1250","CP1251","CP1252","CP1253","CP1254","CP1255","CP1256",
00261 "CP1257","CP1258","CP1361","CP10007"
00262 
00263 };
00264 
00265 
00266 const hk_string locales[]=
00267 {
00268 "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",
00269 "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",
00270 "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",
00271 "en_US","en_ZA","en_ZW","es_AR","es_BO","es_CL","es_CO","es_CR","es_DO","es_EC","es_ES","es_GT",
00272 "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",
00273 "fa_IR","fi_FI","fo_FO","fr_BE","fr_CA","fr_CH","fr_FR","fr_LU",
00274 "ga_IE","gd_GB","gez_ER","gez_ET","gl_ES","gu_IN","gv_GB",
00275 "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",
00276 "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",
00277 "nl_BE","nl_NL","nn_NO","no_NO","oc_FR","om_ET","om_KE","pa_IN","pl_PL","POSIX","pt_BR","pt_PT",
00278 "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",
00279 "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",
00280 "ur_PK","uz_UZ","vi_VN","wa_BE","xh_ZA","yi_US","zh_CN","zh_HK","zh_SG","zh_TW","zu_ZA"
00281 
00282 };
00283 
00284 
00285 #endif //HK_DEFINITIONS
00286 
00287 
00288 

Generated on Tue Nov 28 02:48:08 2006 for Databaseconnectionclasses by  doxygen 1.5.0