Finale PDK Framework 0.77
Power Up Your Finale Music Software
Loading...
Searching...
No Matches
ff_iterator.h
1/*
2 * File: ff_iterator.h
3 * Author: Jari Williamsson
4 *
5 * Created on den 9 november 2010, 19:38
6 */
7
8#ifndef FF_ITERATOR_H
9#define FF_ITERATOR_H
10
26{
31 bool _useprogressbar;
32
34 bool _progressbarabortable;
35
37 bool _latestabortstate;
38
39 bool _saveafteriterate;
40public:
41 const char* ClassName() const override { return "FCIteratorHandler"; }
42
49 FCIteratorHandler(bool bUseProgressBar = false, bool bUserAbortable = false) : __FCBase()
50 {
51 _useprogressbar = bUseProgressBar;
52 _progressbarabortable = bUserAbortable;
53 _latestabortstate = false;
54 _saveafteriterate = false;
55 }
56
65 virtual bool Iterate([[maybe_unused]]__FCBase* pObject) { return true; }
66
80 virtual bool SecondPassIterate([[maybe_unused]]__FCBase* pObject) { return false; }
81
83 virtual bool IterateIndex([[maybe_unused]]__FCBase* pObject, [[maybe_unused]]int index) { return true; }
84
89 virtual bool Match([[maybe_unused]]__FCBase* pObject) { return false; }
90
102 virtual int Compare([[maybe_unused]]const __FCBase* pObject1, [[maybe_unused]]const __FCBase* pObject2) const { return 0; }
103
115 virtual bool PreProcess() { return true; }
116
125 virtual bool PreProcessIfExist() { return true; }
126
134 virtual void PostProcess() {}
135
142 virtual void PostProcessIfExist() {}
143
148 void SetLastAbortState(bool value) { _latestabortstate = value; }
149
155 bool GetLastAbortState() { return _useprogressbar && _progressbarabortable && _latestabortstate; }
156
161 bool GetUseProgressBar() { return _useprogressbar; }
162
167 void SetUseProgressBar(bool value) { _useprogressbar = value; }
168
174 bool GetProgressBarAbortable() { return _progressbarabortable; }
175
181 void SetProgressBarAbortable(bool value) { _progressbarabortable = value; }
182
183
189 bool GetSaveAfterIterate() { return _saveafteriterate; }
190
200 void SetSaveAfterIterate(bool value) { _saveafteriterate = value; }
201};
202
203
209{
210public:
211 const char* ClassName() const override { return "__FCIteratorBase"; }
212
217
226 virtual int ForEach(FCIteratorHandler* pIterator) = 0;
227
235 virtual __FCBase* FindFirst(FCIteratorHandler* pIterator) = 0;
236};
237
238#endif /* FF_ITERATOR_H */
239
Base class for the Finale Framework classes.
Definition ff_base.h:71
The base class for both browser and collection classes.
Definition ff_iterator.h:209
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_iterator.h:211
__FCIteratorBase()
The constructor.
Definition ff_iterator.h:216
virtual int ForEach(FCIteratorHandler *pIterator)=0
Processes one element after another and iterates from the start to the end of the available data.
virtual __FCBase * FindFirst(FCIteratorHandler *pIterator)=0
Processes one element after another and returns the object that's the first match....
Class for iterator handlers.
Definition ff_iterator.h:26
bool GetLastAbortState()
Gets the user abort state of the last iteration process.
Definition ff_iterator.h:155
virtual bool PreProcessIfExist()
A virtual callback that can be used for preprocessing before any objects are processed,...
Definition ff_iterator.h:125
virtual void PostProcessIfExist()
A virtual callback that can be used for postprocessing after all objects have been processed,...
Definition ff_iterator.h:142
virtual bool SecondPassIterate(__FCBase *pObject)
A second-pass virtual callback method when iterating through multiple objects.
Definition ff_iterator.h:80
virtual int Compare(const __FCBase *pObject1, const __FCBase *pObject2) const
The virtual callback method to compare 2 objects.
Definition ff_iterator.h:102
void SetSaveAfterIterate(bool value)
Set the state that the iterator wants the caller to automatically save the data after the Iterate cal...
Definition ff_iterator.h:200
virtual bool PreProcess()
A virtual callback that can be used for preprocessing before any objects are processed.
Definition ff_iterator.h:115
void SetLastAbortState(bool value)
For internal use only! Sets the latest abort state.
Definition ff_iterator.h:148
bool GetProgressBarAbortable()
Gets the current state of the setting for being able the abort the progress bar processing.
Definition ff_iterator.h:174
bool GetSaveAfterIterate()
Gets the current state of the "Save after iterate" setting. See SetSaveAfterIterate for more info.
Definition ff_iterator.h:189
void SetUseProgressBar(bool value)
Sets the current state of the setting for using the progress bar.
Definition ff_iterator.h:167
virtual bool IterateIndex(__FCBase *pObject, int index)
Same as Iterate, but with a collection index as well.
Definition ff_iterator.h:83
const char * ClassName() const override
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition ff_iterator.h:41
bool GetUseProgressBar()
Gets the current state of the setting for using the progress bar.
Definition ff_iterator.h:161
virtual void PostProcess()
A virtual callback that can be used for postprocessing after all objects have been processed.
Definition ff_iterator.h:134
FCIteratorHandler(bool bUseProgressBar=false, bool bUserAbortable=false)
The constructor.
Definition ff_iterator.h:49
virtual bool Match(__FCBase *pObject)
The virtual callback method to decide a object match.
Definition ff_iterator.h:89
void SetProgressBarAbortable(bool value)
Sets the current state of the setting for being able the abort the progress bar processing.
Definition ff_iterator.h:181
virtual bool Iterate(__FCBase *pObject)
The virtual callback method when iterating through multiple objects. This method is called exactly on...
Definition ff_iterator.h:65