Verovio
Source code documentation
staffgrp.h
1 // Name: staffgrp.h
3 // Author: Laurent Pugin
4 // Created: 2017
5 // Copyright (c) Authors and others. All rights reserved.
7 
8 #ifndef __VRV_STAFFGRP_H__
9 #define __VRV_STAFFGRP_H__
10 
11 #include "atts_mei.h"
12 #include "atts_shared.h"
13 #include "atts_visual.h"
14 #include "grpsym.h"
15 #include "object.h"
16 #include "staffdef.h"
17 
18 namespace vrv {
19 
20 class Label;
21 class LabelAbbr;
22 
23 //----------------------------------------------------------------------------
24 // StaffGrp
25 //----------------------------------------------------------------------------
26 
31 class StaffGrp : public Object,
32  public ObjectListInterface,
33  public AttBarring,
34  public AttBasic,
35  public AttLabelled,
36  public AttNNumberLike,
37  public AttStaffGroupingSym,
38  public AttStaffGrpVis,
39  public AttTyped {
40 public:
46  StaffGrp();
47  virtual ~StaffGrp();
48  Object *Clone() const override { return new StaffGrp(*this); }
49  void Reset() override;
50  std::string GetClassName() const override { return "staffGrp"; }
52 
57  bool IsSupportedChild(ClassId classId) override;
59 
63  int GetInsertOrderFor(ClassId classId) const override;
64 
69  VisibilityOptimization GetDrawingVisibility() const { return m_drawingVisibility; }
70  void SetDrawingVisibility(VisibilityOptimization drawingIsVisible) { m_drawingVisibility = drawingIsVisible; }
72 
77  std::pair<StaffDef *, StaffDef *> GetFirstLastStaffDef();
78  std::pair<const StaffDef *, const StaffDef *> GetFirstLastStaffDef() const;
80 
84  int GetMaxStaffSize() const;
85 
90  void SetGroupSymbol(GrpSym *grpSym);
91  GrpSym *GetGroupSymbol() { return m_groupSymbol; }
92  const GrpSym *GetGroupSymbol() const { return m_groupSymbol; }
94 
99  bool HasLabelInfo() const;
100  bool HasLabelAbbrInfo() const;
101 
103 
109  Label *GetLabel();
110  const Label *GetLabel() const;
111  Label *GetLabelCopy() const;
112  LabelAbbr *GetLabelAbbr();
113  const LabelAbbr *GetLabelAbbr() const;
114  LabelAbbr *GetLabelAbbrCopy() const;
116 
121 
122  //----------//
123  // Functors //
124  //----------//
125 
130  FunctorCode Accept(Functor &functor) override;
131  FunctorCode Accept(ConstFunctor &functor) const override;
132  FunctorCode AcceptEnd(Functor &functor) override;
133  FunctorCode AcceptEnd(ConstFunctor &functor) const override;
135 
136 protected:
140  void FilterList(ListOfConstObjects &childList) const override;
141 
142 private:
143  //
144 public:
145  //
146 private:
153  VisibilityOptimization m_drawingVisibility;
154 
155  GrpSym *m_groupSymbol;
156 };
157 
158 } // namespace vrv
159 
160 #endif
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 represents a MEI grpSym.
Definition: grpsym.h:30
This class represents a basic object.
Definition: object.h:61
This class is an pseudo interface for elements maintaining a flat list of children LayerElement for p...
Definition: object.h:893
This class represents a MEI staffGrp.
Definition: staffgrp.h:39
void Reset() override
Reset the object, that is 1) removing all children and 2) resetting all attributes.
std::pair< StaffDef *, StaffDef * > GetFirstLastStaffDef()
Get first and last staffDef of the staff group without visibility optimization set to hidden.
int GetMaxStaffSize() const
Return the maximum staff size in the staffGrp (100 if empty)
FunctorCode Accept(Functor &functor) override
Interface for class functor visitation.
int GetInsertOrderFor(ClassId classId) const override
Return an order for the given ClassId.
Object * Clone() const override
Method call for copying child classes.
Definition: staffgrp.h:48
void FilterList(ListOfConstObjects &childList) const override
Filter the flat list and keep only StaffDef elements.
void SetEverythingVisible()
Set visibility of the group and all of its nested children to SHOW.
bool IsSupportedChild(ClassId classId) override
Base method for checking if a child can be added.