Skip to content

Commit

Permalink
Code linting
Browse files Browse the repository at this point in the history
  • Loading branch information
DILewis committed Dec 17, 2024
1 parent b3aa166 commit ee5e353
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 33 deletions.
5 changes: 2 additions & 3 deletions include/vrv/annotscore.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace vrv {
/**
* This class models the MEI <annot> element where @type is score.
*/
class AnnotScore : public ControlElement, public TimeSpanningInterface, public AttPlist {
class AnnotScore : public ControlElement, public TimeSpanningInterface, public AttPlist {
public:
/**
* @name Constructors, destructors, and other standard methods
Expand All @@ -32,7 +32,7 @@ class AnnotScore : public ControlElement, public TimeSpanningInterface, public
///@{
AnnotScore();
virtual ~AnnotScore();
//Object *Clone() const override { return new AnnotScore(*this); }
// Object *Clone() const override { return new AnnotScore(*this); }
void Reset() override;
std::string GetClassName() const override { return "AnnotScore"; }
///@}
Expand All @@ -58,7 +58,6 @@ class AnnotScore : public ControlElement, public TimeSpanningInterface, public
*/
bool IsSupportedChild(Object *object) override;


///@}

//----------//
Expand Down
3 changes: 1 addition & 2 deletions src/annotscore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ namespace vrv {

static const ClassRegistrar<AnnotScore> s_factory("annotScore", ANNOTSCORE);

AnnotScore::AnnotScore()
: ControlElement(ANNOTSCORE, "annotscore-"), AttPlist()
AnnotScore::AnnotScore() : ControlElement(ANNOTSCORE, "annotscore-"), AttPlist()
{
this->RegisterInterface(TimeSpanningInterface::GetAttClasses(), TimeSpanningInterface::IsInterface());
this->RegisterAttClass(ATT_PLIST);
Expand Down
4 changes: 2 additions & 2 deletions src/iohumdrum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2939,7 +2939,7 @@ void HumdrumInput::createDigitalSource(pugi::xml_node sourceDesc)
pugi::xml_node bibl = source.append_child("bibl");
bibl.append_copy(m_simpleTitle);
for (pugi::xml_node_iterator childIt = m_simpleComposersDoc.begin(); childIt != m_simpleComposersDoc.end();
++childIt) {
++childIt) {
bibl.append_copy(*childIt);
}

Expand Down Expand Up @@ -3691,7 +3691,7 @@ void HumdrumInput::createPrintedSource(pugi::xml_node sourceDesc)

bibl.append_copy(m_simpleTitle);
for (pugi::xml_node_iterator childIt = m_simpleComposersDoc.begin(); childIt != m_simpleComposersDoc.end();
++childIt) {
++childIt) {
bibl.append_copy(*childIt);
}

Expand Down
47 changes: 26 additions & 21 deletions src/iomei.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -472,10 +472,12 @@ bool MEIOutput::WriteObjectInternal(Object *object, bool useCustomScoreDef)
else if (object->Is(ANCHOREDTEXT)) {
m_currentNode = m_currentNode.append_child("anchoredText");
this->WriteAnchoredText(m_currentNode, vrv_cast<AnchoredText *>(object));
} else if (object->Is(ANNOTSCORE)){
m_currentNode = m_currentNode.append_child("annot");
this->WriteAnnotScore(m_currentNode, vrv_cast<AnnotScore *>(object));
} else if (object->Is(ARPEG)) {
}
else if (object->Is(ANNOTSCORE)) {
m_currentNode = m_currentNode.append_child("annot");
this->WriteAnnotScore(m_currentNode, vrv_cast<AnnotScore *>(object));
}
else if (object->Is(ARPEG)) {
m_currentNode = m_currentNode.append_child("arpeg");
this->WriteArpeg(m_currentNode, vrv_cast<Arpeg *>(object));
}
Expand Down Expand Up @@ -835,10 +837,12 @@ bool MEIOutput::WriteObjectInternal(Object *object, bool useCustomScoreDef)
else if (object->Is(ANNOT)) {
m_currentNode = m_currentNode.append_child("annot");
this->WriteAnnot(m_currentNode, vrv_cast<Annot *>(object));
} else if (object->Is(APP)) {
}
else if (object->Is(APP)) {
m_currentNode = m_currentNode.append_child("app");
this->WriteApp(m_currentNode, vrv_cast<App *>(object));
} else if (object->Is(CHOICE)) {
}
else if (object->Is(CHOICE)) {
m_currentNode = m_currentNode.append_child("choice");
this->WriteChoice(m_currentNode, vrv_cast<Choice *>(object));
}
Expand Down Expand Up @@ -1972,11 +1976,11 @@ void MEIOutput::WriteAnnotScore(pugi::xml_node currentNode, AnnotScore *annotSco
this->WriteControlElement(currentNode, annotScore);
annotScore->WritePlist(currentNode);
// FIXME: currently ignoring annot contents
/* // special case where we keep the pugi::nodes
for (pugi::xml_node child = annotScore->m_content.first_child(); child; child = child.next_sibling()) {
currentNode.append_copy(child);
}
*/
/* // special case where we keep the pugi::nodes
for (pugi::xml_node child = annotScore->m_content.first_child(); child; child = child.next_sibling()) {
currentNode.append_copy(child);
}
*/
}

void MEIOutput::WriteArpeg(pugi::xml_node currentNode, Arpeg *arpeg)
Expand Down Expand Up @@ -5485,9 +5489,10 @@ bool MEIInput::ReadMeasureChildren(Object *parent, pugi::xml_node parentNode)
this->NormalizeAttributes(current);
// editorial
if (this->IsEditorialElementName(currentName)) {
if(currentName == "annot" && this->IsAnnotScore(current)) {
if (currentName == "annot" && this->IsAnnotScore(current)) {
success = this->ReadAnnotScore(parent, current);
} else {
}
else {
success = this->ReadEditorialElement(parent, current, EDITORIAL_MEASURE);
}
}
Expand Down Expand Up @@ -7687,32 +7692,31 @@ bool MEIInput::ReadAnnot(Object *parent, pugi::xml_node annot)

bool MEIInput::ReadAnnotScore(Object *parent, pugi::xml_node annot)
{
AnnotScore *vrvAnnotScore = new AnnotScore();
//this->ReadEditorialElement(annot, vrvAnnotScore);
AnnotScore *vrvAnnotScore = new AnnotScore();
// this->ReadEditorialElement(annot, vrvAnnotScore);

vrvAnnotScore->ReadPlist(annot);
//vrvAnnotScore->ReadSource(annot);
// vrvAnnotScore->ReadSource(annot);

parent->AddChild(vrvAnnotScore);
//vrvAnnotScore->m_content.reset();
// vrvAnnotScore->m_content.reset();

bool hasNonTextContent = false;
// copy all the nodes inside into the document
for (pugi::xml_node child = annot.first_child(); child; child = child.next_sibling()) {
const std::string nodeName = child.name();
if (!hasNonTextContent && (!nodeName.empty())) hasNonTextContent = true;
//vrvAnnotScore->m_content.append_copy(child);
// vrvAnnotScore->m_content.append_copy(child);
}
this->ReadUnsupportedAttr(annot, vrvAnnotScore);
// Unless annot has only text we do not load children because they are preserved in Annot::m_content
if (hasNonTextContent) {
return true;
}
else {
//vrvAnnot->m_content.remove_children();
// vrvAnnot->m_content.remove_children();
return this->ReadTextChildren(vrvAnnotScore, annot, vrvAnnotScore);
}

}

bool MEIInput::ReadApp(Object *parent, pugi::xml_node app, EditorialLevel level, Object *filter)
Expand Down Expand Up @@ -8313,7 +8317,8 @@ bool MEIInput::ReadXMLComment(Object *object, pugi::xml_node element)
return true;
}

bool MEIInput::IsAnnotScore(pugi::xml_node annot) {
bool MEIInput::IsAnnotScore(pugi::xml_node annot)
{
// If the annotation is a score annotation, it'll have @type="score" (we can also guess)
std::string value = annot.attribute("type").value();
return value == "score";
Expand Down
10 changes: 5 additions & 5 deletions src/iomusxml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3492,7 +3492,7 @@ void MusicXmlInput::ReadMusicXmlNote(
m_trillStack.push_back({ trill, openTrill });
}
for (pugi::xml_node xmlAccidMark = xmlTrill.node().next_sibling("accidental-mark"); xmlAccidMark;
xmlAccidMark = xmlAccidMark.next_sibling("accidental-mark")) {
xmlAccidMark = xmlAccidMark.next_sibling("accidental-mark")) {
if (HasAttributeWithValue(xmlAccidMark, "placement", "below")) {
trill->SetAccidlower(ConvertAccidentalToAccid(xmlAccidMark.text().as_string()));
}
Expand Down Expand Up @@ -3530,7 +3530,7 @@ void MusicXmlInput::ReadMusicXmlNote(
turn->SetPlace(turn->AttPlacementRelStaff::StrToStaffrel(xmlTurn.node().attribute("placement").as_string()));
turn->SetForm(turnLog_FORM_upper);
for (pugi::xml_node xmlAccidMark = xmlTurn.node().next_sibling("accidental-mark"); xmlAccidMark;
xmlAccidMark = xmlAccidMark.next_sibling("accidental-mark")) {
xmlAccidMark = xmlAccidMark.next_sibling("accidental-mark")) {
if (HasAttributeWithValue(xmlAccidMark, "placement", "above")) {
turn->SetAccidupper(ConvertAccidentalToAccid(xmlAccidMark.text().as_string()));
}
Expand Down Expand Up @@ -4691,7 +4691,7 @@ std::pair<std::vector<int>, int> MusicXmlInput::GetMeterSigGrpValues(const pugi:
int maxUnit = 0;
std::vector<int> meterCounts;
for (auto iter1 = beats.begin(), iter2 = beat_type.begin(); (iter1 != beats.end()) && (iter2 != beat_type.end());
++iter1, ++iter2) {
++iter1, ++iter2) {
// Process current beat/beat-type combination and add it to the meterSigGrp
MeterSig *meterSig = new MeterSig();
data_METERCOUNT_pair count = meterSig->AttMeterSigLog::StrToMetercountPair(iter1->node().text().as_string());
Expand Down Expand Up @@ -4739,8 +4739,8 @@ std::string MusicXmlInput::GetOrnamentGlyphNumber(int attributes) const
static std::map<int, std::string> precomposedNames = {
{ APPR_Above | FORM_Inverted, "U+E5C6" }, { APPR_Below | FORM_Inverted, "U+E5B5" },
{ APPR_Above | FORM_Normal, "U+E5C7" }, { APPR_Below | FORM_Normal, "U+E5B8" },
{ FORM_Inverted | DEP_Above, "U+E5BB" }, { FORM_Inverted | DEP_Below, "U+E5C8" }
// these values need to be matched with proper SMuFL codes first
{ FORM_Inverted | DEP_Above, "U+E5BB" },
{ FORM_Inverted | DEP_Below, "U+E5C8" } // these values need to be matched with proper SMuFL codes first
/*, { FORM_Normal | DEP_Above, "U+????" },
{ FORM_Normal | DEP_Below, "U+????" }, { APPR_Above | FORM_Normal | DEP_Above, "U+????" },
{ APPR_Above | FORM_Normal | DEP_Above, "U+????" }, { APPR_Above | FORM_Normal | DEP_Below, "U+????" },
Expand Down

0 comments on commit ee5e353

Please sign in to comment.