// // Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu> // Creation Date: Wed Mar 10 09:39:15 PST 2004 // Last Modified: Wed Mar 10 09:39:17 PST 2004 // Filename: ...sig/examples/all/musicxmltest.cpp // Web Address: http://sig.sapp.org/examples/museinfo/humdrum/musicxmltest.cpp // Syntax: C++; museinfo // // Description: Basic MusicXML parse test // #include "MusicXmlFile.h" #include "Options.h" #include <iostream> // user interface variables Options options; // function declarations: void checkOptions(Options& opts, int argc, char** argv); void example(void); void usage(const char* command); ////////////////////////////////////////////////////////////////////////// int main(int argc, char* argv[]) { checkOptions(options, argc, argv); MusicXmlFile xmlfile(options.getArg(1)); xmlfile.info(); cout << "====================================================" << endl; cout << endl; HumdrumFile hfile; xmlfile.humdrumPart(hfile, 0); cout << endl; cout << "====================================================" << endl; cout << xmlfile; return 0; } ////////////////////////////////////////////////////////////////////////// ////////////////////////////// // // checkOptions -- // void checkOptions(Options& opts, int argc, char* argv[]) { opts.define("author=b", "author of program"); opts.define("version=b", "compilation info"); opts.define("example=b", "example usages"); opts.define("h|help=b", "short description"); opts.process(argc, argv); // handle basic options: if (opts.getBoolean("author")) { cout << "Written by Craig Stuart Sapp, " << "craig@ccrma.stanford.edu, 10 March 2004" << endl; exit(0); } else if (opts.getBoolean("version")) { cout << argv[0] << ", version: March 2003" << endl; cout << "compiled: " << __DATE__ << endl; exit(0); } else if (opts.getBoolean("help")) { usage(opts.getCommand()); exit(0); } else if (opts.getBoolean("example")) { example(); exit(0); } if (opts.getArgCount() != 1) { cout << "Error: need one filename specified" << endl; exit(1); } } ////////////////////////////// // // example -- // void example(void) { } ////////////////////////////// // // usage -- // void usage(const char* command) { } // md5sum: 2e3916bb155fe5f9f2daf28f69c7ce15 musicxmltest.cpp [20050403]