85
|
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: Definition of entry attribute
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef __CAENTRYATTRIBUTE_H__
|
|
19 |
#define __CAENTRYATTRIBUTE_H__
|
|
20 |
|
|
21 |
#include <e32base.h>
|
|
22 |
|
|
23 |
//FORWARD DECLARATIONS
|
|
24 |
class RWriteStream;
|
|
25 |
class RReadStream;
|
|
26 |
|
|
27 |
/**
|
|
28 |
* CA entry attribute.
|
|
29 |
* @lib .lib
|
|
30 |
* @since S60 v5.0
|
|
31 |
*/
|
|
32 |
NONSHARABLE_CLASS( CCaEntryAttribute ): public CBase
|
|
33 |
{
|
|
34 |
|
|
35 |
public:
|
|
36 |
|
|
37 |
/**
|
|
38 |
* Destructor.
|
|
39 |
*/
|
|
40 |
virtual ~CCaEntryAttribute();
|
|
41 |
|
|
42 |
/**
|
|
43 |
* Two-phased constructor.
|
|
44 |
* @param aName Attribute name.
|
|
45 |
* @return The created object.
|
|
46 |
*/
|
|
47 |
IMPORT_C static CCaEntryAttribute* NewL( const TDesC& aName );
|
|
48 |
|
|
49 |
/**
|
|
50 |
* Two-phased constructor.
|
|
51 |
* @param aName Attribute name.
|
|
52 |
* @return The created object.
|
|
53 |
*/
|
|
54 |
IMPORT_C static CCaEntryAttribute* NewLC( const TDesC& aName );
|
|
55 |
|
|
56 |
/**
|
|
57 |
* Get name.
|
|
58 |
* @return Name.
|
|
59 |
*/
|
|
60 |
TPtrC Name() const
|
|
61 |
{
|
|
62 |
return iName;
|
|
63 |
}
|
|
64 |
|
|
65 |
/**
|
|
66 |
* Get value.
|
|
67 |
* @return Value, or NULL if attribute is not set.
|
|
68 |
*/
|
|
69 |
TPtrC Value() const
|
|
70 |
{
|
|
71 |
return iValue;
|
|
72 |
}
|
|
73 |
|
|
74 |
/**
|
|
75 |
* Set value. Sets changed status as appropriate.
|
|
76 |
* @param aValue Value, or NULL if attribute is not set (==remove attr).
|
|
77 |
* Ownership taken.
|
|
78 |
*/
|
|
79 |
IMPORT_C void SetValueL( const TDesC& aName );
|
|
80 |
|
|
81 |
/**
|
|
82 |
* Externalizes array to the stream
|
|
83 |
* @param aStream a write stream
|
|
84 |
*/
|
|
85 |
void ExternalizeL( RWriteStream& aStream ) const;
|
|
86 |
|
|
87 |
/**
|
|
88 |
* Internalizes stream to the array
|
|
89 |
* @param aStream a read stream
|
|
90 |
*/
|
|
91 |
void InternalizeL( RReadStream& aStream );
|
|
92 |
|
|
93 |
protected:
|
|
94 |
|
|
95 |
/**
|
|
96 |
* Second phased constructor.
|
|
97 |
* @param aName Attribute name.
|
|
98 |
*/
|
|
99 |
void ConstructL( const TDesC& aName );
|
|
100 |
|
|
101 |
private:
|
|
102 |
// data
|
|
103 |
|
|
104 |
/*
|
|
105 |
* Attribute name. Own
|
|
106 |
*/
|
|
107 |
RBuf iName;
|
|
108 |
|
|
109 |
/*
|
|
110 |
* Attribute value. Own
|
|
111 |
*/
|
|
112 |
RBuf iValue;
|
|
113 |
|
|
114 |
};
|
|
115 |
|
|
116 |
/**
|
|
117 |
* Attribute array.
|
|
118 |
* @lib camenu.lib
|
|
119 |
* @since S60 v5.0
|
|
120 |
*/
|
|
121 |
NONSHARABLE_CLASS( RCaEntryAttrArray ): public RPointerArray<CCaEntryAttribute>
|
|
122 |
{
|
|
123 |
|
|
124 |
public:
|
|
125 |
/**
|
|
126 |
* Find attribute by name.
|
|
127 |
* @param aId Id.
|
|
128 |
* @param aName Name.
|
|
129 |
* @param aAttr Attribute value.
|
|
130 |
* @return TBool ,ETrue if attribute was found
|
|
131 |
*/
|
|
132 |
IMPORT_C TBool Find( const TDesC& aName, TDes& aAttrVal );
|
|
133 |
|
92
|
134 |
/**
|
|
135 |
* Find attribute by name.
|
|
136 |
* @param aId Id.
|
|
137 |
* @param aName Name.
|
|
138 |
* @param aAttr Attribute value.
|
|
139 |
* @return TBool, ETrue if attribute was found
|
|
140 |
*/
|
|
141 |
IMPORT_C TBool Find( const TDesC& aName, TPtrC& aAttrVal );
|
|
142 |
|
85
|
143 |
/*
|
|
144 |
* Check if attribute exists
|
|
145 |
* @param aId Id
|
|
146 |
* @param aName Name
|
|
147 |
* @return ETrue if attribute exists
|
|
148 |
*/
|
|
149 |
IMPORT_C TBool Exist( const TDesC& aName );
|
|
150 |
|
|
151 |
/**
|
|
152 |
* Remove attribute
|
|
153 |
* @param aId Id.
|
|
154 |
* @param aAttrName Attribute name
|
|
155 |
*/
|
|
156 |
IMPORT_C void RemoveAttribute( const TDesC& aAttrName );
|
|
157 |
|
|
158 |
/**
|
|
159 |
* Externalizes array to the stream
|
|
160 |
* @param aStream a write stream
|
|
161 |
*/
|
|
162 |
void ExternalizeL( RWriteStream& aStream ) const;
|
|
163 |
|
|
164 |
/**
|
|
165 |
* Internalizes stream to the array
|
|
166 |
* @param aStream a read stream
|
|
167 |
*/
|
|
168 |
void InternalizeL( RReadStream& aStream );
|
|
169 |
|
|
170 |
};
|
|
171 |
|
|
172 |
#endif // __CAENTRYATTRIBUTE_H__
|