|
1 /* |
|
2 * Copyright (c) 2002-2004 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 the License "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: Utility. Creates progress info string from given data. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef PROGRESSINFOCREATOR_H |
|
21 #define PROGRESSINFOCREATOR_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <e32def.h> |
|
26 #include <e32std.h> |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class CCoeEnv; |
|
30 |
|
31 // CLASS DECLARATION |
|
32 |
|
33 /** |
|
34 * Utility. |
|
35 * It requires that DownloadMgrUiLib.rsc be loaded! |
|
36 * |
|
37 * @lib Download Manager UI Lib |
|
38 * @since Series 60 2.8 |
|
39 */ |
|
40 NONSHARABLE_CLASS( CProgressInfoCreator ) : public CBase |
|
41 { |
|
42 public: // Constructors and destructor |
|
43 |
|
44 /** |
|
45 * Two-phased constructor. |
|
46 */ |
|
47 static CProgressInfoCreator* NewL(); |
|
48 |
|
49 /** |
|
50 * Destructor. |
|
51 */ |
|
52 virtual ~CProgressInfoCreator(); |
|
53 |
|
54 public: // New functions |
|
55 |
|
56 /** |
|
57 * Construct progress info string containing size info according |
|
58 * to the specification. |
|
59 * @param aSize The size in bytes. |
|
60 * @param aResult The result is written into this buffer. Must be great enough! |
|
61 * @return None. |
|
62 */ |
|
63 void ProgressInfo( TInt32 aSize, TDes& aResult ); |
|
64 |
|
65 /** |
|
66 * Construct progress info string containing percentage and size info. |
|
67 * @param aPartialSize The partial size in bytes. |
|
68 * @param aFullSize The full size in bytes. |
|
69 * @param aResult The result is written into this buffer. Must be great enough! |
|
70 * @return None. |
|
71 */ |
|
72 void ProgressInfo( TInt32 aPartialSize, TInt32 aFullSize, TDes& aResult ); |
|
73 |
|
74 /** |
|
75 * Divides the given parameters, and returns the result |
|
76 * as a formatted string. |
|
77 * @param aNumerator The numerator of the division. |
|
78 * @param aDenominator The denominator of the division. |
|
79 * @param aResult The result is written into this buffer. Must be great enough! |
|
80 * @return None. |
|
81 */ |
|
82 void Division( TInt aNumerator, TInt aDenominator, TDes& aResult ); |
|
83 |
|
84 protected: // Constructors |
|
85 |
|
86 /** |
|
87 * C++ default constructor. |
|
88 */ |
|
89 CProgressInfoCreator(); |
|
90 |
|
91 /** |
|
92 * By default Symbian 2nd phase constructor is private. |
|
93 */ |
|
94 void ConstructL(); |
|
95 |
|
96 private: // Data |
|
97 |
|
98 CCoeEnv& iCoeEnv; ///< Reference to CONE environment. |
|
99 |
|
100 HBufC* iUnitKbFormatString; ///< Owned. |
|
101 HBufC* iUnitMbFormatString; ///< Owned. |
|
102 HBufC* iUnitPcFormatString; ///< Owned. |
|
103 |
|
104 /** |
|
105 * Formatted MB. 4 characters are enough, but allocate a bigger buffer. |
|
106 * It is a result buffer of DivisionL() method. |
|
107 */ |
|
108 TBuf<16> iFormattedMegaBytes; |
|
109 |
|
110 /** |
|
111 * 7 characters should be enough, but allocate a bigger buffer. |
|
112 * It is a result buffer of ProgressInfoL(2) method. |
|
113 */ |
|
114 TBuf<16> iPartialSizeString; |
|
115 |
|
116 /** |
|
117 * Temporary buffers for the DivisionL() method. |
|
118 * Max 3 characters for the quotient + 1 for the separator + |
|
119 * 2 for the remainder = 6 characters. |
|
120 */ |
|
121 TBuf<6> iDivResult; |
|
122 |
|
123 TUint64 iTUint64Helper1; |
|
124 TUint64 iTUint64Helper2; |
|
125 |
|
126 }; |
|
127 |
|
128 #endif /* PROGRESSINFOCREATOR_H */ |