CenGen - Генератор ценников  1.1
tinformer.h
00001 #ifndef TINFORMER_H
00002 #define TINFORMER_H
00003 
00004 //#include <QObject>
00005 #include <QString>
00006 //#include <QMYSQLDriver>
00007 #include <QSqlDatabase>
00008 #include <QSqlQuery>
00009 #include <QStringList>
00010 #include <QVariant>
00011 #include "tovar.h"
00012 #include "sql_config.h"
00013 #include "dbf_config.h"
00014 #include "db_translator.h"
00015 #include "dbf_informer.h"
00016 
00017 
00018 class Tinformer {
00019 public:
00020     enum DataSource { MySQL, DBF };
00021     enum SearchMethod { tbarcode, tnomer, tname };
00022     //Tinformer (int mode);
00023     Tinformer ();
00024     ~Tinformer ();
00025 
00026     bool prepare(SqlConfig *sql);
00027     bool prepare(DbfConfig *dbf);
00028     bool set_fields(dbTranslator *rows);
00029     bool set_tb_name(QString tbName);
00030     int get_maximum();
00031 
00032     QList<Tovar> info (QString text, QString method = "tbarcode",
00033                        int startPos = 0, int endPos = -1, int limit = 0,
00034                        bool FromStartToEnd = true, bool AllowFastSearch = true);
00035     QList<Tovar> check_line_prices (QList<Tovar> inputList);
00036 
00037     int last_found_record_number();
00038     QStringList db_describe();
00039     QStringList tb_describe(QString tbName);
00040     void set_limit_search(int number);
00041 
00042 private:
00043     QSqlDatabase db;
00044     DataSource datasource;
00045     bool db_is_ready;
00046     bool tb_is_ready;
00047     SqlConfig *sqlDB;
00048     DbfConfig *dbfDB;
00049     QString values_to_select;   //  список полей для селекта из mysql
00050     dbTranslator* fields;       //для понимания полей SQLтаблицы
00051     dbf_informer* dbf_info;     //класс для работы с DBF-файлами
00052     int limit_search;           //ограничение поиска
00053     int last_record;
00054 
00055 //public slots:
00056 
00057 
00058 /*
00059 
00060 public slots:
00061 
00062     bool is_valid();
00063     Tovar info(QString barcode, int method);
00064 */
00065 
00066 };
00067 
00068 
00069 #endif // TINFORMER_H
 Указатель Классы Функции