[Kpod-devel] cvs_commit libqtpod/src playlist.cpp, 1.55, 1.56 playlist.h, 1.46, 1.47
Status: Beta
Brought to you by:
fry26
From: Michael S. <fr...@us...> - 2007-10-26 17:57:43
|
Update of /cvsroot/kpod/libqtpod/src In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv29042/src Modified Files: playlist.cpp playlist.h Log Message: API cleanups Index: playlist.h =================================================================== RCS file: /cvsroot/kpod/libqtpod/src/playlist.h,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** playlist.h 25 Oct 2007 07:47:28 -0000 1.46 --- playlist.h 26 Oct 2007 17:57:45 -0000 1.47 *************** *** 90,164 **** typedef itunesdb::utils::SortablePtrVector<PlaylistItem> TrackList_T; - typedef TrackList_T::ConstIterator ConstIterator; - - /* - class ConstIterator { - protected: - const TrackList_T& m_list; - TrackList_T::ConstIterator m_next; - TrackList_T::ConstIterator m_current; - friend class itunesdb::Playlist; - void setPos( TrackList_T::Iterator pos ) { - m_next = pos; - m_current = pos; - } - ConstIterator(const TrackList_T& list) - : m_list(list), m_next( m_list.begin() ), m_current( m_next ) {} - public: - bool hasNext() { - return m_next != m_list.end(); - } - bool atEnd() { - return m_current != m_list.end(); - } - const PlaylistItem * current() { - return *m_current; - } - const PlaylistItem * next() { - if ( hasNext() ) { - m_current = m_next++; - return *m_current; - } else { - return NULL; - } - } - }; - */ - // FIXME do the typedef typedef TrackList_T::Iterator Iterator; ! /* ! class Iterator { ! protected: ! TrackList_T& m_list; ! TrackList_T::Iterator m_next; ! TrackList_T::Iterator m_current; ! friend class itunesdb::Playlist; ! void setPos( TrackList_T::Iterator pos ) { ! m_next = pos; ! m_current = pos; ! } ! Iterator(TrackList_T& list) ! : m_list(list), m_next( m_list.begin() ), m_current( m_next ) {} ! public: ! bool hasNext() { ! return m_next != m_list.end(); ! } ! bool atEnd() { ! return m_current == m_list.end(); ! } ! PlaylistItem * current() { ! return *m_current; ! } ! PlaylistItem * next() { ! if ( hasNext() ) { ! m_current = m_next++; ! return *m_current; ! } else { ! return NULL; ! } ! } ! }; ! */ Playlist(); virtual ~Playlist(); --- 90,96 ---- typedef itunesdb::utils::SortablePtrVector<PlaylistItem> TrackList_T; typedef TrackList_T::ConstIterator ConstIterator; typedef TrackList_T::Iterator Iterator; ! Playlist(); virtual ~Playlist(); *************** *** 205,209 **** * former trackid at that position. If the Iterator doesn't point to an element in this * list PLAYLISTITEM_INVALID (as defined in playlistitem.h) is returned. ! * After the operation the given Iterator will point to the next element. */ Q_UINT32 removeTrackAt( Iterator& pos ); --- 137,142 ---- * former trackid at that position. If the Iterator doesn't point to an element in this * list PLAYLISTITEM_INVALID (as defined in playlistitem.h) is returned. ! * The iterators position will be invalidated so the next() method has to be called ! * before the next removal operation. */ Q_UINT32 removeTrackAt( Iterator& pos ); *************** *** 234,245 **** * left with the @c Iterator::hasNext() method and get the next element with the * @c Iterator::next() method. */ ! virtual Iterator getTrackIDs(); /** * The const version of the above method. * Returns an iterator over all tracks in this playlist. */ ! virtual ConstIterator getTrackIDs() const; /** --- 167,194 ---- * left with the @c Iterator::hasNext() method and get the next element with the * @c Iterator::next() method. + * @return an iterator over the elements in the playlist */ ! virtual Iterator getElements(); ! ! /** ! * @deprecated as the Iterator iterates over elements of type @c PlaylistItem the name is somewhat misleading. Use the new Method @m getElements() instead. ! */ ! Iterator getTrackIDs() __attribute__((deprecated)) { ! return getElements(); ! } /** * The const version of the above method. * Returns an iterator over all tracks in this playlist. + * @return an iterator over the playlists elements */ ! virtual ConstIterator getElements() const; ! ! /** ! * @deprecated as the Iterator iterates over elements of type @c PlaylistItem the name is somewhat misleading. Use the new Method @m getElements() instead. ! */ ! ConstIterator getTrackIDs() const __attribute__((deprecated)) { ! return getElements(); ! } /** Index: playlist.cpp =================================================================== RCS file: /cvsroot/kpod/libqtpod/src/playlist.cpp,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** playlist.cpp 25 Oct 2007 16:16:05 -0000 1.55 --- playlist.cpp 26 Oct 2007 17:57:45 -0000 1.56 *************** *** 260,271 **** } ! Playlist::Iterator Playlist::getTrackIDs() { return m_tracklist.iterator(); } ! Playlist::ConstIterator Playlist::getTrackIDs() const { return m_tracklist.const_iterator(); } /*! \fn itunesdb::Playlist::getNumTracks() --- 260,274 ---- } ! ! Playlist::Iterator Playlist::getElements() { return m_tracklist.iterator(); } ! ! Playlist::ConstIterator Playlist::getElements() const { return m_tracklist.const_iterator(); } + /*! \fn itunesdb::Playlist::getNumTracks() |