/media/hdb5/canorusNightlyBuildSystem/trunk/src/core/barline.cpp

Go to the documentation of this file.
00001 
00008 #include "core/barline.h"
00009 #include "core/staff.h"
00010 #include "core/mark.h"
00011 
00027 CABarline::CABarline(CABarlineType type, CAStaff *staff, int startTime) 
00028  : CAMusElement(staff, startTime) {
00029         setMusElementType( CAMusElement::Barline );
00030         setBarlineType( type );
00031 }
00032 
00036 CABarline::~CABarline() {
00037 }
00038 
00039 CABarline* CABarline::clone() {
00040         CABarline *b = new CABarline( barlineType(), static_cast<CAStaff*>(context()), timeStart() );
00041         
00042         for (int i=0; i<markList().size(); i++) {
00043                 CAMark *m = static_cast<CAMark*>(markList()[i]->clone());
00044                 m->setAssociatedElement(b);
00045                 b->addMark( m );
00046         }
00047         
00048         return b;
00049 }
00050 
00051 int CABarline::compare( CAMusElement *elt ) {
00052         if ( elt->musElementType()!=CAMusElement::Barline )
00053                 return -1;
00054         
00055         int diffs=0;
00056         if ( barlineType() != static_cast<CABarline*>(elt)->barlineType() ) diffs++;
00057         
00058         return diffs;
00059 }
00060 
00066 const QString CABarline::barlineTypeToString(CABarlineType type) {
00067         switch (type) {
00068                 case Single: return "single";
00069                 case Double: return "double";
00070                 case End: return "end";
00071                 case RepeatOpen: return "repeat-open";
00072                 case RepeatClose: return "repeat-close";
00073                 case RepeatCloseOpen: return "repeat-close-open";
00074                 case Dotted: return "dotted";
00075                 default: return "";
00076         }
00077 }
00078 
00084 CABarline::CABarlineType CABarline::barlineTypeFromString(const QString type) {
00085         if (type=="single") return Single; else
00086         if (type=="double") return Double; else
00087         if (type=="end") return End; else
00088         if (type=="repeat-open") return RepeatOpen; else
00089         if (type=="repeat-close") return RepeatClose; else
00090         if (type=="repeat-close-open") return RepeatCloseOpen; else
00091         if (type=="dotted") return Dotted;
00092         else return Single;     
00093 }

Generated on Sat Feb 9 13:06:25 2008 for Canorus by  doxygen 1.5.3