Verovio
Source code documentation
All Classes Namespaces Functions Variables Typedefs Enumerations Modules
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:
26  ExpansionMap();
28  virtual ~ExpansionMap();
30 
31  /*
32  * Clear the content of the expansion map.
33  */
34  virtual void Reset();
35 
39  bool HasExpansionMap();
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 */
vrv::Object
This class represents a basic object.
Definition: object.h:59
vrv::ExpansionMap::m_map
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
vrv::ExpansionMap::HasExpansionMap
bool HasExpansionMap()
Check if m_expansionMap has been filled.
vrv::ExpansionMap::Expand
void Expand(const xsdAnyURI_List &expansionList, xsdAnyURI_List &existingList, Object *prevSection)
Expand expansion recursively.
vrv::ExpansionMap::ToJson
void ToJson(std::string &output)
Write the currentexpansionMap to a JSON string.
vrv::ExpansionMap
Definition: expansionmap.h:19