|
1 /* |
|
2 * Copyright (c) 2003 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: Defines the package ID class used to identify skin packages |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef AKNSPKGID_H |
|
20 #define AKNSPKGID_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32std.h> |
|
24 #include <e32base.h> |
|
25 |
|
26 // CONSTANTS |
|
27 |
|
28 static const TInt KAknsPkgIDDesSize = 23; |
|
29 |
|
30 // DATA TYPES |
|
31 |
|
32 typedef TBuf<KAknsPkgIDDesSize> TAknsPkgIDBuf; |
|
33 |
|
34 // FORWARD DECLARATIONS |
|
35 |
|
36 // CLASS DECLARATION |
|
37 |
|
38 /** |
|
39 * Package identifier used to identify skin packages. Package ID may be either |
|
40 * a UID or a timestamp and random number pair. |
|
41 * |
|
42 * Note that the class does not define any constructors. This ensures that |
|
43 * @c TAknsPkgID can be used in ROM constants. |
|
44 * |
|
45 * @lib AknSkinSrv.lib |
|
46 * |
|
47 * @since 2.0 |
|
48 */ |
|
49 class TAknsPkgID |
|
50 { |
|
51 public: // New functions |
|
52 |
|
53 /** |
|
54 * Sets skin package ID by giving a UID. |
|
55 * |
|
56 * @param aUid New UID to be set as the value of the package ID. |
|
57 */ |
|
58 inline void Set( const TUid aUid ); |
|
59 |
|
60 /** |
|
61 * Sets skin package ID by giving a timestamp and a random number. |
|
62 * |
|
63 * @param aTimestamp Timestamp as an integer. Must be non-zero. |
|
64 * |
|
65 * @param aNumber Random number. |
|
66 */ |
|
67 inline void Set( const TInt aTimestamp, const TInt aNumber ); |
|
68 |
|
69 /** |
|
70 * Sets skin package ID by an existing package ID. |
|
71 * |
|
72 * @param aID Skin package ID. |
|
73 */ |
|
74 inline void Set( const TAknsPkgID& aID ); |
|
75 |
|
76 /** |
|
77 * Checks whether the skin package ID is a UID. |
|
78 * |
|
79 * @return ETrue if the skin package ID is a UID, EFalse otherwise. |
|
80 */ |
|
81 inline TBool IsUid() const; |
|
82 |
|
83 /** |
|
84 * Returns the skin package ID as a UID. If the package ID is not a |
|
85 * UID, the result is undefined. |
|
86 * |
|
87 * @return Skin packge ID as a UID. |
|
88 */ |
|
89 inline TUid Uid() const; |
|
90 |
|
91 public: // New functions - String conversions |
|
92 |
|
93 /** |
|
94 * Copies the content of the package ID to the given descriptor. |
|
95 * The size of the descriptor must be at least the size of |
|
96 * @c TAknsPkgIDBuf. Otherwise the method may panic. |
|
97 * |
|
98 * @param aDes Target descriptor. |
|
99 */ |
|
100 IMPORT_C void CopyToDes( TDes& aDes ) const; |
|
101 |
|
102 /** |
|
103 * Sets the content of the package ID based on the given character |
|
104 * representation. The content of the given descriptor must be |
|
105 * valid (as generated by @c CopyToDes). |
|
106 * |
|
107 * If the given descriptor doesn't contain a correctly formatted |
|
108 * skin package ID the method leaves and the content of the object |
|
109 * is undefined. |
|
110 * |
|
111 * @param aDes Source descriptor. |
|
112 */ |
|
113 IMPORT_C void SetFromDesL( const TDesC& aDes ); |
|
114 |
|
115 public: // Data |
|
116 |
|
117 TInt iNumber; //!< Number or UID. |
|
118 TInt iTimestamp; //!< Timestamp (or 0 if UID). |
|
119 |
|
120 }; |
|
121 |
|
122 // CONSTANTS (continued) |
|
123 |
|
124 static const TAknsPkgID KAknsNullPkgID = { 0, 0 }; |
|
125 |
|
126 // FUNCTION PROTOTYPES |
|
127 |
|
128 /** |
|
129 * C++ equal operator. |
|
130 * Checks whether two package ID objects have identical content. |
|
131 * |
|
132 * @param aFirst First object to be compared. |
|
133 * |
|
134 * @param aSecond Second object to be compared. |
|
135 * |
|
136 * @return true if objects have identical content, false otherwise. |
|
137 */ |
|
138 inline TBool operator==( const TAknsPkgID& aFirst, const TAknsPkgID& aSecond ); |
|
139 |
|
140 /** |
|
141 * C++ not equal operator. |
|
142 * Checks whether two package ID objects have identical content. |
|
143 * |
|
144 * @param aFirst First object to be compared. |
|
145 * |
|
146 * @param aSecond Second object to be compared. |
|
147 * |
|
148 * @return false if objects have identical content, true otherwise. |
|
149 */ |
|
150 inline TBool operator!=( const TAknsPkgID& aFirst, const TAknsPkgID& aSecond ); |
|
151 |
|
152 // INLINED MEMBERS |
|
153 |
|
154 #include "AknsPkgID.inl" |
|
155 |
|
156 #endif // AKNSITEMID_H |
|
157 |
|
158 // End of File |