Ananas Library  0.9.5
aobject.h
1 /****************************************************************************
2 ** $Id: aobject.h,v 1.69 2008/01/21 06:28:09 app Exp $
3 **
4 ** Header file of the Ananas Object of Ananas
5 ** Designer and Engine applications
6 **
7 ** Created : 20031201
8 **
9 ** Copyright (C) 2003-2004 Leader InfoTech. All rights reserved.
10 **
11 ** This file is part of the Library of the Ananas
12 ** automation accounting system.
13 **
14 ** This file may be distributed and/or modified under the terms of the
15 ** GNU General Public License version 2 as published by the Free Software
16 ** Foundation and appearing in the file LICENSE.GPL included in the
17 ** packaging of this file.
18 **
19 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
20 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21 **
22 ** See http://www.leaderit.ru/page=ananas or email sales@leaderit.ru
23 ** See http://www.leaderit.ru/gpl/ for GPL licensing information.
24 **
25 ** Contact org@leaderit.ru if any conditions of this licensing are
26 ** not clear to you.
27 **
28 **********************************************************************/
29 
30 #ifndef AOBJECT_H
31 #define AOBJECT_H
32 
33 #include <qdatetime.h>
34 #include "acfg.h"
35 #include "asqltable.h"
36 
37 
38 class aDatabase;
39 
40 
41 
63 class ANANAS_EXPORT aObject : public QObject
64 {
65  Q_OBJECT
66 public:
67  aCfg * md;
68  aCfgItem obj;
69  aDatabase * db;
70 
71  aObject( QObject *parent = 0, const char *name = 0 );
72  aObject( const QString &oname, aDatabase *adb, QObject *parent = 0, const char *name = 0 );
73  aObject( aCfgItem context, aDatabase *adb, QObject *parent = 0, const char *name = 0 );
74  virtual ~aObject();
75 
76  virtual bool checkStructure();
77 
78  ERR_Code init();
79 // aCfgItem *getMDObject();
80 // void setMDObject( aCfgItem object );
81  ERR_Code decodeDocNum( QString nm, QString & pref, int & num);
82  virtual ERR_Code select( Q_ULLONG id );
83  Q_ULLONG getUid();
84  bool selected( const QString & tablename = "" );
85  //void selectTable(const QString & tablename = "");
86  ERR_Code select(const QString & query, const QString &tableName = "");
87  aDataTable *table( const QString &name = "" );
88 
89 // void updateAttributes( const QString & tname = "" );
90  virtual Q_ULLONG docId();
91 
92 
93  virtual bool Next(const QString &tableName = "" );
94  virtual bool Prev(const QString &tableName = "" );
95  virtual bool First(const QString &tableName = "" );
96  virtual bool Last(const QString &tableName = "" );
97 
98 public slots:
99  virtual QString Uid();
100  virtual bool IsSelected();
101  virtual bool IsMarkDeleted( const QString & tname = "" );
102  virtual bool IsMarked();
103 // virtual int TableSetMarkDeleted( bool Deleted, const QString & tablename = "" );//depricated
104  virtual int SetMarkDeleted( bool Deleted, const QString & tablename = "" );
105  virtual int SetMarked( bool Marked );
106 
107 // virtual aObject *GetAttrib( const QString & AttribName );
108 // virtual void SetAttrib( const QString & AttribName, const *aObject );
109 
110  virtual int New();
111  virtual int Copy();
112  virtual int Delete();
113  virtual int Update();
114  virtual int Conduct();
115  virtual int UnConduct();
116  virtual bool IsConducted();
117  virtual QString Kind( const QString & name = QString::null );
118 // virtual ERR_Code Select( QString num ){return err_incorrecttype;};
119 // virtual ERR_Code Select( QDateTime from, QDateTime to, QString mdName){return err_incorrecttype;};
120 // virtual ERR_Code Select( aObject* ){return err_incorrecttype;};
121 
122  virtual QVariant Value( const QString & name, const QString &tableName = "" );
123  virtual int SetValue( const QString & name, const QVariant &value, const QString &tableName = "" );
124 
125  virtual QVariant sysValue( const QString & name, const QString &tableName = "" );
126  virtual int setSysValue( const QString & name, QVariant value, const QString &tableName = "" );
127 
128 // virtual bool Next();
129 // virtual bool Prev();
130 // virtual bool First();
131 // virtual bool Last();
132 
133  virtual int SetFilter( const QString & valname, const QVariant & value );
134  virtual int ClearFilter();
135  virtual int TableSetFilter( const QString & tname, const QString & valname, const QVariant & value );
136  virtual int TableClearFilter( const QString & tname );
138  virtual bool IsFiltred() {return filtred;};
139  virtual int TableUpdate( const QString & tablename );
140  virtual QString displayString();
141 
142  virtual int LastErrorCode();
143  virtual QString LastErrorMessage();
144 
145 protected:
146  bool concrete;
147  virtual aCfgItem displayStringContext();
148 // Q_ULLONG lastUid;
149  virtual ERR_Code setObject( aCfgItem newobject );
150 // virtual ERR_Code initObject( aDatabase *adb );
151  virtual ERR_Code initObject();
152  bool isInited() { return vInited; };
153  void setInited( bool flag ){ vInited = flag; };
154  ERR_Code tableInsert( const QString &dbname, aCfgItem obj, const QString &name = "" );
155  ERR_Code tableInsert( const QString &dbname, const QString &name = "" );
156  ERR_Code tableRemove( const QString &name = "" );
157 
158  virtual QVariant tValue( const QString & tablename, const QString & name );
159  virtual ERR_Code setTValue(const QString & tablename, const QString & name, const QVariant &value);
160  virtual QString trSysName( const QString & sname );
161 // Q_ULLONG copy(const QString & tablename = "");
162  void setSelected( bool sel, const QString & tablename = "" );
163  virtual ERR_Code setTFilter( const QString & tname, const QString & valname, const QVariant & value );
164  virtual ERR_Code clearTFilter( const QString & tname );
165 
166  void setLastError( int, QString );
167 
168 private:
169  bool vInited, selectFlag, filtred;
170  QDict <aDataTable> dbtables;
171  int lastErrorCode;
172  QString lastErrorMessage;
173 
174 // QDict <aDataRecord> attributes;
175 };
176 
177 
178 #endif
virtual bool IsFiltred()
Показывает наличие активного фильтра
Definition: aobject.h:138
Класс реализует програмный интерфейс доступа к элемен...
Definition: acfg.h:436
Определяет программный интерфейс модели данных aDataTable...
Definition: asqltable.h:54
Класс для работы с СУБД. Ananas Data Abstraction Layer. Наследует QObject...
Definition: adatabase.h:77
Базовый класс для невизуальных классов (моделей в терм...
Definition: aobject.h:63