Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkXML2EventParser.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkXML2EventParser_h
14 #define mitkXML2EventParser_h
15 
16 #include <MitkCoreExports.h>
17 
18 #include <mitkPropertyList.h>
19 
20 #include <vtkXMLParser.h>
21 
22 #include <mitkInteractionEvent.h>
23 
24 namespace us
25 {
26  class Module;
27 }
28 
29 namespace mitk
30 {
41  class MITKCORE_EXPORT XML2EventParser : public vtkXMLParser
42  {
43  public:
54  XML2EventParser(const std::string &filename, const us::Module *module = nullptr);
55 
65  XML2EventParser(std::istream &inputStream);
66 
68  typedef std::vector<mitk::InteractionEvent::Pointer> EventContainerType;
69 
75  EventContainerType GetInteractions() { return m_InteractionList; }
76 
78  ~XML2EventParser() override{};
79 
80  protected:
87  void StartElement(const char *elementName, const char **atts) override;
88 
97  void EndElement(const char *elementName) override;
98 
106  std::string ReadXMLStringAttribute(const std::string &name, const char **atts);
107 
117  bool ReadXMLBooleanAttribute(const std::string &name, const char **atts);
118 
119  private:
120  PropertyList::Pointer m_EventPropertyList;
121 
122  EventContainerType m_InteractionList;
123  };
124 
125 } // namespace mitk
126 
127 #endif
#define MITKCORE_EXPORT
Generates a list of InteractionEvents by parsing an XML file.
std::string ReadXMLStringAttribute(const std::string &name, const char **atts)
Read a string attribute value from the XML attribute array.
std::vector< mitk::InteractionEvent::Pointer > EventContainerType
Container type for the parsed interaction events.
void EndElement(const char *elementName) override
Handle the end of an XML element during parsing.
bool ReadXMLBooleanAttribute(const std::string &name, const char **atts)
Read a boolean attribute value from the XML attribute array.
XML2EventParser(std::istream &inputStream)
Construct an InteractionEventList object from an input stream.
XML2EventParser(const std::string &filename, const us::Module *module=nullptr)
Construct an InteractionEventList object from an XML resource file.
void StartElement(const char *elementName, const char **atts) override
Handle the start of an XML element during parsing.
~XML2EventParser() override
Destructor.
EventContainerType GetInteractions()
Get the list of parsed interaction events.
Represents a CppMicroServices module.
Definition: usModule.h:70
Find image slices visible on a given plane.