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

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>
00017 
00018 using namespace std;
00019 
00020 #define  HK_DEBUG
00021 #define HK_VERSION "074"
00022 /*
00023 ** The HK_VERSION_NUMBER is an integer with the value
00024 ** (X*100000 + Y*1000 + Z). For example, for version "3.1.2",
00025 ** HK_VERSION_NUMBER is set to 3001002. To detect if they are using
00026 ** version 0.7.2 or greater at compile time, programs may use the test
00027 ** (HK_VERSION_NUMBER>=0007002).
00028 */
00029 #ifdef HK_VERSION_NUMBER
00030 # undef HK_VERSION_NUMBER
00031 #endif
00032 #define HK_VERSION_NUMBER 0007004
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};
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 //the following functions and datatypes are all needed for hk_report
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 
00181 
00182 #endif //HK_DEFINITIONS
00183 
00184 
00185 

Generated on Tue Sep 13 02:13:09 2005 for Databaseconnectionclasses by  doxygen 1.4.4