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

#include <berryXMLMemento.h>

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

Public Member Functions

 XMLMemento (Poco::XML::Document *document, Poco::XML::Element *elem)
 
 ~XMLMemento ()
 
IMemento::Pointer CopyChild (IMemento::Pointer child)
 
virtual IMemento::Pointer CreateChild (const QString &type) override
 
virtual IMemento::Pointer CreateChild (const QString &type, const QString &id) override
 
virtual IMemento::Pointer GetChild (const QString &type) const override
 
virtual QList< IMemento::PointerGetChildren (const QString &type) const override
 
virtual QString GetType () const override
 
virtual QString GetID () const override
 
virtual bool GetInteger (const QString &key, int &value) const override
 
virtual bool GetFloat (const QString &key, double &value) const override
 
virtual bool GetString (const QString &key, QString &value) const override
 
virtual bool GetBoolean (const QString &key, bool &value) const override
 
virtual QString GetTextData () const override
 
virtual QList< QString > GetAttributeKeys () const override
 
virtual void PutFloat (const QString &key, double value) override
 
virtual void PutInteger (const QString &key, int value) override
 
virtual void PutMemento (IMemento::Pointer memento) override
 
virtual void PutString (const QString &key, const QString &value) override
 
virtual void PutBoolean (const QString &key, bool value) override
 
virtual 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) static const QString TAG_ID
 
virtual ~IMemento ()
 
- 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 ()
 

Public Attributes

berryObjectMacro(XMLMemento) typedef std typedef std::istream XMLByteInputStream
 

Additional Inherited Members

- 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
 
- 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 41 of file berryXMLMemento.h.

Constructor & Destructor Documentation

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
elementthe element node for the memento

Definition at line 38 of file berryXMLMemento.cpp.

berry::XMLMemento::~XMLMemento ( )

Definition at line 46 of file berryXMLMemento.cpp.

Member Function Documentation

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

Copies another Memento into this memento

Parameters
childthe new child memento
Returns
the new child memento

Definition at line 130 of file berryXMLMemento.cpp.

References berry::SmartPointer< TObjectType >::Cast().

berry::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.

Definition at line 111 of file berryXMLMemento.cpp.

berry::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.

Definition at line 120 of file berryXMLMemento.cpp.

berry::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.

Definition at line 52 of file berryXMLMemento.cpp.

berry::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.

Definition at line 58 of file berryXMLMemento.cpp.

berry::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

Definition at line 94 of file berryXMLMemento.cpp.

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.

Definition at line 276 of file berryXMLMemento.cpp.

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

Implements berry::IMemento.

Definition at line 237 of file berryXMLMemento.cpp.

berry::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.

Definition at line 142 of file berryXMLMemento.cpp.

QList< berry::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.

Definition at line 156 of file berryXMLMemento.cpp.

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

Returns the element of the memento

Returns
the xml element

Definition at line 430 of file berryXMLMemento.cpp.

Referenced by PutMemento().

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

Implements berry::IMemento.

Definition at line 173 of file berryXMLMemento.cpp.

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

Returns the ID of this memento

Implements berry::IMemento.

Definition at line 211 of file berryXMLMemento.cpp.

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

Implements berry::IMemento.

Definition at line 217 of file berryXMLMemento.cpp.

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

Implements berry::IMemento.

Definition at line 254 of file berryXMLMemento.cpp.

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.

Definition at line 264 of file berryXMLMemento.cpp.

References EMPTY_STRING.

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

Returns the Type of this memento

Implements berry::IMemento.

Definition at line 206 of file berryXMLMemento.cpp.

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

Puts a boolean in this memento

Parameters
keythe key
valuethe value

Implements berry::IMemento.

Definition at line 391 of file berryXMLMemento.cpp.

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

Puts a float in this memento

Parameters
keythe key
valuethe value

Implements berry::IMemento.

Definition at line 363 of file berryXMLMemento.cpp.

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

Puts a integer in this memento

Parameters
keythe key
valuethe value

Implements berry::IMemento.

Definition at line 369 of file berryXMLMemento.cpp.

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

Puts another memento in this memento as a child

Parameters
keythe key
valuethe value

Implements berry::IMemento.

Definition at line 375 of file berryXMLMemento.cpp.

References berry::SmartPointer< TObjectType >::Cast(), and GetElement().

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.

Definition at line 382 of file berryXMLMemento.cpp.

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

Puts a text in this memento

Parameters
datathe text

Implements berry::IMemento.

Definition at line 403 of file berryXMLMemento.cpp.

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.

Definition at line 417 of file berryXMLMemento.cpp.

Member Data Documentation

berryObjectMacro (XMLMemento) typedef std typedef std::istream berry::XMLMemento::XMLByteInputStream

Defines a std::ostream as XML output stream Defines a std::istream as XML input stream

Definition at line 45 of file berryXMLMemento.h.


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