Ejemplo n.º 1
0
HumdrumFileBasic HumdrumFileBasic::extract(int aField) {
   int fieldNumber = aField;
   HumdrumRecord aRecord;
   HumdrumFileBasic output;
   for (int i=0; i<getNumLines(); i++) {
      switch(records[i]->getType()) {
         case E_humrec_data:
         case E_humrec_data_comment:
         case E_humrec_data_kern_measure:
         case E_humrec_data_interpretation:
            if (aField < 0) {
               fieldNumber = records[i]->getFieldCount() + aField;
               if (fieldNumber < 0) { 
                  fieldNumber = 0;
               }
            } else {
               fieldNumber = aField;
            }
            aRecord.setLine((*records[i])[fieldNumber]);
            aRecord.setExInterp(0, records[i]->getExInterpNum(fieldNumber));
            output.appendLine(aRecord);
            break;
         case E_humrec_empty:
            output.appendLine(records[i]);
            break;
         case E_humrec_none:
         case E_humrec_global_comment:
         default:
            output.appendLine(records[i]);
      }
   }

   return output;
}
Ejemplo n.º 2
0
void HumdrumFileBasic::appendLine(const char* aLine) {
   HumdrumRecord* aRecord;
   aRecord = new HumdrumRecord;
   aRecord->setLine(aLine);
   records[records.getSize()] = aRecord;
}