本文整理汇总了C++中Articulation::read方法的典型用法代码示例。如果您正苦于以下问题:C++ Articulation::read方法的具体用法?C++ Articulation::read怎么用?C++ Articulation::read使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Articulation
的用法示例。
在下文中一共展示了Articulation::read方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: read
void BarLine::read(XmlReader& e)
{
// if bar line belongs to a staff, span values default to staff values
if (staff()) {
_span = staff()->barLineSpan();
_spanFrom = staff()->barLineFrom();
_spanTo = staff()->barLineTo();
}
while (e.readNextStartElement()) {
const QStringRef& tag(e.name());
if (tag == "subtype") {
bool ok;
const QString& val(e.readElementText());
int i = val.toInt(&ok);
if (!ok)
setBarLineType(val);
else {
BarLineType ct = NORMAL_BAR;
switch (i) {
default:
case 0: ct = NORMAL_BAR; break;
case 1: ct = DOUBLE_BAR; break;
case 2: ct = START_REPEAT; break;
case 3: ct = END_REPEAT; break;
case 4: ct = BROKEN_BAR; break;
case 5: ct = END_BAR; break;
case 6: ct = END_START_REPEAT; break;
case 7: ct = DOTTED_BAR; break;
}
setBarLineType(ct);
}
if (parent() && parent()->type() == SEGMENT) {
Measure* m = static_cast<Segment*>(parent())->measure();
if (barLineType() != m->endBarLineType())
_customSubtype = true;
}
}
else if (tag == "customSubtype")
_customSubtype = e.readInt();
else if (tag == "span") {
_span = e.readInt();
_spanFrom = e.intAttribute("from", _spanFrom);
_spanTo = e.intAttribute("to", _spanTo);
// WARNING: following statements assume staff and staff bar line spans are correctly set
if (staff() && (_span != staff()->barLineSpan()
|| _spanFrom != staff()->barLineFrom() || _spanTo != staff()->barLineTo()))
_customSpan = true;
}
else if (tag == "Articulation") {
Articulation* a = new Articulation(score());
a->read(e);
add(a);
}
else if (!Element::readProperties(e))
e.unknown();
}
}
示例2: read
void BarLine::read(const QDomElement& de)
{
// if bar line belongs to a staff, span values default to staff values
if(staff()) {
_span = staff()->barLineSpan();
_spanFrom = staff()->barLineFrom();
_spanTo = staff()->barLineTo();
}
for (QDomElement e = de.firstChildElement(); !e.isNull(); e = e.nextSiblingElement()) {
const QString& tag(e.tagName());
const QString& val(e.text());
if (tag == "subtype") {
bool ok;
int i = val.toInt(&ok);
if (!ok)
setSubtype(val);
else {
BarLineType ct = NORMAL_BAR;
switch (i) {
default:
case 0: ct = NORMAL_BAR; break;
case 1: ct = DOUBLE_BAR; break;
case 2: ct = START_REPEAT; break;
case 3: ct = END_REPEAT; break;
case 4: ct = BROKEN_BAR; break;
case 5: ct = END_BAR; break;
case 6: ct = END_START_REPEAT; break;
case 7: ct = DOTTED_BAR; break;
}
setSubtype(ct);
}
if(parent() && parent()->type() == SEGMENT) {
Measure* m = static_cast<Segment*>(parent())->measure();
if(subtype() != m->endBarLineType())
setCustomSubtype(true);
}
}
else if (tag == "customSubtype")
setCustomSubtype(val.toInt() != 0);
else if (tag == "span") {
_span = val.toInt();
_spanFrom = e.attribute("from", QString::number(_spanFrom)).toInt();
_spanTo = e.attribute("to", QString::number(_spanTo)).toInt();
// WARNING: following statements assume staff and staff bar line spans are correctly set
if(staff() && (_span != staff()->barLineSpan()
|| _spanFrom != staff()->barLineFrom() || _spanTo != staff()->barLineTo()))
_customSpan = true;
}
else if (tag == "Articulation") {
Articulation* a = new Articulation(score());
a->read(e);
add(a);
}
else if (!Element::readProperties(e))
domError(e);
}
}
示例3: read
void BarLine::read(const QDomElement& de)
{
for (QDomElement e = de.firstChildElement(); !e.isNull(); e = e.nextSiblingElement()) {
const QString& tag(e.tagName());
const QString& val(e.text());
if (tag == "subtype") {
bool ok;
int i = val.toInt(&ok);
if (!ok)
setSubtype(val);
else {
BarLineType ct = NORMAL_BAR;
switch (i) {
default:
case 0: ct = NORMAL_BAR; break;
case 1: ct = DOUBLE_BAR; break;
case 2: ct = START_REPEAT; break;
case 3: ct = END_REPEAT; break;
case 4: ct = BROKEN_BAR; break;
case 5: ct = END_BAR; break;
case 6: ct = END_START_REPEAT; break;
}
setSubtype(ct);
}
}
else if (tag == "span")
_span = val.toInt();
else if (tag == "Articulation") {
Articulation* a = new Articulation(score());
a->read(e);
add(a);
}
else if (!Element::readProperties(e))
domError(e);
}
}
示例4: readProperties
bool ChordRest::readProperties(XmlReader& e)
{
const QStringRef& tag(e.name());
if (tag == "durationType") {
setDurationType(e.readElementText());
if (actualDurationType().type() != TDuration::DurationType::V_MEASURE) {
if ((type() == Element::Type::REST) &&
// for backward compatibility, convert V_WHOLE rests to V_MEASURE
// if long enough to fill a measure.
// OTOH, freshly created (un-initialized) rests have numerator == 0 (< 4/4)
// (see Fraction() constructor in fraction.h; this happens for instance
// when pasting selection from clipboard): they should not be converted
duration().numerator() != 0 &&
// rest durations are initialized to full measure duration when
// created upon reading the <Rest> tag (see Measure::read() )
// so a V_WHOLE rest in a measure of 4/4 or less => V_MEASURE
(actualDurationType()==TDuration::DurationType::V_WHOLE && duration() <= Fraction(4, 4)) ) {
// old pre 2.0 scores: convert
setDurationType(TDuration::DurationType::V_MEASURE);
}
else // not from old score: set duration fraction from duration type
setDuration(actualDurationType().fraction());
}
else {
if (score()->mscVersion() < 115) {
SigEvent event = score()->sigmap()->timesig(e.tick());
setDuration(event.timesig());
}
}
}
else if (tag == "BeamMode") {
QString val(e.readElementText());
Beam::Mode bm = Beam::Mode::AUTO;
if (val == "auto")
bm = Beam::Mode::AUTO;
else if (val == "begin")
bm = Beam::Mode::BEGIN;
else if (val == "mid")
bm = Beam::Mode::MID;
else if (val == "end")
bm = Beam::Mode::END;
else if (val == "no")
bm = Beam::Mode::NONE;
else if (val == "begin32")
bm = Beam::Mode::BEGIN32;
else if (val == "begin64")
bm = Beam::Mode::BEGIN64;
else
bm = Beam::Mode(val.toInt());
_beamMode = Beam::Mode(bm);
}
else if (tag == "Attribute" || tag == "Articulation") { // obsolete: "Attribute"
Articulation* atr = new Articulation(score());
atr->read(e);
add(atr);
}
else if (tag == "leadingSpace") {
qDebug("ChordRest: leadingSpace obsolete"); // _extraLeadingSpace = Spatium(val.toDouble());
e.skipCurrentElement();
}
else if (tag == "trailingSpace") {
qDebug("ChordRest: trailingSpace obsolete"); // _extraTrailingSpace = Spatium(val.toDouble());
e.skipCurrentElement();
}
else if (tag == "Beam") {
int id = e.readInt();
Beam* beam = e.findBeam(id);
if (beam)
beam->add(this); // also calls this->setBeam(beam)
else
qDebug("Beam id %d not found", id);
}
else if (tag == "small")
_small = e.readInt();
else if (tag == "duration")
setDuration(e.readFraction());
else if (tag == "ticklen") { // obsolete (version < 1.12)
int mticks = score()->sigmap()->timesig(e.tick()).timesig().ticks();
int i = e.readInt();
if (i == 0)
i = mticks;
if ((type() == Element::Type::REST) && (mticks == i)) {
setDurationType(TDuration::DurationType::V_MEASURE);
setDuration(Fraction::fromTicks(i));
}
else {
Fraction f = Fraction::fromTicks(i);
setDuration(f);
setDurationType(TDuration(f));
}
}
else if (tag == "dots")
setDots(e.readInt());
else if (tag == "move")
_staffMove = e.readInt();
else if (tag == "Slur") {
int id = e.intAttribute("id");
if (id == 0)
id = e.intAttribute("number"); // obsolete
//.........这里部分代码省略.........