Medical Imaging Interaction Toolkit  2024.06.00
Medical Imaging Interaction Toolkit
berry::XMLMemento Class Reference

#include <berryXMLMemento.h>

Inheritance diagram for berry::XMLMemento:
Collaboration diagram for berry::XMLMemento:

Public Types

typedef std::ostream XMLByteOutputStream
 
typedef std::istream XMLByteInputStream
 
- Public Types inherited from berry::Object
typedef Object Self
 
typedef berry::SmartPointer< SelfPointer
 
typedef berry::SmartPointer< const SelfConstPointer
 
typedef berry::WeakPointer< SelfWeakPtr
 
typedef berry::WeakPointer< const SelfConstWeakPtr
 

Public Member Functions

 berryObjectMacro (XMLMemento)
 
 XMLMemento (Poco::XML::Document *document, Poco::XML::Element *elem)
 
 ~XMLMemento () override
 
IMemento::Pointer CopyChild (IMemento::Pointer child)
 
IMemento::Pointer CreateChild (const QString &type) override
 
IMemento::Pointer CreateChild (const QString &type, const QString &id) override
 
IMemento::Pointer GetChild (const QString &type) const override
 
QList< IMemento::PointerGetChildren (const QString &type) const override
 
QString GetType () const override
 
QString GetID () const override
 
bool GetInteger (const QString &key, int &value) const override
 
bool GetFloat (const QString &key, double &value) const override
 
bool GetString (const QString &key, QString &value) const override
 
bool GetBoolean (const QString &key, bool &value) const override
 
QString GetTextData () const override
 
QList< QString > GetAttributeKeys () const override
 
void PutFloat (const QString &key, double value) override
 
void PutInteger (const QString &key, int value) override
 
void PutMemento (IMemento::Pointer memento) override
 
void PutString (const QString &key, const QString &value) override
 
void PutBoolean (const QString &key, bool value) override
 
void PutTextData (const QString &data) override
 
void Save (XMLByteOutputStream &writer)
 
virtual Poco::XML::Element * GetElement () const
 
- Public Member Functions inherited from berry::IMemento
 berryObjectMacro (berry::IMemento)
 
 ~IMemento () override
 
- Public Member Functions inherited from berry::Object
virtual QString GetClassName () const
 
virtual Reflection::TypeInfo GetTypeInfo () const
 
virtual QList< Reflection::TypeInfoGetSuperclasses () const
 
virtual void Delete ()
 
QDebug Print (QDebug os, Indent Indent=0) const
 
virtual QString ToString () const
 
virtual uint HashCode () const
 
virtual bool operator< (const Object *) const
 
void Register () const
 
void UnRegister (bool del=true) const
 
int GetReferenceCount () const
 
void SetReferenceCount (int)
 
void AddDestroyListener (const MessageAbstractDelegate<> &delegate) const
 
void RemoveDestroyListener (const MessageAbstractDelegate<> &delegate) const
 
virtual bool operator== (const Object *) const
 

Static Public Member Functions

static XMLMemento::Pointer CreateReadRoot (berry::XMLMemento::XMLByteInputStream &reader)
 
static XMLMemento::Pointer CreateReadRoot (berry::XMLMemento::XMLByteInputStream &reader, const QString &baseDir)
 
static XMLMemento::Pointer CreateWriteRoot (const QString &type)
 
- Static Public Member Functions inherited from berry::Object
static const char * GetStaticClassName ()
 
static Reflection::TypeInfo GetStaticTypeInfo ()
 
static QList< Reflection::TypeInfoGetStaticSuperclasses ()
 

Additional Inherited Members

- Static Public Attributes inherited from berry::IMemento
static const QString TAG_ID
 
- Protected Member Functions inherited from berry::Object
 Object ()
 
virtual ~Object ()
 
virtual QDebug PrintSelf (QDebug os, Indent indent) const
 
virtual QDebug PrintHeader (QDebug os, Indent indent) const
 
virtual QDebug PrintTrailer (QDebug os, Indent indent) const
 
- Protected Attributes inherited from berry::Object
QAtomicInt m_ReferenceCount
 
QMutex m_ReferenceCountLock
 

Detailed Description

This class represents the default implementation of the IMemento interface.

This class is not intended to be extended by clients.

See also
IMemento

Definition at line 37 of file berryXMLMemento.h.

Member Typedef Documentation

◆ XMLByteInputStream

Defines a std::istream as XML input stream

Definition at line 51 of file berryXMLMemento.h.

◆ XMLByteOutputStream

Defines a std::ostream as XML output stream

Definition at line 46 of file berryXMLMemento.h.

Constructor & Destructor Documentation

◆ XMLMemento()

berry::XMLMemento::XMLMemento ( Poco::XML::Document *  document,
Poco::XML::Element *  elem 
)

Creates a memento for the specified document and element.

Clients should use CreateReadRoot and CreateWriteRoot to create the initial memento on a document.

Parameters
documentthe document for the memento
elemthe element node for the memento

◆ ~XMLMemento()

berry::XMLMemento::~XMLMemento ( )
override

Member Function Documentation

◆ berryObjectMacro()

berry::XMLMemento::berryObjectMacro ( XMLMemento  )

◆ CopyChild()

IMemento::Pointer berry::XMLMemento::CopyChild ( IMemento::Pointer  child)

Copies another Memento into this memento

Parameters
childthe new child memento
Returns
the new child memento

◆ CreateChild() [1/2]

IMemento::Pointer berry::XMLMemento::CreateChild ( const QString &  type)
overridevirtual

Creates a new child of this memento with the given type

Parameters
typethe type
Returns
a new child memento with the given type

Implements berry::IMemento.

