Пример #1
0
//------------------------------------------------------------------------
void musicxmlfactory::addpart (const Sxmlelement& part)	
{ 
	switch (part->getType()) {
		case k_score_part:
			fPartList->push(part);
			break;
		case k_part:
			fRoot->push(part);
			break;
		default:
			cerr << "musicxmlfactory::addpart unexpected type " <<  part->getType() << endl;
	}
}
Пример #2
0
//_______________________________________________________________________________
static void test2(Sxmlelement elt)
{
	cerr << "test2: erasing all the par measures" << endl;
	ctree<xmlelement>::iterator next, iter = elt->begin();
	int measure=1;
	while (iter != elt->end()) {
		Sxmlelement xml = *iter;
		next = iter;
		next++;
		assert (xml);
		if (xml->getType() == k_software) {
				next = elt->erase(iter);			
		}
		else if (xml->getType() == k_measure) {
			if (!(measure & 1)) {
				next = elt->erase(iter);
			}
			measure++;
		}
		iter = next;
	}
}
Пример #3
0
//_______________________________________________________________________________
static void test1(Sxmlelement elt)
{
	cerr << "test1: iterate thru the tree" << endl;
	ctree<xmlelement>::iterator iter = elt->begin();
	cerr << "=> test1: iterate thru the tree" << endl;

	while (iter != elt->end()) {
		Sxmlelement xml = *iter;
		if (xml)
			cerr << "  element type " << xml->getType() 
				 << " - " << xml->getName()
				 << " - size: " << xml->size() << endl;
		else
			cerr << "iterate thru unknown element type " << endl;
		iter++;
	}

}
Пример #4
0
//_______________________________________________________________________________
static void test3(Sxmlelement elt)
{
	cerr << "test3: insert a note before the par notes" << endl;
	ctree<xmlelement>::iterator next, iter = elt->begin();
	int note=1;
	while (iter != elt->end()) {
		Sxmlelement xml = *iter;
		assert (xml);
		if (xml->getType() == k_note) {
			if (!(note & 1)) {
				Sxmlelement note = factory::instance().create(k_note);
				iter = elt->insert(iter, note);
				iter++;
			}
			note++;
		}
		iter++;
	}
}
Пример #5
0
	virtual bool operator () (const Sxmlelement elt) const { 
		return elt->getType() == fType;
	}