38 { |
37 { |
39 public: // Constructors and destructor |
38 public: // Constructors and destructor |
40 |
39 |
41 /** |
40 /** |
42 * Two-phased constructor. |
41 * Two-phased constructor. |
|
42 * |
|
43 * @param aAllowDuplicates ETrue if duplicates are to be allowed. |
|
44 * Supported for legacy reasons. |
43 */ |
45 */ |
44 static CXnDomStringPool* NewL(); |
46 static CXnDomStringPool* NewL( const TBool aAllowDuplicates = EFalse ); |
|
47 |
45 /** |
48 /** |
46 * Two-phased stream constructor. |
49 * Two-phased stream constructor. |
|
50 * |
|
51 * @param aStream Stream where string pool is internalized. |
|
52 * @param aAllowDuplicates ETrue if duplicates are to be allowed. |
|
53 * Supported for legacy reasons. |
47 */ |
54 */ |
48 static CXnDomStringPool* NewL( RReadStream& aStream ); |
55 static CXnDomStringPool* NewL( RReadStream& aStream, |
|
56 const TBool aAllowDuplicates = EFalse ); |
|
57 |
49 /** |
58 /** |
50 * Destructor. |
59 * Destructor. |
51 */ |
60 */ |
52 virtual ~CXnDomStringPool(); |
61 virtual ~CXnDomStringPool(); |
53 |
62 |
54 public: |
63 public: |
55 /** |
64 /** |
56 * Make a copy from original StringPool. |
65 * Make a copy from original StringPool. |
57 * @since Series 60 3.1 |
66 * @since Series 60 3.1 |
58 * @return Pointer to a string pool. Ownership is transferred to a caller. |
67 * @return Pointer to a string pool. Ownership is transferred to a caller. |
59 */ |
68 */ |
60 CXnDomStringPool* CloneL(); |
69 CXnDomStringPool* CloneL(); |
|
70 |
61 public: //Adding |
71 public: //Adding |
62 |
72 |
63 /** |
73 /** |
64 * Set dom string into string pool. |
74 * Set dom string into string pool. |
|
75 * |
65 * @param aString String to add to string pool |
76 * @param aString String to add to string pool |
66 * @return Index (reference) to string pool |
77 * @return Index (reference) to string pool |
67 */ |
78 */ |
68 IMPORT_C TInt AddStringL( const TDesC8& aString ); |
79 TInt AddStringL( const TDesC8& aString ); |
69 |
80 |
|
81 /** |
|
82 * Set dom string into string pool. |
|
83 * |
|
84 * @param aString String to add to string pool. OWNERSHIP TRANSFERRED! |
|
85 * @return Index (reference) to string pool |
|
86 */ |
|
87 TInt AddStringL( HBufC8* aString ); |
|
88 |
|
89 /** |
|
90 * Add all string from another string pool. |
|
91 * |
|
92 * @param aStringPool Source string pool. |
|
93 */ |
|
94 void AddAllL( CXnDomStringPool& aStringPool ); |
|
95 |
70 public: //Accessing |
96 public: //Accessing |
71 /** |
97 /** |
72 * Get pointer to the node element name. |
98 * Get reference to string. |
|
99 * |
73 * @param aMap Map object which has index to name string |
100 * @param aMap Map object which has index to name string |
74 * @return Pointer to the name |
101 * @return Pointer to the name |
75 */ |
102 */ |
76 const TDesC8& String( const TInt aStringRef ); |
103 const TDesC8& String( const TInt aStringRef ); |
77 |
104 |
78 /** |
105 /** |
79 * Get object's data size in bytes. |
106 * Get object's data size in bytes. |
|
107 * |
80 * @return Data size in bytes |
108 * @return Data size in bytes |
81 */ |
109 */ |
82 TInt Size() const; |
110 TInt Size() const; |
|
111 |
|
112 /** |
|
113 * Get amount of strings. |
|
114 */ |
|
115 TInt Count() const; |
83 |
116 |
84 /** |
117 /** |
85 * Externalize object |
118 * Externalize object. |
|
119 * |
86 * @param aStream Output stream |
120 * @param aStream Output stream |
87 */ |
121 */ |
88 void ExternalizeL( RWriteStream& aStream ) const; |
122 void ExternalizeL( RWriteStream& aStream ) const; |
89 |
123 |
90 /** |
124 /** |
91 * Internalize object |
125 * Internalize object. |
|
126 * |
92 * @param aStream Input stream |
127 * @param aStream Input stream |
93 */ |
128 */ |
94 void InternalizeL( RReadStream& aStream ); |
129 void InternalizeL( RReadStream& aStream ); |
95 |
130 |
96 /** |
|
97 * Get index offset to string array for shared resources |
|
98 * @return An offset that caller must add to its indexes |
|
99 */ |
|
100 TUint Offset() const; |
|
101 |
|
102 private: |
131 private: |
103 |
132 |
104 /** |
133 /** |
105 * C++ default constructor. |
134 * C++ default constructor. |
|
135 * |
|
136 * @param aAllowDuplicates ETrue if duplicates are to be allowed. |
|
137 * Supported for legacy reasons. |
106 */ |
138 */ |
107 CXnDomStringPool(); |
139 CXnDomStringPool( const TBool aAllowDuplicates ); |
108 |
140 |
109 /** |
141 /** |
110 * By default Symbian 2nd phase constructor is private. |
142 * By default Symbian 2nd phase constructor is private. |
111 */ |
143 */ |
112 void ConstructL(); |
144 void ConstructL(); |
113 |
145 |
114 private: |
146 /** |
|
147 * Add string to string pool and to optimizer also. |
|
148 * |
|
149 * @param aNewString String to be added. OWNERSHIP TRANSFERRED. |
|
150 * @param TInt Index to added string. |
|
151 */ |
|
152 TInt DoAddStringL( HBufC8* aNewString ) ; |
|
153 |
|
154 private: |
115 //String pool |
155 //String pool |
116 RPointerArray<HBufC8> iStringPool; |
156 RPointerArray<HBufC8> iStringPool; |
117 |
157 |
118 TUint iStringPoolOffsetCurrent; // Internalize uses |
158 /** |
119 TUint iStringPoolOffsetNext; |
159 * String pool optimizer. |
|
160 */ |
|
161 TXnDomStringPoolOptimizer iStringPoolOptimizer; |
|
162 |
|
163 /** |
|
164 * ETrue if string pool can contain duplicate entries. Must |
|
165 * be supported for legacy reasons while loading xuikon odts. |
|
166 */ |
|
167 TBool iAllowDuplicates; |
120 }; |
168 }; |
121 |
169 |
122 #endif // XN_DOM_STRING_POOL_H |
170 #endif // XN_DOM_STRING_POOL_H |
123 |
171 |
124 // End of File |
172 // End of File |