Finale PDK Framework  0.54
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;
40 public:
41  virtual const char* ClassName() { 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(__FCBase* pObject) { return true; }
66 
80  virtual bool SecondPassIterate(__FCBase* pObject) { return false; }
81 
83  virtual bool IterateIndex(__FCBase* pObject, int index) { return true; }
84 
89  virtual bool Match(__FCBase* pObject) { return false; }
90 
102  virtual int Compare(__FCBase* pObject1, __FCBase* pObject2) { 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 {
210 public:
211  virtual const char* ClassName() { 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 
void SetUseProgressBar(bool value)
Sets the current state of the setting for using the progress bar.
Definition: ff_iterator.h:167
virtual const char * ClassName()
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition: ff_iterator.h:41
virtual __FCBase * FindFirst(FCIteratorHandler *pIterator)=0
Processes one element after another and returns the object that's the first match. This should be overwritten as collection/browser implementations.
virtual const char * ClassName()
Returns the name of the class, for diagnostic purposes. This method MUST be overwritten in each child...
Definition: ff_iterator.h:211
virtual bool PreProcessIfExist()
A virtual callback that can be used for preprocessing before any objects are processed, but only if there are objects to iterate.
Definition: ff_iterator.h:125
bool GetLastAbortState()
Gets the user abort state of the last iteration process.
Definition: ff_iterator.h:155
bool GetUseProgressBar()
Gets the current state of the setting for using the progress bar.
Definition: ff_iterator.h:161
virtual int ForEach(FCIteratorHandler *pIterator)=0
Processes one element after another and iterates from the start to the end of the available data...
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
Base class for the Finale Framework classes.
Definition: ff_base.h:47
FCIteratorHandler(bool bUseProgressBar=false, bool bUserAbortable=false)
The constructor.
Definition: ff_iterator.h:49
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
bool GetProgressBarAbortable()
Gets the current state of the setting for being able the abort the progress bar processing.
Definition: ff_iterator.h:174
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
void SetLastAbortState(bool value)
For internal use only! Sets the latest abort state.
Definition: ff_iterator.h:148
virtual bool SecondPassIterate(__FCBase *pObject)
A second-pass virtual callback method when iterating through multiple objects.
Definition: ff_iterator.h:80
virtual bool PreProcess()
A virtual callback that can be used for preprocessing before any objects are processed.
Definition: ff_iterator.h:115
Class for iterator handlers.
Definition: ff_iterator.h:25
virtual bool Match(__FCBase *pObject)
The virtual callback method to decide a object match.
Definition: ff_iterator.h:89
bool GetSaveAfterIterate()
Gets the current state of the "Save after iterate" setting. See SetSaveAfterIterate for more info...
Definition: ff_iterator.h:189
virtual int Compare(__FCBase *pObject1, __FCBase *pObject2)
The virtual callback method to compare 2 objects.
Definition: ff_iterator.h:102
__FCIteratorBase()
The constructor.
Definition: ff_iterator.h:216
virtual bool IterateIndex(__FCBase *pObject, int index)
Same as Iterate, but with a collection index as well.
Definition: ff_iterator.h:83
The base class for both browser and collection classes.
Definition: ff_iterator.h:208
virtual void PostProcessIfExist()
A virtual callback that can be used for postprocessing after all objects have been processed...
Definition: ff_iterator.h:142
virtual void PostProcess()
A virtual callback that can be used for postprocessing after all objects have been processed...
Definition: ff_iterator.h:134