home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / qt3_emx.zip / include / qsqlindex.h < prev    next >
C/C++ Source or Header  |  2001-07-26  |  3KB  |  98 lines

  1. /****************************************************************************
  2. **
  3. ** Definition of QSqlIndex class
  4. **
  5. ** Created : 2000-11-03
  6. **
  7. ** Copyright (C) 2000 Trolltech AS.  All rights reserved.
  8. **
  9. ** This file is part of the sql module of the Qt GUI Toolkit.
  10. **
  11. ** This file may be distributed under the terms of the Q Public License
  12. ** as defined by Trolltech AS of Norway and appearing in the file
  13. ** LICENSE.QPL included in the packaging of this file.
  14. **
  15. ** This file may be distributed and/or modified under the terms of the
  16. ** GNU General Public License version 2 as published by the Free Software
  17. ** Foundation and appearing in the file LICENSE.GPL included in the
  18. ** packaging of this file.
  19. **
  20. ** Licensees holding valid Qt Enterprise Edition licenses may use this
  21. ** file in accordance with the Qt Commercial License Agreement provided
  22. ** with the Software.
  23. **
  24. ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  25. ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  26. **
  27. ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
  28. **   information about Qt Commercial License Agreements.
  29. ** See http://www.trolltech.com/qpl/ for QPL licensing information.
  30. ** See http://www.trolltech.com/gpl/ for GPL licensing information.
  31. **
  32. ** Contact info@trolltech.com if any conditions of this licensing are
  33. ** not clear to you.
  34. **
  35. **********************************************************************/
  36.  
  37. #ifndef QSQLINDEX_H
  38. #define QSQLINDEX_H
  39.  
  40. #ifndef QT_H
  41. #include "qstring.h"
  42. #include "qstringlist.h"
  43. #include "qsqlfield.h"
  44. #include "qsqlrecord.h"
  45. #endif // QT_H
  46.  
  47. #if !defined( QT_MODULE_SQL ) || defined( QT_LICENSE_PROFESSIONAL )
  48. #define QM_EXPORT_SQL
  49. #else
  50. #define QM_EXPORT_SQL Q_EXPORT
  51. #endif
  52.  
  53. #ifndef QT_NO_SQL
  54.  
  55. #if defined(Q_TEMPLATEDLL)
  56. // MOC_SKIP_BEGIN
  57. template class Q_EXPORT QValueList<bool>;
  58. // MOC_SKIP_END
  59. #endif
  60.  
  61. class QSqlCursor;
  62.  
  63. class QM_EXPORT_SQL QSqlIndex : public QSqlRecord
  64. {
  65. public:
  66.     QSqlIndex( const QString& cursorName = QString::null, const QString& name = QString::null );
  67.     QSqlIndex( const QSqlIndex& other );
  68.     ~QSqlIndex();
  69.     QSqlIndex&       operator=( const QSqlIndex& other );
  70.     virtual void     setCursorName( const QString& cursorName );
  71.     QString          cursorName() const { return cursor; }
  72.     virtual void     setName( const QString& name );
  73.     QString          name() const { return nm; }
  74.  
  75.     void             append( const QSqlField& field );
  76.     virtual void     append( const QSqlField& field, bool desc );
  77.  
  78.     bool             isDescending( int i ) const;
  79.     virtual void     setDescending( int i, bool desc );
  80.  
  81.     QString          toString( const QString& prefix = QString::null,
  82.                    const QString& sep = ",",
  83.                    bool verbose = TRUE ) const;
  84.     QStringList      toStringList( const QString& prefix = QString::null,
  85.                    bool verbose = TRUE ) const;
  86.  
  87.     static QSqlIndex fromStringList( const QStringList& l, const QSqlCursor* cursor );
  88.  
  89. private:
  90.     QString          createField( int i, const QString& prefix, bool verbose ) const;
  91.     QString          cursor;
  92.     QString          nm;
  93.     QValueList<bool> sorts;
  94. };
  95.  
  96. #endif    // QT_NO_SQL
  97. #endif
  98.