Medical Imaging Interaction Toolkit  2024.06.00
Medical Imaging Interaction Toolkit
berryXMLMemento.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 
14 #ifndef BERRYXMLMEMENTO_H_
15 #define BERRYXMLMEMENTO_H_
16 
17 #include <berryMacros.h>
18 #include "berryIMemento.h"
19 #include "berryUIException.h"
20 
21 #include "Poco/DOM/Document.h"
22 #include "Poco/DOM/Element.h"
23 #include "Poco/SAX/XMLReader.h"
24 
25 
26 namespace berry {
27 
38 {
39 
40  public:
42 
46  typedef std::ostream XMLByteOutputStream;
47 
51  typedef std::istream XMLByteInputStream;
52 
64  XMLMemento(Poco::XML::Document* document, Poco::XML::Element* elem);
65 
66  ~XMLMemento() override;
67 
77  static XMLMemento::Pointer CreateReadRoot(berry::XMLMemento::XMLByteInputStream& reader);
78 
93  static XMLMemento::Pointer CreateReadRoot(berry::XMLMemento::XMLByteInputStream& reader, const QString& baseDir);
94 
101  static XMLMemento::Pointer CreateWriteRoot(const QString& type);
102 
109  IMemento::Pointer CopyChild(IMemento::Pointer child);
110 
117  IMemento::Pointer CreateChild(const QString& type) override;
118 
133  IMemento::Pointer CreateChild(const QString& type, const QString& id) override;
134 
141  IMemento::Pointer GetChild(const QString& type) const override;
142 
149  QList< IMemento::Pointer > GetChildren(const QString& type) const override;
150 
154  QString GetType() const override;
155 
159  QString GetID() const override;
160 
164  bool GetInteger(const QString& key, int& value) const override;
165 
169  bool GetFloat(const QString& key, double& value) const override;
170 
174  bool GetString(const QString& key, QString& value) const override;
175 
179  bool GetBoolean(const QString& key, bool& value) const override;
180 
188  QString GetTextData() const override;
189 
196  QList< QString > GetAttributeKeys() const override;
197 
204  void PutFloat(const QString& key, double value) override;
205 
212  void PutInteger(const QString& key, int value) override;
213 
219  void PutMemento(IMemento::Pointer memento) override;
220 
227  void PutString(const QString& key, const QString& value) override;
228 
235  void PutBoolean(const QString& key, bool value) override;
236 
242  void PutTextData(const QString& data) override;
243 
251  void Save(XMLByteOutputStream& writer); //TODO: throw(IOException)
252 
258  virtual Poco::XML::Element* GetElement() const;
259 
260 private:
261 
269  Poco::XML::Text* GetTextNode() const;
270 
275  void PutElement(Poco::XML::Element* element, bool copyText);
276 
277  Poco::XML::Document* factory;
278  Poco::XML::Element* element;
279 
280 };
281 }//namespace berry
282 #endif /* BERRYXMLMEMENTO_H_ */
berry::XMLMemento::XMLByteInputStream
std::istream XMLByteInputStream
Definition: berryXMLMemento.h:51
berryIMemento.h
berryMacros.h
berryUIException.h
berry::SmartPointer
Implements transparent reference counting.
Definition: berryICommandCategoryListener.h:21
berry::XMLMemento::XMLByteOutputStream
std::ostream XMLByteOutputStream
Definition: berryXMLMemento.h:46
BERRY_UI_QT
#define BERRY_UI_QT
Definition: org_blueberry_ui_qt_Export.h:26
berry::IMemento
Definition: berryIMemento.h:58
berryObjectMacro
#define berryObjectMacro(...)
Definition: berryMacros.h:31
berry
Definition: QmitkPropertyItemModel.h:24
berry::XMLMemento
Definition: berryXMLMemento.h:37