Verovio
Source code documentation
plistinterface.h
1 // Name: plistinterface.h
3 // Author: Laurent Pugin
4 // Created: 2017
5 // Copyright (c) Authors and others. All rights reserved.
7 
8 #ifndef __VRV_PLIST_INTERFACE_H__
9 #define __VRV_PLIST_INTERFACE_H__
10 
11 #include "atts_shared.h"
12 #include "interface.h"
13 #include "vrvdef.h"
14 
15 namespace vrv {
16 
17 class Object;
18 class PreparePlistFunctor;
19 class ResetDataFunctor;
20 
21 //----------------------------------------------------------------------------
22 // PlistInterface
23 //----------------------------------------------------------------------------
24 
29 class PlistInterface : public Interface, public AttPlist {
30 public:
37  virtual ~PlistInterface();
38  void Reset() override;
39  InterfaceId IsInterface() const override { return INTERFACE_PLIST; }
41 
45  void AddRef(const std::string &ref);
46 
50  void AddRefAllowDuplicate(const std::string &ref);
51 
56  void SetRef(const Object *object);
57 
62  ArrayOfObjects GetRefs();
63  const ArrayOfConstObjects &GetRefs() const { return m_references; }
65 
66  //-----------------//
67  // Pseudo functors //
68  //-----------------//
69 
76  FunctorCode InterfacePreparePlist(PreparePlistFunctor &functor, Object *object);
77  FunctorCode InterfaceResetData(ResetDataFunctor &functor, Object *object);
79 
80 protected:
84  void SetIDStrs();
85 
90  virtual bool IsValidRef(const Object *ref) const { return true; }
91 
92 private:
93  //
94 public:
95  //
96 protected:
97 private:
102  ArrayOfConstObjects m_references;
103 
108  std::vector<std::string> m_ids;
109 };
110 
111 } // namespace vrv
112 
113 #endif
This is a base class for regrouping MEI att classes.
Definition: interface.h:32
This class represents a basic object.
Definition: object.h:61
This class is an interface for elements having a single time point, such as tempo,...
Definition: plistinterface.h:29
InterfaceId IsInterface() const override
Virtual method returning the InterfaceId of the interface.
Definition: plistinterface.h:39
void AddRef(const std::string &ref)
Add a reference ref to the AttPlist vector (if not already there)
void Reset() override
Virtual reset method.
FunctorCode InterfacePreparePlist(PreparePlistFunctor &functor, Object *object)
We have functor code in the interface for avoiding code duplication in each implementation class.
void AddRefAllowDuplicate(const std::string &ref)
Add a reference, not checking if it is already in the list (for expansion@plist).
ArrayOfObjects GetRefs()
Retrieve all reference objects.
virtual bool IsValidRef(const Object *ref) const
Method to be redefined in the child class if specific validation is required.
Definition: plistinterface.h:90
void SetRef(const Object *object)
Set a reference object when the id is found in the m_ids.
void SetIDStrs()
Extract the fragment of the any URIs given in @plist.
This class matches elements of @plist.
Definition: preparedatafunctor.h:321
This class resets the drawing values before calling PrepareData after changes.
Definition: resetfunctor.h:22