Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

qwavselection.h

00001 /***************************************************************************
00002                           selection.h  -  description
00003                              -------------------
00004     begin                : Sun Dec 1 2002
00005     copyright            : (C) 2002 by Peter Eschler
00006     email                : eschler@users.sourceforge.net
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef QwavSELECTION_H
00019 #define QwavSELECTION_H
00020 
00021 //---------------------------------------------------------------------------
00022 // Includes: qt
00023 //---------------------------------------------------------------------------
00024 
00025 #include <qobject.h>
00026 
00027 
00028 //---------------------------------------------------------------------------
00029 // Includes: project
00030 //---------------------------------------------------------------------------
00031 
00032 #include "qwavdefines.h"
00033 
00034 
00035 //---------------------------------------------------------------------------
00036 // Class: QwavSelection
00037 //---------------------------------------------------------------------------
00038 
00039 Qwav_USING_NAMESPACE
00040 
00045 Qwav_BEGIN_NAMESPACE
00046 
00047 class QWAV_EXPORTIMPORT QwavSelection : public QObject
00048 {
00049     Q_OBJECT
00050     Q_PROPERTY(long firstSample READ firstSample WRITE setFirstSample )
00051     Q_PROPERTY(long lastSample  READ lastSample  WRITE setLastSample )
00052     
00053 public: 
00054     QwavSelection(long first=0, long last=0);
00055     QwavSelection( const QwavSelection& s);
00056     ~QwavSelection();
00057 
00058     inline void setFirstSample( const long& s);
00059     inline void setLastSample( const long& s);
00060 
00061     inline const long& firstSample() const;
00062     inline const long& lastSample() const;
00063 
00064     inline bool        isValid() const;
00065     inline void        swap();
00066     
00067     QwavSelection& operator= (const QwavSelection& s);
00068     bool       operator< (const QwavSelection& s);
00069     bool       operator!=(const QwavSelection& s);
00070 
00071     static QwavSelection NullSelection;    
00072 private:
00073     long    _firstSample;
00074     long    _lastSample;        
00075 
00076 
00077 };
00078 
00079 
00080 //---------------------------------------------------------------------------
00081 // Method: setFirstSample
00082 //---------------------------------------------------------------------------
00083             
00084 void QwavSelection::setFirstSample( const long& s)
00085 {
00086     _firstSample = s;
00087 
00088     if( _firstSample < 0 )
00089         _firstSample = 0;
00090 }
00091 
00092 
00093 //---------------------------------------------------------------------------
00094 // Method: setLastSample
00095 //---------------------------------------------------------------------------
00096     
00097 void QwavSelection::setLastSample( const long& s)
00098 {
00099     _lastSample = s;
00100     if( _lastSample < 0 )
00101         _lastSample = 0;
00102     
00103 }
00104 
00105 
00106 //---------------------------------------------------------------------------
00107 // Method: firstSample
00108 //---------------------------------------------------------------------------
00109 
00110 const long& QwavSelection::firstSample() const
00111 {
00112     return _firstSample;
00113 }
00114 
00115 
00116 //---------------------------------------------------------------------------
00117 // Method: lastSample
00118 //---------------------------------------------------------------------------
00119 
00120 const long& QwavSelection::lastSample() const
00121 {
00122     return _lastSample;
00123 }
00124 
00125 
00126 //---------------------------------------------------------------------------
00127 // Method: isValid
00128 //---------------------------------------------------------------------------
00129 
00130 bool QwavSelection::isValid() const
00131 {
00132     if( _firstSample >=0 && _firstSample < _lastSample )
00133         return true;
00134     else
00135         return false;
00136 }
00137 
00138 
00139 //---------------------------------------------------------------------------
00140 // Method: swap
00141 //---------------------------------------------------------------------------
00142 
00143 void QwavSelection::swap()
00144 {
00145     long t = _firstSample;
00146     _firstSample = _lastSample;
00147     _lastSample = t;
00148 }
00149     
00150 Qwav_END_NAMESPACE
00151 
00152 #endif // QwavSELECTION_H

Generated on Mon Jan 20 00:24:54 2003 for Qwav by doxygen1.2.16