src/HumdrumFileContent.cpp
int HumdrumFileContent::hasPickup(void) {
	HumdrumFileContent& infile = *this;
	int barline = -1;
	HTp tsig = NULL;
	for (int i=0; i<infile.getLineCount(); i++) {
		if (infile[i].isBarline()) {
			if (barline > 0) {
				// second barline found, so stop looking for time signature
				break;
			}
			barline = i;
			continue;
		}
		if (!infile[i].isInterpretation()) {
			continue;
		}
		if (tsig != NULL) {
			continue;
		}
		for (int j=0; j<infile[i].getFieldCount(); j++) {
			HTp token = infile.token(i, j);
			if (token->isTimeSignature()) {
				tsig = token;
				break;
			}
		}
	}
	if (tsig == NULL) {
		// no time signature so return 0
		return 0;
	}
	if (barline < 0) {
		// no barlines in music
		return 0;
	}
	HumNum mdur = infile[barline].getDurationFromStart();
	HumNum tdur = Convert::timeSigToDurationInQuarter(tsig);
	if (mdur == tdur) {
		return 0;
	}
	return barline;
}
//////////////////////////////
//
// HumdrumFileContent::hasPickup -- Return false if there is no pickup measure.
//   Return the barline index number if there is a pickup measure.  A pickup measure
//   is identified when the duration from the start of the file to the first
//   barline is not zero or equal to the duration of the starting time signature.
//   if there is not starting time signature, then there cannot be an identified
//   pickup measure.
//
:hasPickup -- Return false if there is no pickup measure.
Return the barline index number if there is a pickup measure.  A pickup measure
is identified when the duration from the start of the file to the first
barline is not zero or equal to the duration of the starting time signature.
if there is not starting time signature, then there cannot be an identified
pickup measure.
: hasPickup -- Return false if there is no pickup measure . Return the barline index number if there is a pickup measure . A pickup measure is identified when the duration from the start of the file to the first barline is not zero or equal to the duration of the starting time signature . if there is not starting time signature then there cannot be an identified pickup measure .
int HumdrumFileContent::hasPickup(void) {
	HumdrumFileContent& infile = *this;
	int barline = -1;
	HTp tsig = NULL;
	for (int i=0; i<infile.getLineCount(); i++) {
		if (infile[i].isBarline()) {
			if (barline > 0) {
				break;
			}
			barline = i;
			continue;
		}
		if (!infile[i].isInterpretation()) {
			continue;
		}
		if (tsig != NULL) {
			continue;
		}
		for (int j=0; j<infile[i].getFieldCount(); j++) {
			HTp token = infile.token(i, j);
			if (token->isTimeSignature()) {
				tsig = token;
				break;
			}
		}
	}
	if (tsig == NULL) {
		return 0;
	}
	if (barline < 0) {
		return 0;
	}
	HumNum mdur = infile[barline].getDurationFromStart();
	HumNum tdur = Convert::timeSigToDurationInQuarter(tsig);
	if (mdur == tdur) {
		return 0;
	}
	return barline;
}
int HumdrumFileContent :: hasPickup ( void ) { HumdrumFileContent & infile = * this ; int barline = -1 ; HTp tsig = NULL ; for ( int i = 0 ; i < infile . getLineCount ( ) ; i ++ ) { if ( infile [ i ] . isBarline ( ) ) { if ( barline > 0 ) { break ; } barline = i ; continue ; } if ( ! infile [ i ] . isInterpretation ( ) ) { continue ; } if ( tsig != NULL ) { continue ; } for ( int j = 0 ; j < infile [ i ] . getFieldCount ( ) ; j ++ ) { HTp token = infile . token ( i , j ) ; if ( token -> isTimeSignature ( ) ) { tsig = token ; break ; } } } if ( tsig == NULL ) { return 0 ; } if ( barline < 0 ) { return 0 ; } HumNum mdur = infile [ barline ] . getDurationFromStart ( ) ; HumNum tdur = Convert :: timeSigToDurationInQuarter ( tsig ) ; if ( mdur == tdur ) { return 0 ; } return barline ; }
HumdrumFileContent::hasPickup -- Return false if there is no pickup measure.
HumdrumFileContent :: hasPickup -- Return false if there is no pickup measure .
// second barline found, so stop looking for time signature // no time signature so return 0 // no barlines in music