コード例 #1
0
//______________________________________________________________________________
// control all of the tree browsing is in charge of the S_part visit
// it assumes that the score is a partwise score but the strategy could
// equalli work on a timewise score, provided that the jump information
// is consistent across the different parts.
//
// Jumps are under control of fNextIterator which could be modified by the
// measure visit. Anchor points for future jumps (like segno) are stored
// at S_part level using fStoreIterator pointer.
//
// visit methods can use the fStoreIterator pointer to store the current iterator
// to any ctree<xmlelement>::literator. Using fStoreDelay allows for delayed stores.
//
void unrolled_xml_tree_browser::visitStart( S_part& elt)
{
	// first initializes the iterators used to broswe the tree
	// segno and coda are initialized to the end of the measures list
	fEndIterator = elt->elements().end();
	fSegnoIterator= fCodaIterator = fEndIterator;
	// stores the first measures and makes a provision for the forward repeat location
	ctree<xmlelement>::literator iter = elt->elements().begin();
	fFirstMeasure = fForwardRepeat = iter;
	fStoreIterator = 0;
	fStoreDelay = 0;

	reset();

	enter(*elt);			// normal visit of the part (pass thru)
	fForward = false;
	// while we're not at the end location (elements().end() is checked for safety reasons only)
	while ((iter != fEndIterator) && (iter != elt->elements().end())) {
		fNextIterator = iter;
		fNextIterator++;				// default value for next iterator is the next measure
		browse(**iter);					// browse the measure
		if (fStoreIterator) {			// check if we need to store the current iterator
			if (fStoreDelay == 0) {
				*fStoreIterator = iter;
				fStoreIterator = 0;
			}
			else fStoreDelay--;			// this is actually a delayed store
		}
		iter = fNextIterator;			// switch to next iterator (which may be changed by the measure visit)
	}
	leave(*elt);			// normal visit of the part (pass thru)
}