~s-cecilio/lomse/master

« back to all changes in this revision

Viewing changes to include/lomse_score_iterator.h

  • Committer: cecilios
  • Date: 2010-10-10 13:35:19 UTC
  • Revision ID: git-v1:2b333198c3033525d15763b84eaf79dac9fdab80
Preparing to use CMake. Updating with new code and missing files. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//--------------------------------------------------------------------------------------
 
2
//  This file is part of the Lomse library.
 
3
//  Copyright (c) 2010 Lomse project
 
4
//
 
5
//  Lomse is free software; you can redistribute it and/or modify it under the
 
6
//  terms of the GNU General Public License as published by the Free Software Foundation,
 
7
//  either version 3 of the License, or (at your option) any later version.
 
8
//
 
9
//  Lomse is distributed in the hope that it will be useful, but WITHOUT ANY
 
10
//  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 
11
//  PARTICULAR PURPOSE.  See the GNU General Public License for more details.
 
12
//
 
13
//  You should have received a copy of the GNU General Public License along
 
14
//  with Lomse; if not, see <http://www.gnu.org/licenses/>.
 
15
//  
 
16
//  
 
17
//
 
18
//  For any comment, suggestion or feature request, please contact the manager of
 
19
//  the project at cecilios@users.sourceforge.net
 
20
//
 
21
//-------------------------------------------------------------------------------------
 
22
 
 
23
#ifndef __LOMSE_SCORE_ITERATOR_H__
 
24
#define __LOMSE_SCORE_ITERATOR_H__
 
25
 
 
26
#include <vector>
 
27
#include "lomse_staffobjs_table.h"
 
28
 
 
29
using namespace std;
 
30
 
 
31
namespace lomse
 
32
{
 
33
 
 
34
//forward declarations
 
35
//class Document;
 
36
class ColStaffObjs;
 
37
 
 
38
 
 
39
//-------------------------------------------------------------------------------------
 
40
// ScoreIterator: A cursor to traverse the ColStaffObjs
 
41
//-------------------------------------------------------------------------------------
 
42
 
 
43
class ScoreIterator
 
44
{
 
45
protected:
 
46
    ColStaffObjs*              m_pColStaffObjs;
 
47
    ColStaffObjs::iterator     m_it;
 
48
 
 
49
public:
 
50
    ScoreIterator(ColStaffObjs* pColStaffObjs);
 
51
    ~ScoreIterator();
 
52
 
 
53
 //   inline bool FirstOfCollection() {
 
54
 //                   return (m_pSO && m_pSO == m_pColStaffObjs->GetFirstSO()); }
 
55
 //   inline bool LastOfCollection() {
 
56
 //                   return (m_pSO && m_pSO == m_pColStaffObjs->GetLastSO()); }
 
57
 //   inline bool StartOfCollection() {
 
58
 //                   return FirstOfCollection() || m_pColStaffObjs->IsEmpty(); }
 
59
 //   inline bool EndOfCollection() {
 
60
 //                   return (m_pSO == (lmStaffObj*)NULL || (FirstOfCollection() && m_fEnd)); }
 
61
 
 
62
 //   inline bool ChangeOfMeasure() { return m_fChangeOfMeasure; }
 
63
        //inline lmStaffObj* GetCurrent() { return m_pSO; }
 
64
 //   inline int GetNumSegment() { return (m_pSO ? m_pSO->GetSegment()->GetNumSegment()
 
65
 //                                              : m_pColStaffObjs->GetNumSegments()-1 ); }
 
66
 //   inline void ResetFlags() { m_fChangeOfMeasure = false; }
 
67
 //   inline bool IsManagingCollection(lmColStaffObjs* pCSO) {
 
68
 //                   return pCSO == m_pColStaffObjs; }
 
69
 
 
70
 
 
71
 //   void AdvanceToMeasure(int nBar);
 
72
    void first();
 
73
    inline void operator ++() { ++m_it; }
 
74
    inline void operator --() { --m_it; }
 
75
 //   void MoveLast();
 
76
 //   void MoveTo(lmStaffObj* pSO);
 
77
 
 
78
    inline int segment() const { return (*m_it)->segment(); }
 
79
 
 
80
    ColStaffObjsEntry* operator *() const { return *m_it; }
 
81
 
 
82
 
 
83
protected:
 
84
 
 
85
};
 
86
 
 
87
 
 
88
}   //namespace lomse
 
89
 
 
90
#endif      //__LOMSE_SCORE_ITERATOR_H__