teglobal.h

00001 /****************************************************************************
00002 ** $Id: teglobal.h,v 1.11 2006/07/02 12:06:09 leader Exp $
00003 **
00004 ** Trade equipment common portable library project
00005 **
00006 ** Copyright (C) 1999-2006 Leader InfoTech.  All rights reserved.
00007 **
00008 ** This file is part of the Library of the Ananas
00009 ** automation accounting system.
00010 **
00011 ** This file may be distributed and/or modified under the terms of the
00012 ** GNU General Public License version 2 as published by the Free Software
00013 ** Foundation and appearing in the file LICENSE.GPL included in the
00014 ** packaging of this file.
00015 **
00016 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00017 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00018 **
00019 ** See http://www.leaderit.ru/ or email sales@leaderit.ru
00020 **
00021 ** Contact org@leaderit.ru if any conditions of this licensing are
00022 ** not clear to you.
00023 **
00024 **********************************************************************/
00025 
00026 #ifndef TEGLOBAL_H
00027 #define TEGLOBAL_H
00028 #include <qglobal.h>
00029 #include <qgplugin.h>
00030 #include <qstringlist.h>
00031 
00032 #define DEBUG
00033 //#define DEMOVERSION
00034 
00035 #ifdef Q_OS_WIN32
00036 #       include <windows.h>
00037 #       include <math.h>
00038 #       define _TTY_WIN_
00039 #       define round(x) floor(x+0.55555555)
00040 #endif
00041 #ifdef Q_OS_UNIX
00042 #       include <unistd.h>
00043 #       define Sleep(a) usleep((a)*1000)
00044 #       ifndef _TTY_POSIX_
00045 #               define _TTY_POSIX_
00046 #       endif
00047 #endif
00048 
00049 #if defined(Q_OS_WIN32) && !defined(LIB_NO_DLL)
00050 #  define LIB_DLLIMPORT __declspec(dllimport)
00051 #  define LIB_DLLEXPORT __declspec(dllexport)
00052 #else
00053 #  define LIB_DLLIMPORT
00054 #  define LIB_DLLEXPORT
00055 #endif
00056 
00057 #if defined (Q_CC_MSVC)
00058 #define TEMPLATE_EXTERN extern
00059 #else
00060 #define TEMPLATE_EXTERN
00061 #endif
00062 
00063 #ifdef TRADEEQUIP_EXPORT
00064 #  define LIB_EXPORT LIB_DLLEXPORT
00065 #else
00066 #  define LIB_EXPORT LIB_DLLIMPORT
00067 #endif
00068 
00069 #ifdef TRADEEQUIP_EXPORT
00070 #  define LIB_TEMPLATE_EXTERN
00071 #else
00072 #  define LIB_TEMPLATE_EXTERN TEMPLATE_EXTERN
00073 #endif
00074 
00075 #if defined(Q_CC_MSVC)
00076 #  define vsnprintf _vsnprintf
00077 #endif
00078 
00079 #undef min
00080 #undef max
00081 /*
00082 template <class T>
00083 T & min(T & a, T & b)
00084 {
00085     if (a<b) return a; else return b;
00086 }
00087 
00088 template <class T>
00089 const T & min(const T & a, const T & b)
00090 {
00091     if (a<b) return a; else return b;
00092 }
00093 */
00094 template <class U, class V>
00095 U min(const U & a, const V & b)
00096 {
00097     if (a<=(const U&)b) return a; else return (const U&)b;
00098 }
00099 
00100 template <class U, class V>
00101 U max(const U & a, const V & b)
00102 {
00103     if (a>=(const U&)b) return a; else return (const U&)b;
00104 }
00105 //#define min(a,b) (((a)<(b))?(a):(b))
00106 //#endif
00107 
00119 class TE
00120 {
00121 public:
00125     enum EquipmentConnectionType {
00126         ECT_NOCONNECTION        =0x0,
00127         ECT_SERIAL              =0x1,   
00128         ECT_KEYBOARD            =0x2    
00129     };
00133     enum CashRegisterOperations {
00134         CRO_SELL                = 0x0,  
00135         CRO_BUY                 = 0x1,  
00136         CRO_SELLRET             = 0x2,  
00137         CRO_BUYRET              = 0x3,  
00138         CRO_SELLSTORNO          = 0x4,  
00139         CRO_BUYSTORNO           = 0x5,  
00140         CRO_CASHIN              = 0x6,  
00141         CRO_CASHOUT             = 0x7,  
00142         CRO_DISCOUNT            = 0x8,  
00143         CRO_DISCOUNTPERCENT     = 0x9,  
00144         CRO_OPMASK              = 0xF   
00145         //CRO_SIMPLEMODE=0x8,
00146         //CRO_MODEMASK=0x8,
00147         //CRO_CASHLESS=0x10,
00148         //CRO_PAYMENTMASK=0x10
00149     };
00150 
00151 
00152 };
00153 
00154 class TEBase;
00155 
00156 Q_EXTERN_C LIB_EXPORT QStringList te_drivers( const QString &baseClass = QString::null );
00157 Q_EXTERN_C LIB_EXPORT bool te_driverExists( const QString &className, const QString &baseClass = QString::null );
00158 Q_EXTERN_C LIB_EXPORT TEBase *te_createDriverObject( const QString &className );
00159 
00160 LIB_EXPORT QString te_MD5( const QByteArray &data );
00161 LIB_EXPORT QString te_MD5( const QString &data );
00162 LIB_EXPORT int te_MD5_selftest();
00163 
00164 // Encoding for msgfmt should be UTF-8
00165 extern void cr_message(QString logFile, int msgtype, const char *msgfmt,...);
00166 // Encoding for msgfmt should be UTF-8
00167 extern void cfg_message(int msgtype, const char *msgfmt,...);
00168 
00169 #endif

Generated on Sun Jul 2 23:37:24 2006 for Trade equipment common library. by  doxygen 1.4.7