Verovio
Source code documentation
linkinginterface.h
1 // Name: linkinginterface.h
3 // Author: Laurent Pugin
4 // Created: 2018
5 // Copyright (c) Authors and others. All rights reserved.
7 
8 #ifndef __VRV_LINKING_INTERFACE_H__
9 #define __VRV_LINKING_INTERFACE_H__
10 
11 #include "atts_shared.h"
12 #include "interface.h"
13 #include "vrvdef.h"
14 
15 namespace vrv {
16 
17 class Measure;
18 class Object;
19 class PrepareLinkingFunctor;
20 class PrepareStaffCurrentTimeSpanningFunctor;
21 class ResetDataFunctor;
22 
23 //----------------------------------------------------------------------------
24 // LinkingInterface
25 //----------------------------------------------------------------------------
26 
31 class LinkingInterface : public Interface, public AttLinking {
32 public:
39  virtual ~LinkingInterface();
40  void Reset() override;
41  InterfaceId IsInterface() const override { return INTERFACE_LINKING; }
43 
49  void SetNextLink(Object *next);
50  Object *GetNextLink() { return m_next; }
51  const Object *GetNextLink() const { return m_next; }
52  void SetSameasLink(Object *sameas);
53  Object *GetSameasLink() { return m_sameas; }
54  const Object *GetSameasLink() const { return m_sameas; }
56 
61  bool HasNextLink() const { return (m_next); }
62  bool HasSameasLink() const { return (m_sameas); }
64 
70  const Measure *GetNextMeasure() const;
72 
76  void AddBackLink(const Object *object);
77 
78  //-----------------//
79  // Pseudo functors //
80  //-----------------//
81 
88  FunctorCode InterfacePrepareLinking(PrepareLinkingFunctor &functor, Object *object);
89  FunctorCode InterfacePrepareStaffCurrentTimeSpanning(
91  FunctorCode InterfaceResetData(ResetDataFunctor &functor, Object *object);
93 
94 protected:
98  void SetIDStr();
99 
100 private:
101  //
102 public:
103  //
104 private:
105  Object *m_next;
106  std::string m_nextID;
107  Object *m_sameas;
108  std::string m_sameasID;
109 };
110 
111 } // namespace vrv
112 
113 #endif
This is a base class for regrouping MEI att classes.
Definition: interface.h:32
This class is an interface for elements having a link It is not an abstract class but should not be i...
Definition: linkinginterface.h:31
void SetIDStr()
Extract the fragment of the start or end @xml:id if given.
bool HasNextLink() const
Return true if a object is given and resolved.
Definition: linkinginterface.h:61
void Reset() override
Virtual reset method.
void AddBackLink(const Object *object)
Set @corresp attribute to the ID (or @corresp) of the object.
InterfaceId IsInterface() const override
Virtual method returning the InterfaceId of the interface.
Definition: linkinginterface.h:41
FunctorCode InterfacePrepareLinking(PrepareLinkingFunctor &functor, Object *object)
We have functor code in the interface for avoiding code duplication in each implementation class.
Measure * GetNextMeasure()
Return the start measure of the next object (if any, NULL otherwise)
This class represents a measure in a page-based score (Doc).
Definition: measure.h:46
This class represents a basic object.
Definition: object.h:61
This class matches linking elements (e.g, @next).
Definition: preparedatafunctor.h:253
This class goes through all the TimeSpanningInterface elements and sets them for each staff that is c...
Definition: preparedatafunctor.h:978
This class resets the drawing values before calling PrepareData after changes.
Definition: resetfunctor.h:22