MuseScore  3.4
Music composition and notation
eleminfo.h
Go to the documentation of this file.
1 //=============================================================================
2 // MuseScore
3 // Music Composition & Notation
4 //
5 // Copyright (C) 2018 Werner Schweer
6 //
7 // This program is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License version 2
9 // as published by the Free Software Foundation and appearing in
10 // the file LICENCE.GPL
11 //=============================================================================
12 
13 #ifndef __ELEMINFO_H__
14 #define __ELEMINFO_H__
15 
16 #include "location.h"
17 #include "types.h"
18 
19 namespace Ms {
20 
21 class Element;
22 
23 class ElementInfo {
25  int _subtype = -1;
27 
28  public:
29  ElementInfo() = default;
30  explicit ElementInfo(const Element* e) { if (e) fillForElement(e); }
31 
32  ElementType type() const { return _type; }
33  void setType(ElementType t) { _type = t; }
34  int subtype() const { return _subtype; }
35  void setSubtype(int st) { _subtype = st; }
36  const Location& location() const { return _loc; }
37  void setLocation(const Location& loc) { _loc = loc; }
38 
39  void fillForElement(const Element* e);
40 
41  bool operator==(const ElementInfo& other) const { return _type == other._type && _subtype == other._subtype && _loc == other._loc; }
42  bool operator!=(const ElementInfo& other) const { return !(*this == other); }
43  };
44 
45 } // namespace Ms
46 #endif
ElementType _type
Definition: eleminfo.h:24
int _subtype
Definition: eleminfo.h:25
ElementInfo()=default
const Location & location() const
Definition: eleminfo.h:36
Base class of score layout elements.
Definition: element.h:158
void fillForElement(const Element *e)
Definition: eleminfo.cpp:23
void setType(ElementType t)
Definition: eleminfo.h:33
bool operator==(const ElementInfo &other) const
Definition: eleminfo.h:41
ElementType type() const
Definition: eleminfo.h:32
Definition: eleminfo.h:23
static constexpr Location absolute()
Definition: location.h:50
Location _loc
Definition: eleminfo.h:26
int subtype() const
Definition: eleminfo.h:34
Definition: aeolus.cpp:26
Definition: location.h:32
ElementType
Definition: types.h:34
void setSubtype(int st)
Definition: eleminfo.h:35
ElementInfo(const Element *e)
Definition: eleminfo.h:30
void setLocation(const Location &loc)
Definition: eleminfo.h:37
bool operator!=(const ElementInfo &other) const
Definition: eleminfo.h:42