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 "options.h"
16 
17 namespace vrv {
18 
19 class ExpansionMap {
20 
21 public:
27  ExpansionMap();
28  virtual ~ExpansionMap();
30 
31  /*
32  * Clear the content of the expansion map.
33  */
34  virtual void Reset();
35 
40 
44  void Expand(const xsdAnyURI_List &expansionList, xsdAnyURI_List &existingList, Object *prevSection);
45 
46  std::vector<std::string> GetExpansionIDsForElement(const std::string &xmlId);
47 
51  void ToJson(std::string &output);
52 
53 private:
54  bool UpdateIDs(Object *object);
55 
56  void GetIDList(Object *object, std::vector<std::string> &idList);
57 
58  void GeneratePredictableIDs(Object *source, Object *target);
59 
61  bool AddExpandedIDToExpansionMap(const std::string &origXmlId, std::string newXmlId);
62 
63 public:
65  std::map<std::string, std::vector<std::string>> m_map;
66 
67 private:
68 };
69 
70 } // namespace vrv
71 
72 #endif /* expansionmap_h */
Definition: expansionmap.h:19
std::map< std::string, std::vector< std::string > > m_map
The expansion map indicates which xmlId has been repeated (expanded) elsewhere.
Definition: expansionmap.h:65
void ToJson(std::string &output)
Write the currentexpansionMap to a JSON string.
void Expand(const xsdAnyURI_List &expansionList, xsdAnyURI_List &existingList, Object *prevSection)
Expand expansion recursively.
bool HasExpansionMap()
Check if m_expansionMap has been filled.
This class represents a basic object.
Definition: object.h:61