Verovio
Source code documentation
barline.h
1 // Name: barline.h
3 // Author: Laurent Pugin
4 // Created: 2011
5 // Copyright (c) Authors and others. All rights reserved.
7 
8 #ifndef __VRV_BARLINE_H__
9 #define __VRV_BARLINE_H__
10 
11 #include "atts_shared.h"
12 #include "atts_visual.h"
13 #include "layerelement.h"
14 
15 namespace vrv {
16 
17 class StaffDef;
18 class StaffGrp;
19 
20 enum class BarLinePosition { None, Left, Right };
21 
22 //----------------------------------------------------------------------------
23 // BarLine
24 //----------------------------------------------------------------------------
25 
29 class BarLine : public LayerElement,
30  public AttBarLineLog,
31  public AttBarLineVis,
32  public AttColor,
33  public AttNNumberLike,
34  public AttVisibility {
35 public:
41  BarLine();
42  BarLine(ClassId classId);
43  virtual ~BarLine();
44  Object *Clone() const override { return new BarLine(*this); }
45  void Reset() override;
46  std::string GetClassName() const override { return "barLine"; }
48 
50  bool HasToBeAligned() const override { return true; }
51 
56  bool SetAlignment(Alignment *alignment);
57 
58  /*
59  * Return true if the barLine type requires repetition dots to be drawn.
60  */
61  bool HasRepetitionDots() const;
62 
67  BarLinePosition GetPosition() const { return m_position; }
68  void SetPosition(BarLinePosition position) { m_position = position; }
70 
74  bool IsDrawnThrough(const StaffGrp *staffGrp) const;
75 
81  std::pair<bool, double> GetLengthFromContext(const StaffDef *staffDef) const;
82  std::pair<bool, data_BARMETHOD> GetMethodFromContext(const StaffDef *staffDef) const;
83  std::pair<bool, int> GetPlaceFromContext(const StaffDef *staffDef) const;
85 
86  //----------//
87  // Functors //
88  //----------//
89 
94  FunctorCode Accept(Functor &functor) override;
95  FunctorCode Accept(ConstFunctor &functor) const override;
96  FunctorCode AcceptEnd(Functor &functor) override;
97  FunctorCode AcceptEnd(ConstFunctor &functor) const override;
99 
100 private:
101  //
102 public:
103  //
104 private:
106  BarLinePosition m_position;
107 };
108 
109 } // namespace vrv
110 
111 #endif
This class stores an alignment position elements will point to.
Definition: horizontalaligner.h:73
This class models the MEI <barLine> element.
Definition: barline.h:34
bool HasToBeAligned() const override
Override the method since alignment is required.
Definition: barline.h:50
void Reset() override
Reset the object, that is 1) removing all children and 2) resetting all attributes.
bool IsDrawnThrough(const StaffGrp *staffGrp) const
Check if the barline is drawn through.
bool SetAlignment(Alignment *alignment)
Use to set the alignment for the Measure BarLine members.
FunctorCode Accept(Functor &functor) override
Interface for class functor visitation.
Object * Clone() const override
Method call for copying child classes.
Definition: barline.h:44
This abstract class is the base class for all const functors.
Definition: functor.h:126
This abstract class is the base class for all mutable functors.
Definition: functor.h:101
This class is a base class for the Layer (<layer>) content.
Definition: layerelement.h:51
This class represents a basic object.
Definition: object.h:61
This class represents a MEI staffDef.
Definition: staffdef.h:37
This class represents a MEI staffGrp.
Definition: staffgrp.h:39