author | William Roberts <williamr@symbian.org> |
Wed, 31 Mar 2010 12:33:34 +0100 | |
branch | Symbian3 |
changeset 4 | 837f303aceeb |
parent 3 | e1b950c65cb4 |
permissions | -rw-r--r-- |
williamr@4 | 1 |
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
williamr@4 | 2 |
// All rights reserved. |
williamr@4 | 3 |
// This component and the accompanying materials are made available |
williamr@4 | 4 |
// under the terms of "Eclipse Public License v1.0" |
williamr@4 | 5 |
// which accompanies this distribution, and is available |
williamr@4 | 6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html". |
williamr@4 | 7 |
// |
williamr@4 | 8 |
// Initial Contributors: |
williamr@4 | 9 |
// Nokia Corporation - initial contribution. |
williamr@4 | 10 |
// |
williamr@4 | 11 |
// Contributors: |
williamr@4 | 12 |
// |
williamr@4 | 13 |
// Description: |
williamr@4 | 14 |
// Interface class describing class that may contains user |
williamr@4 | 15 |
// data added to node |
williamr@4 | 16 |
// |
williamr@4 | 17 |
|
williamr@4 | 18 |
|
williamr@4 | 19 |
|
williamr@4 | 20 |
/** |
williamr@4 | 21 |
@file |
williamr@4 | 22 |
@publishedAll |
williamr@4 | 23 |
@released |
williamr@2 | 24 |
*/ |
williamr@4 | 25 |
#ifndef XMLENGUSERDATA_H |
williamr@4 | 26 |
#define XMLENGUSERDATA_H |
williamr@2 | 27 |
|
williamr@2 | 28 |
#include <e32def.h> |
williamr@2 | 29 |
|
williamr@2 | 30 |
/** |
williamr@4 | 31 |
Defines an interface so that user data can be stored in the DOM tree. |
williamr@4 | 32 |
Applications that wish to store user data in the DOM tree must wrap the user |
williamr@4 | 33 |
data in a class that implements this interface. |
williamr@4 | 34 |
|
williamr@4 | 35 |
There are two common patterns for implementors of this interface: |
williamr@4 | 36 |
|
williamr@4 | 37 |
1) Instance-based implementation |
williamr@4 | 38 |
The implementing class stores the user data. The object can be duplicated with |
williamr@4 | 39 |
CloneL() to form a new object that duplicates the user data. When Destroy() is |
williamr@4 | 40 |
called, the user data attached to the object is destroyed, but other duplicates |
williamr@4 | 41 |
may continue to hold the data. |
williamr@4 | 42 |
|
williamr@4 | 43 |
2) Reference-counted implementation |
williamr@4 | 44 |
The implementing class points to the user data. The object can be duplicated, |
williamr@4 | 45 |
but the user data is not duplicated. When Destroy() is called, the object is |
williamr@4 | 46 |
destroyed, but the user data is not destroyed unless this is the last object |
williamr@4 | 47 |
referring to this data. |
williamr@4 | 48 |
*/ |
williamr@2 | 49 |
class MXmlEngUserData { |
williamr@2 | 50 |
public: |
williamr@2 | 51 |
/** |
williamr@4 | 52 |
Free memory that is allocated and do other case specific cleanup. Whether |
williamr@4 | 53 |
this frees the user data depends on the implementation. In a |
williamr@4 | 54 |
reference-counted implementation, the user data may only be destroyed |
williamr@4 | 55 |
when Destroy() is called on the last object referring to that data. |
williamr@4 | 56 |
*/ |
williamr@2 | 57 |
virtual void Destroy() = 0; |
williamr@2 | 58 |
|
williamr@2 | 59 |
/** |
williamr@4 | 60 |
Make a copy of the the object. Whether this duplicates the data or |
williamr@4 | 61 |
creates a new object that points to the data is determined by the |
williamr@4 | 62 |
implementor of this class. |
williamr@4 | 63 |
|
williamr@4 | 64 |
@return Pointer to a copy of this object. |
williamr@4 | 65 |
@leave - One of the system-wide error codes |
williamr@4 | 66 |
*/ |
williamr@2 | 67 |
virtual MXmlEngUserData* CloneL() = 0; |
williamr@2 | 68 |
|
williamr@4 | 69 |
/** |
williamr@4 | 70 |
Gets the id of the object. It is up to the user data provider determine |
williamr@4 | 71 |
what the result is. Such a "user data identification" may be useful if |
williamr@4 | 72 |
several types of MXmlEngUserData objects are used. |
williamr@4 | 73 |
|
williamr@4 | 74 |
@return Pointer that somehow identifies the type of MXmlEngUserData (NULL by default) |
williamr@4 | 75 |
*/ |
williamr@2 | 76 |
virtual void* ID() {return NULL;} |
williamr@2 | 77 |
}; |
williamr@2 | 78 |
|
williamr@2 | 79 |
|
williamr@4 | 80 |
#endif /* XMLENGUSERDATA_H*/ |
williamr@2 | 81 |