From 43fa8911772cf7a0263e0215484e4f453449e33a Mon Sep 17 00:00:00 2001 From: David Lewis Date: Wed, 29 Jan 2025 09:32:33 +0000 Subject: [PATCH 1/5] Replace AttPlist with PlistInterface in AnnotScore inheritance --- include/vrv/annotscore.h | 7 +++++-- src/annotscore.cpp | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/include/vrv/annotscore.h b/include/vrv/annotscore.h index 549c104e7d..aa19091d44 100644 --- a/include/vrv/annotscore.h +++ b/include/vrv/annotscore.h @@ -12,6 +12,7 @@ #include "atts_shared.h" #include "controlelement.h" #include "editorial.h" +#include "plistinterface.h" #include "timeinterface.h" namespace vrv { @@ -23,7 +24,7 @@ namespace vrv { /** * This class models the MEI element where @type is score. */ -class AnnotScore : public ControlElement, public TimeSpanningInterface, public AttPlist { +class AnnotScore : public ControlElement, public PlistInterface, public TimeSpanningInterface { public: /** * @name Constructors, destructors, and other standard methods @@ -41,7 +42,9 @@ class AnnotScore : public ControlElement, public TimeSpanningInterface, public A * @name Getter to interfaces */ ///@{ - TimePointInterface *GetTimePointInterface() override { return vrv_cast(this); } + PlistInterface *GetPlistInterface() override { return vrv_cast(this); } + const PlistInterface *GetPlistInterface() const override { return vrv_cast(this); } + TimePointInterface *GetTimePointInterface() override { return vrv_cast(this); } const TimePointInterface *GetTimePointInterface() const override { return vrv_cast(this); diff --git a/src/annotscore.cpp b/src/annotscore.cpp index dfa715e2eb..5b6320685c 100644 --- a/src/annotscore.cpp +++ b/src/annotscore.cpp @@ -28,8 +28,9 @@ namespace vrv { static const ClassRegistrar s_factory("annotScore", ANNOTSCORE); -AnnotScore::AnnotScore() : ControlElement(ANNOTSCORE, "annotscore-"), AttPlist() +AnnotScore::AnnotScore() : ControlElement(ANNOTSCORE, "annotscore-"), PlistInterface() { + this->RegisterInterface(PlistInterface::GetAttClasses(), PlistInterface::IsInterface()); this->RegisterInterface(TimeSpanningInterface::GetAttClasses(), TimeSpanningInterface::IsInterface()); this->RegisterAttClass(ATT_PLIST); From 9a98fd25dc1a4107ff23fecb993e75d219e92efc Mon Sep 17 00:00:00 2001 From: David Lewis Date: Wed, 29 Jan 2025 09:34:59 +0000 Subject: [PATCH 2/5] Clang-format linting --- include/vrv/annotscore.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/vrv/annotscore.h b/include/vrv/annotscore.h index aa19091d44..d6d3c54e4d 100644 --- a/include/vrv/annotscore.h +++ b/include/vrv/annotscore.h @@ -44,7 +44,7 @@ class AnnotScore : public ControlElement, public PlistInterface, public TimeSpan ///@{ PlistInterface *GetPlistInterface() override { return vrv_cast(this); } const PlistInterface *GetPlistInterface() const override { return vrv_cast(this); } - TimePointInterface *GetTimePointInterface() override { return vrv_cast(this); } + TimePointInterface *GetTimePointInterface() override { return vrv_cast(this); } const TimePointInterface *GetTimePointInterface() const override { return vrv_cast(this); From ba569ffc8a581449cdd23764bf486d9d5d5e1115 Mon Sep 17 00:00:00 2001 From: David Lewis Date: Wed, 29 Jan 2025 10:06:25 +0000 Subject: [PATCH 3/5] Adjust reset, read and write for use of plist interface. Fix some copy/paste code errors. --- src/annotscore.cpp | 2 +- src/iomei.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/annotscore.cpp b/src/annotscore.cpp index 5b6320685c..24d216ec0a 100644 --- a/src/annotscore.cpp +++ b/src/annotscore.cpp @@ -42,7 +42,7 @@ AnnotScore::~AnnotScore() {} void AnnotScore::Reset() { ControlElement::Reset(); - this->ResetPlist(); + PlistInterface::Reset(); TimeSpanningInterface::Reset(); } diff --git a/src/iomei.cpp b/src/iomei.cpp index daba2f32ab..ae331acc86 100644 --- a/src/iomei.cpp +++ b/src/iomei.cpp @@ -1979,6 +1979,7 @@ void MEIOutput::WriteAnnotScore(pugi::xml_node currentNode, AnnotScore *annotSco assert(annotScore); this->WriteControlElement(currentNode, annotScore); + this->WritePlistInterface(currentNode, annotScore); this->WriteTimePointInterface(currentNode, annotScore); annotScore->WritePlist(currentNode); // Currently ignoring annot contents -- normal annot looks at child elements here @@ -7723,8 +7724,8 @@ bool MEIInput::ReadAnnotScore(Object *parent, pugi::xml_node annot) AnnotScore *vrvAnnotScore = new AnnotScore(); // Note: there probably needs to be more in here (see model methods) - BracketSpan *vrvBracketSpan = new BracketSpan(); - this->ReadControlElement(annot, vrvBracketSpan); + this->ReadControlElement(annot, vrvAnnotScore); + this->ReadPlistInterface(annot, vrvAnnotScore); this->ReadTimeSpanningInterface(annot, vrvAnnotScore); vrvAnnotScore->ReadPlist(annot); From f2db6f99b9df2dbd9d3b0f28a682473472bef872 Mon Sep 17 00:00:00 2001 From: David Lewis Date: Wed, 29 Jan 2025 10:29:49 +0000 Subject: [PATCH 4/5] Remove last vestige of att_plist from annotScore --- src/annotscore.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/annotscore.cpp b/src/annotscore.cpp index 24d216ec0a..c698b1de9a 100644 --- a/src/annotscore.cpp +++ b/src/annotscore.cpp @@ -32,7 +32,6 @@ AnnotScore::AnnotScore() : ControlElement(ANNOTSCORE, "annotscore-"), PlistInter { this->RegisterInterface(PlistInterface::GetAttClasses(), PlistInterface::IsInterface()); this->RegisterInterface(TimeSpanningInterface::GetAttClasses(), TimeSpanningInterface::IsInterface()); - this->RegisterAttClass(ATT_PLIST); this->Reset(); } From ab7fdbce3414e429ac12979a48ef793224dda30d Mon Sep 17 00:00:00 2001 From: David Lewis Date: Wed, 29 Jan 2025 11:47:35 +0000 Subject: [PATCH 5/5] Tidying (inheritence and wrong interface method in ReadAnnotScore) --- src/annotscore.cpp | 2 +- src/iomei.cpp | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/annotscore.cpp b/src/annotscore.cpp index c698b1de9a..f97b31b0d9 100644 --- a/src/annotscore.cpp +++ b/src/annotscore.cpp @@ -28,7 +28,7 @@ namespace vrv { static const ClassRegistrar s_factory("annotScore", ANNOTSCORE); -AnnotScore::AnnotScore() : ControlElement(ANNOTSCORE, "annotscore-"), PlistInterface() +AnnotScore::AnnotScore() : ControlElement(ANNOTSCORE, "annotscore-"), PlistInterface(), TimeSpanningInterface() { this->RegisterInterface(PlistInterface::GetAttClasses(), PlistInterface::IsInterface()); this->RegisterInterface(TimeSpanningInterface::GetAttClasses(), TimeSpanningInterface::IsInterface()); diff --git a/src/iomei.cpp b/src/iomei.cpp index ae331acc86..c01fed8f5d 100644 --- a/src/iomei.cpp +++ b/src/iomei.cpp @@ -1980,7 +1980,7 @@ void MEIOutput::WriteAnnotScore(pugi::xml_node currentNode, AnnotScore *annotSco this->WriteControlElement(currentNode, annotScore); this->WritePlistInterface(currentNode, annotScore); - this->WriteTimePointInterface(currentNode, annotScore); + this->WriteTimeSpanningInterface(currentNode, annotScore); annotScore->WritePlist(currentNode); // Currently ignoring annot contents -- normal annot looks at child elements here } @@ -7722,7 +7722,6 @@ bool MEIInput::ReadAnnot(Object *parent, pugi::xml_node annot) bool MEIInput::ReadAnnotScore(Object *parent, pugi::xml_node annot) { AnnotScore *vrvAnnotScore = new AnnotScore(); - // Note: there probably needs to be more in here (see model methods) this->ReadControlElement(annot, vrvAnnotScore); this->ReadPlistInterface(annot, vrvAnnotScore);