|
1 /* |
|
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Property list implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __XNPROPERTYLIST_H__ |
|
20 #define __XNPROPERTYLIST_H__ |
|
21 |
|
22 // System includes |
|
23 #include <e32base.h> |
|
24 |
|
25 // User includes |
|
26 #include "xndomproperty.h" |
|
27 |
|
28 // Forward declarations |
|
29 class CXnPropertyComparator; |
|
30 class CXnMap; |
|
31 class CXnProperty; |
|
32 |
|
33 struct CXnPropertyKey : public CBase |
|
34 { |
|
35 const TDesC8* iString; |
|
36 CXnDomProperty::TPseudoClass iPseudoClass; |
|
37 }; |
|
38 |
|
39 // Class declaration |
|
40 |
|
41 /** |
|
42 * Property list |
|
43 * |
|
44 * @ingroup group_xnlayoutengine |
|
45 * @lib xn3layoutengine.lib |
|
46 * @since Series 60 3.1 |
|
47 */ |
|
48 NONSHARABLE_CLASS( CXnPropertyList ) : public CBase |
|
49 { |
|
50 public: |
|
51 // Constructors and destructor |
|
52 |
|
53 /** |
|
54 * Two-phased constructor. |
|
55 * |
|
56 * @return Property list object. |
|
57 */ |
|
58 static CXnPropertyList* NewL(); |
|
59 |
|
60 /** |
|
61 * Destructor. |
|
62 */ |
|
63 ~CXnPropertyList(); |
|
64 |
|
65 public: |
|
66 // New functions |
|
67 |
|
68 /** |
|
69 * Set a property. The list will assume ownership of the property. |
|
70 * If an equal property is already in the list, it will be replaced with |
|
71 * the new property and the old property will be destroyed. |
|
72 * |
|
73 * @since Series 60 3.1 |
|
74 * @param aProperty Property to set. |
|
75 */ |
|
76 void SetPropertyL( CXnProperty* aProperty ); |
|
77 |
|
78 /** |
|
79 * Gets a property. The list will retain ownership of the property, |
|
80 * the caller must not destroy the property. The returned pointer will |
|
81 * become invalid if the property is replaced in the list by a subsequent |
|
82 * SetL(). |
|
83 * |
|
84 * @since Series 60 3.1 |
|
85 * @param aProperty Property key |
|
86 * @return The property mapped to the key or NULL if not found. |
|
87 */ |
|
88 CXnProperty* GetProperty( const TDesC8& aKey ) const; |
|
89 |
|
90 /** |
|
91 * Set a state |
|
92 * |
|
93 * @since Series 60 3.1 |
|
94 * @param aState State to set. |
|
95 * @return ETrue if pseudoclass found, EFalse otherwise |
|
96 */ |
|
97 TBool SetStateL( const TDesC8& aState ); |
|
98 |
|
99 /** |
|
100 * Check whether a state is set |
|
101 * |
|
102 * @since Series 60 3.1 |
|
103 * @param aState State to be checked |
|
104 * @return ETrue if set, EFalse if not |
|
105 */ |
|
106 TBool IsStateSet( const TDesC8& aState ); |
|
107 |
|
108 /** |
|
109 * Unset a state |
|
110 * |
|
111 * @since Series 60 3.1 |
|
112 * @param aState State to unset. |
|
113 * @return ETrue if pseudoclass found, EFalse otherwise |
|
114 */ |
|
115 TBool UnsetState( const TDesC8& aState ); |
|
116 |
|
117 /** |
|
118 * Clone the list |
|
119 * |
|
120 * @since Series 60 3.1 |
|
121 * @return Clone of the list |
|
122 */ |
|
123 CXnPropertyList* CloneL(); |
|
124 protected: |
|
125 // New functions |
|
126 |
|
127 /** |
|
128 * C++ default constructor. |
|
129 */ |
|
130 CXnPropertyList(); |
|
131 |
|
132 private: |
|
133 |
|
134 /** |
|
135 * Two-phased constructor. |
|
136 * @param aComparator Propety comparator. |
|
137 */ |
|
138 void ConstructL(); |
|
139 |
|
140 private: |
|
141 // Data |
|
142 |
|
143 /** Map of property objects. */ |
|
144 CXnMap* iMap; |
|
145 /** Currently used pseudoclasses (states) */ |
|
146 RArray< CXnDomProperty::TPseudoClass > iCurrentPseudoClasses; |
|
147 }; |
|
148 |
|
149 #endif //__XNPROPERTYLIST_H__ |
|
150 |