◆ CreateChild() [2/2]

IMemento::Pointer berry::XMLMemento::CreateChild ( const QString &  type,
const QString &  id 
)
overridevirtual

Creates a new child of this memento with the given type and id. The id is stored in the child memento (using a special reserved key, TAG_ID) and can be retrieved using getId.

The getChild and getChildren methods are used to retrieve children of a given type.

Parameters
typethe type
idthe child id
Returns
a new child memento with the given type and id
See also
GetID

Implements berry::IMemento.

◆ CreateReadRoot() [1/2]

static XMLMemento::Pointer berry::XMLMemento::CreateReadRoot ( berry::XMLMemento::XMLByteInputStream reader)
static

Creates a Document from the Reader and returns a memento on the first Element for reading the document.

Parameters
readerthe Reader used to create the memento's document
Returns
a memento on the first Element for reading the document
Exceptions
WorkbenchExceptionif IO problems, invalid format, or no element.

◆ CreateReadRoot() [2/2]

static XMLMemento::Pointer berry::XMLMemento::CreateReadRoot ( berry::XMLMemento::XMLByteInputStream reader,
const QString &  baseDir 
)
static

Creates a Document from the Reader and returns a memento on the first Element for reading the document.

Parameters
readerthe Reader used to create the memento's document
baseDirthe directory used to resolve relative file names in the XML document. This directory must exist and include the trailing separator. The directory format, including the separators, must be valid for the platform. Can be null if not needed.
Returns
a memento on the first Element for reading the document
Exceptions
WorkbenchExceptionif IO problems, invalid format, or no element.

◆ CreateWriteRoot()

static XMLMemento::Pointer berry::XMLMemento::CreateWriteRoot ( const QString &  type)
static

Returns a root memento for writing a document.

Parameters
typethe element node type to create on the document
Returns
the root memento for writing a document

◆ GetAttributeKeys()

QList< QString > berry::XMLMemento::GetAttributeKeys ( ) const
overridevirtual

Returns an array of all the attribute keys of the memento. This will not be null. If there are no keys, an array of length zero will be returned.

Returns
an vector with all the attribute keys of the memento

Implements berry::IMemento.

◆ GetBoolean()

bool berry::XMLMemento::GetBoolean ( const QString &  key,
bool &  value 
) const
overridevirtual
See also
IMemento::GetString

Implements berry::IMemento.

◆ GetChild()

IMemento::Pointer berry::XMLMemento::GetChild ( const QString &  type) const
overridevirtual

Returns the first child with the given type id.

Parameters
typethe type id
Returns
the first child with the given type

Implements berry::IMemento.

◆ GetChildren()

QList< IMemento::Pointer > berry::XMLMemento::GetChildren ( const QString &  type) const
overridevirtual

Returns all children with the given type id.

Parameters
typethe type id
Returns
an array of children with the given type

Implements berry::IMemento.

◆ GetElement()

virtual Poco::XML::Element* berry::XMLMemento::GetElement ( ) const
virtual

Returns the element of the memento

Returns
the xml element

◆ GetFloat()

bool berry::XMLMemento::GetFloat ( const QString &  key,
double &  value 
) const
overridevirtual
See also
IMemento::GetFloat

Implements berry::IMemento.

◆ GetID()

QString berry::XMLMemento::GetID ( ) const
overridevirtual

Returns the ID of this memento

Implements berry::IMemento.

◆ GetInteger()

bool berry::XMLMemento::GetInteger ( const QString &  key,
int &  value 
) const
overridevirtual

◆ GetString()

bool berry::XMLMemento::GetString ( const QString &  key,
QString &  value 
) const
overridevirtual
See also
IMemento::GetString

Implements berry::IMemento.

◆ GetTextData()

QString berry::XMLMemento::GetTextData ( ) const
overridevirtual

Returns the data of the Text node of the memento. Each memento is allowed only one Text node.

Returns
the data of the Text node of the memento, or null if the memento has no Text node.

Implements berry::IMemento.

◆ GetType()

QString berry::XMLMemento::GetType ( ) const
overridevirtual

Returns the Type of this memento

Implements berry::IMemento.

◆ PutBoolean()

void berry::XMLMemento::PutBoolean ( const QString &  key,
bool  value 
)
overridevirtual

Puts a boolean in this memento

Parameters
keythe key
valuethe value

Implements berry::IMemento.

◆ PutFloat()

void berry::XMLMemento::PutFloat ( const QString &  key,
double  value 
)
overridevirtual

Puts a float in this memento

Parameters
keythe key
valuethe value

Implements berry::IMemento.

◆ PutInteger()

void berry::XMLMemento::PutInteger ( const QString &  key,
int  value 
)
overridevirtual

Puts a integer in this memento

Parameters
keythe key
valuethe value

Implements berry::IMemento.

◆ PutMemento()

void berry::XMLMemento::PutMemento ( IMemento::Pointer  memento)
overridevirtual

Puts another memento in this memento as a child

Parameters
memento

Implements berry::IMemento.

◆ PutString()

void berry::XMLMemento::PutString ( const QString &  key,
const QString &  value 
)
overridevirtual

Puts a string in this memento

Parameters
keythe key
valuethe value

Implements berry::IMemento.

◆ PutTextData()

void berry::XMLMemento::PutTextData ( const QString &  data)
overridevirtual

Puts a text in this memento

Parameters
datathe text

Implements berry::IMemento.

◆ Save()

void berry::XMLMemento::Save ( XMLByteOutputStream writer)

Saves this memento's document current values to the specified writer.

Parameters
writerthe writer used to save the memento's document
Exceptions
IOExceptionif there is a problem serializing the document to the stream.

The documentation for this class was generated from the following file: