All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Public Types | Public Member Functions | Public Attributes
Qtilities::Core::ObserverData Class Reference

The ObserverData class contains data which is shared by different references of the same observer. More...

#include <ObserverData.h>

Inheritance diagram for Qtilities::Core::ObserverData:
Inheritance graph
[legend]

List of all members.

Public Types

enum  ExportItem { ExportData = 1, ExportVisitorIDs = 2, ExportRelationalData = 4 }
 The possible export flags used during extended observer exports. More...
- Public Types inherited from Qtilities::Core::Interfaces::IExportable
enum  ExportMode { None = 0, Binary = 1, XML = 2 }
 Possible export modes that an implementation of IExportable can support. More...
enum  Result {
  Complete = 0, Incomplete = 1, Failed = 2, FailedContinue = 4,
  VersionTooNew = 8, VersionTooOld = 16, VersionSupported = 32, SuccessResult = Complete | Incomplete | VersionSupported,
  FailedResult = Failed | FailedContinue | VersionTooNew | VersionTooOld
}
 The possible results of an export/import operation. More...

Public Member Functions

void clearExportTask ()
 Clears the export task.
IExportable::ExportResultFlags exportBinary (QDataStream &stream) const
 Allows exporting to a QDataStream.
IExportable::ExportResultFlags exportBinaryExt (QDataStream &stream, ExportItemFlags export_flags) const
 Extended binary export function.
IExportable::ExportResultFlags exportXml (QDomDocument *doc, QDomElement *object_node) const
 Allows exporting to an XML document. A reference to the QDomElement to which the object's information must be added is provided, along with a reference to the QDomDocument.
IExportable::ExportResultFlags exportXmlExt (QDomDocument *doc, QDomElement *object_node, ExportItemFlags export_flags) const
 Extended XML export function.
IExportable::ExportResultFlags importBinary (QDataStream &stream, QList< QPointer< QObject > > &import_list)
 Allows importing and reconstruction of the object state from information provided in a QDataStream.
IExportable::ExportResultFlags importXml (QDomDocument *doc, QDomElement *object_node, QList< QPointer< QObject > > &import_list)
 Allows importing and reconstruction of data from information provided in a XML document. A reference to the QDomElement which contains the object's information is provided, along with a reference to the QDomDocument.
QObject * objectBase ()
const QObject * objectBase () const
void setExportTask (ITask *task)
 Sets the task which must be used to log import/export information to.
void setExportVersion (Qtilities::ExportVersion version)
 Returns the export version currently used by all Qtilities classes.
ExportModeFlags supportedFormats () const
 Provides information about the export format(s) supported by your implementation of IExportable.
- Public Member Functions inherited from Qtilities::Core::Interfaces::IExportable
quint32 applicationExportVersion () const
 Returns the application export version currently used by all your application's classes.
IExportableduplicate (QString *error_msg=0, int properties_to_copy=0, ExportResultFlags *result_flags=0) const
 Function which will create a duplicate (copy) of this object.
virtual ITaskexportTask () const
 Gets the task which must be used to log import/export information to.
Qtilities::ExportVersion exportVersion () const
 Returns the export version currently used by all Qtilities classes.
virtual InstanceFactoryInfo instanceFactoryInfo () const
 The instance factory information which must be used when the exported object is reconstructed during an import.
bool isExportable () const
 Gets if this object must be part of it's parents' exports.
virtual void setApplicationExportVersion (quint32 version)
 Sets the application export version currently used by all your application's classes.
virtual void setIsExportable (bool new_is_exportable)
 Sets if this object must be part of it's parents' exports.
- Public Member Functions inherited from Qtilities::Core::Interfaces::IObjectBase
QString objectOriginID () const
 Allows interfaces to provide some sort of source identification.
void setObjectOriginID (const QString &object_origin_id)
 Allows setting of the object source ID of this interface implementation.

Public Attributes

bool broadcast_modification_state_changes
 Used internally in Observer to optimize the number of times modification state changes are broadcast.
bool modification_state_start_of_proc_cycle
 Used during processing cycles to store the modification state of the observer when a processing cycle is started. When different when the processing cycle is stopped, only then will it emit that the modification state changed.
int number_of_subjects_start_of_proc_cycle
 Used during processing cycles to store the number of subjects before the processing cycle started. This allows correct emission of numberOfSubjectsChanged() when the processing cycle ends.
Observerobserver
 Keeps track of its parent observer:
PointerList subject_observer_list
 Stores a list of all observers under this observer.

Additional Inherited Members

- Static Public Member Functions inherited from Qtilities::Core::Interfaces::IExportable
template<typename T >
static T * duplicateInstance (IExportable *obj, QString *error_msg=0, int properties_to_copy=0, ExportResultFlags *result_flags=0)
 Provides an easy to use template based implementation of IExportable::duplicate().
static QString exportModeToString (ExportMode export_mode)
 Function which returns a string associated with a specific ExportMode.
static ExportMode stringToExportMode (const QString &export_mode_string)
 Function which returns the ExportMode associated with a string.
static Result validateQtilitiesExportVersion (Qtilities::ExportVersion export_version, ITask *task=0)
 Checks the exportVersion() against the supported Qtilities export versions for the current Qtilities version.
static Result validateQtilitiesImportVersion (Qtilities::ExportVersion import_version, ITask *task=0)
 Checks the exportVersion() against the supported Qtilities import versions for the current Qtilities version.

Detailed Description

The ObserverData class contains data which is shared by different references of the same observer.

Each Observer holds an explicitly shared data pointer to an ObserverData object.

See also:
Observer

Member Enumeration Documentation

The possible export flags used during extended observer exports.

See also:
exportBinaryExt(), exportXMLExt()
Enumerator:
ExportData 

Exports all observer data, subjects and their children.

ExportVisitorIDs 

XML Only: Indicates that VisitorIDs must be added to subject nodes. This is needed when ExportRelationalData is used, and therefore it is automatically enabled in that case.

ExportRelationalData 

Indicates that an ObserverRelationalTable must be constructed for the observer and it must be exported with the observer data. During extended imports the relational structure of the tree under your observer will be reconstructed.


Member Function Documentation

void Qtilities::Core::ObserverData::clearExportTask ( )
virtual

Clears the export task.

See also:
setExportTask(), exportTask()

Reimplemented from Qtilities::Core::Interfaces::IExportable.

Qtilities::Core::Interfaces::IExportable::ExportResultFlags Qtilities::Core::ObserverData::exportBinary ( QDataStream &  stream) const
virtual

Allows exporting to a QDataStream.

See Serializing Qtilities Data Types Overview for more information about the expected output format.

Parameters:
streamA reference to the QDataStream to which the object's information must be appended is provided.

Reimplemented from Qtilities::Core::Interfaces::IExportable.

Qtilities::Core::Interfaces::IExportable::ExportResultFlags Qtilities::Core::ObserverData::exportXml ( QDomDocument *  doc,
QDomElement *  object_node 
) const
virtual

Allows exporting to an XML document. A reference to the QDomElement to which the object's information must be added is provided, along with a reference to the QDomDocument.

See Serializing Qtilities Data Types Overview for more information about the expected output format.

Reimplemented from Qtilities::Core::Interfaces::IExportable.

Qtilities::Core::Interfaces::IExportable::ExportResultFlags Qtilities::Core::ObserverData::importBinary ( QDataStream &  stream,
QList< QPointer< QObject > > &  import_list 
)
virtual

Allows importing and reconstruction of the object state from information provided in a QDataStream.

See Serializing Qtilities Data Types Overview for more information about the expected output format.

Parameters:
streamThe QDataStream which contains the object's information.
import_listAll objects constructed during the import operation must be added to the import list. When the operation fails, all objects in this list will be deleted.

Reimplemented from Qtilities::Core::Interfaces::IExportable.

Qtilities::Core::Interfaces::IExportable::ExportResultFlags Qtilities::Core::ObserverData::importXml ( QDomDocument *  doc,
QDomElement *  object_node,
QList< QPointer< QObject > > &  import_list 
)
virtual

Allows importing and reconstruction of data from information provided in a XML document. A reference to the QDomElement which contains the object's information is provided, along with a reference to the QDomDocument.

See Serializing Qtilities Data Types Overview for more information about the expected output format.

Reimplemented from Qtilities::Core::Interfaces::IExportable.

QObject* Qtilities::Core::ObserverData::objectBase ( )
inlinevirtual
Note:
QtilitiesCategory is not a QObject, thus it returns 0.

Implements Qtilities::Core::Interfaces::IObjectBase.

const QObject* Qtilities::Core::ObserverData::objectBase ( ) const
inlinevirtual
Note:
QtilitiesCategory is not a QObject, thus it returns 0.

Implements Qtilities::Core::Interfaces::IObjectBase.

void Qtilities::Core::ObserverData::setExportTask ( ITask task)
virtual

Sets the task which must be used to log import/export information to.

To remove the task, use clearExportTask()

See also:
exportTask(), clearExportTask()

Reimplemented from Qtilities::Core::Interfaces::IExportable.

void Qtilities::Core::ObserverData::setExportVersion ( Qtilities::ExportVersion  version)
virtual

Returns the export version currently used by all Qtilities classes.

By default the latest Qtilities version is selected.

See also:
exportVersion()

Reimplemented from Qtilities::Core::Interfaces::IExportable.

Qtilities::Core::Interfaces::IExportable::ExportModeFlags Qtilities::Core::ObserverData::supportedFormats ( ) const
virtual

Provides information about the export format(s) supported by your implementation of IExportable.

Note:
It is important to note that you need to check the exportVersion() when you return the supported formats.

Reimplemented from Qtilities::Core::Interfaces::IExportable.


Member Data Documentation

int Qtilities::Core::ObserverData::number_of_subjects_start_of_proc_cycle

Used during processing cycles to store the number of subjects before the processing cycle started. This allows correct emission of numberOfSubjectsChanged() when the processing cycle ends.

Note:
When setting number_of_subjects_start_of_proc_cycle to -1, the numberOfSubjectsChanged() signal will not be emitted in endProcessingCycle(). This is used in the ~Observer destructor. We don't want to emit that the number of subjects changed in the destructor because all subjects will be removed.
PointerList Qtilities::Core::ObserverData::subject_observer_list

Stores a list of all observers under this observer.

Used to optimize performance.



Qtilities : Reference Documentation Back to top Copyright © 2009-2013, Jaco Naudé