-
Notifications
You must be signed in to change notification settings - Fork 186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for MEI cpMark #3904
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
///////////////////////////////////////////////////////////////////////////// | ||
// Name: cpmark.h | ||
// Author: Laurent Pugin | ||
// Created: 2024 | ||
// Copyright (c) Authors and others. All rights reserved. | ||
///////////////////////////////////////////////////////////////////////////// | ||
|
||
#ifndef __VRV_CPMARK_H__ | ||
#define __VRV_CPMARK_H__ | ||
|
||
#include "controlelement.h" | ||
#include "textdirinterface.h" | ||
#include "timeinterface.h" | ||
|
||
namespace vrv { | ||
|
||
class TextElement; | ||
|
||
//---------------------------------------------------------------------------- | ||
// CpMark (copy/colla parte mark) | ||
//---------------------------------------------------------------------------- | ||
|
||
/** | ||
* This class models the MEI <cpMark> element. | ||
*/ | ||
class CpMark : public ControlElement, public TextListInterface, public TextDirInterface, public TimeSpanningInterface { | ||
public: | ||
/** | ||
* @name Constructors, destructors, and other standard methods | ||
* Reset method reset all attribute classes | ||
*/ | ||
///@{ | ||
CpMark(); | ||
virtual ~CpMark(); | ||
Object *Clone() const override { return new CpMark(*this); } | ||
void Reset() override; | ||
std::string GetClassName() const override { return "CpMark"; } | ||
///@} | ||
|
||
/** | ||
* @name Getter to interfaces | ||
*/ | ||
///@{ | ||
TextDirInterface *GetTextDirInterface() override { return vrv_cast<TextDirInterface *>(this); } | ||
const TextDirInterface *GetTextDirInterface() const override { return vrv_cast<const TextDirInterface *>(this); } | ||
TimePointInterface *GetTimePointInterface() override { return vrv_cast<TimePointInterface *>(this); } | ||
const TimePointInterface *GetTimePointInterface() const override | ||
{ | ||
return vrv_cast<const TimePointInterface *>(this); | ||
} | ||
TimeSpanningInterface *GetTimeSpanningInterface() override { return vrv_cast<TimeSpanningInterface *>(this); } | ||
const TimeSpanningInterface *GetTimeSpanningInterface() const override | ||
{ | ||
return vrv_cast<const TimeSpanningInterface *>(this); | ||
} | ||
///@} | ||
|
||
/** | ||
* Add an element (text, rend. etc.) to a cpMark. | ||
* Only supported elements will be actually added to the child list. | ||
*/ | ||
bool IsSupportedChild(Object *object) override; | ||
|
||
//----------// | ||
// Functors // | ||
//----------// | ||
|
||
/** | ||
* Interface for class functor visitation | ||
*/ | ||
///@{ | ||
FunctorCode Accept(Functor &functor) override; | ||
FunctorCode Accept(ConstFunctor &functor) const override; | ||
FunctorCode AcceptEnd(Functor &functor) override; | ||
FunctorCode AcceptEnd(ConstFunctor &functor) const override; | ||
///@} | ||
|
||
protected: | ||
// | ||
private: | ||
// | ||
public: | ||
// | ||
private: | ||
// | ||
}; | ||
|
||
} // namespace vrv | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -181,6 +181,7 @@ enum ClassId : uint16_t { | |
BRACKETSPAN, | ||
BREATH, | ||
CAESURA, | ||
CPMARK, | ||
DIR, | ||
DYNAM, | ||
FERMATA, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
///////////////////////////////////////////////////////////////////////////// | ||
// Name: cpmark.cpp | ||
// Author: Laurent Pugin | ||
// Created: 2024 | ||
// Copyright (c) Authors and others. All rights reserved. | ||
///////////////////////////////////////////////////////////////////////////// | ||
|
||
#include "cpmark.h" | ||
|
||
//---------------------------------------------------------------------------- | ||
|
||
#include <cassert> | ||
|
||
//---------------------------------------------------------------------------- | ||
|
||
#include "comparison.h" | ||
#include "editorial.h" | ||
#include "functor.h" | ||
#include "symbol.h" | ||
#include "text.h" | ||
#include "verticalaligner.h" | ||
#include "vrv.h" | ||
|
||
namespace vrv { | ||
|
||
//---------------------------------------------------------------------------- | ||
// CpMark | ||
//---------------------------------------------------------------------------- | ||
|
||
static const ClassRegistrar<CpMark> s_factory("cpMark", CPMARK); | ||
|
||
CpMark::CpMark() : ControlElement(CPMARK, "cpmark-"), TextListInterface(), TextDirInterface(), TimeSpanningInterface() | ||
{ | ||
this->RegisterInterface(TextDirInterface::GetAttClasses(), TextDirInterface::IsInterface()); | ||
this->RegisterInterface(TimeSpanningInterface::GetAttClasses(), TimeSpanningInterface::IsInterface()); | ||
|
||
this->Reset(); | ||
} | ||
|
||
CpMark::~CpMark() {} | ||
|
||
void CpMark::Reset() | ||
{ | ||
ControlElement::Reset(); | ||
TextDirInterface::Reset(); | ||
TimeSpanningInterface::Reset(); | ||
} | ||
|
||
bool CpMark::IsSupportedChild(Object *child) | ||
{ | ||
if (child->Is({ LB, REND, SYMBOL, TEXT })) { | ||
assert(dynamic_cast<TextElement *>(child)); | ||
} | ||
else if (child->IsEditorialElement()) { | ||
assert(dynamic_cast<EditorialElement *>(child)); | ||
} | ||
else { | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
//---------------------------------------------------------------------------- | ||
// CpMark functor methods | ||
//---------------------------------------------------------------------------- | ||
|
||
FunctorCode CpMark::Accept(Functor &functor) | ||
{ | ||
return functor.VisitCpMark(this); | ||
} | ||
|
||
FunctorCode CpMark::Accept(ConstFunctor &functor) const | ||
{ | ||
return functor.VisitCpMark(this); | ||
} | ||
|
||
FunctorCode CpMark::AcceptEnd(Functor &functor) | ||
{ | ||
return functor.VisitCpMarkEnd(this); | ||
} | ||
|
||
FunctorCode CpMark::AcceptEnd(ConstFunctor &functor) const | ||
{ | ||
return functor.VisitCpMarkEnd(this); | ||
} | ||
|
||
} // namespace vrv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use
else if
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree it looks unusual. But since we continue on success it would make no difference and it is a bit more compact like that.