Verovio
Source code documentation
expansionmap.h
1 // Name: expansionmap.h
3 // Author: Werner Goebl
4 // Created: 2019
5 // Copyright (c) Authors and others. All rights reserved.
7 
8 #ifndef __VRV_EXPANSION_MAP_H__
9 #define __VRV_EXPANSION_MAP_H__
10 
11 #include <map>
12 
13 //----------------------------------------------------------------------------
14 
15 #include "expansion.h"
16 #include "options.h"
17 
18 namespace vrv {
19 
20 class ExpansionMap {
21 
22 public:
28  ExpansionMap();
29  virtual ~ExpansionMap();
31 
32  /*
33  * Clear the content of the expansion map.
34  */
35  virtual void Reset();
36 
41 
45  void Expand(Expansion *expansion, xsdAnyURI_List &existingList, Object *prevSection, xsdAnyURI_List &deletionList,
46  bool deleteList);
47 
48  std::vector<std::string> GetExpansionIDsForElement(const std::string &xmlId);
49 
53  void ToJson(std::string &output);
54 
55 private:
56  bool UpdateIDs(Object *object);
57 
58  void GetIDList(Object *object, std::vector<std::string> &idList);
59 
60  void GeneratePredictableIDs(Object *source, Object *target);
61 
63  bool AddExpandedIDToExpansionMap(const std::string &origXmlId, std::string newXmlId);
64 
65 public:
67  std::map<std::string, std::vector<std::string>> m_map;
68 
69 private:
70 };
71 
72 } // namespace vrv
73 
74 #endif /* expansionmap_h */
This class represents a MEI expansion.
Definition: expansion.h:26
Definition: expansionmap.h:20
std::map< std::string, std::vector< std::string > > m_map
The expansion map indicates which xmlId has been repeated (expanded) elsewhere.
Definition: expansionmap.h:67
void ToJson(std::string &output)
Write the currentexpansionMap to a JSON string.
void Expand(Expansion *expansion, xsdAnyURI_List &existingList, Object *prevSection, xsdAnyURI_List &deletionList, bool deleteList)
Expand expansion recursively.
bool HasExpansionMap()
Check if m_expansionMap has been filled.
This class represents a basic object.
Definition: object.h:62