|
1 /* |
|
2 * Copyright (c) 2002 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: |
|
15 * Utility class for Memory State Popup. |
|
16 * |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #ifndef __CMSPUTIL_H__ |
|
22 #define __CMSPUTIL_H__ |
|
23 |
|
24 // INCLUDES |
|
25 #include <e32base.h> |
|
26 #include <badesca.h> |
|
27 |
|
28 |
|
29 // CLASS DEFINITION |
|
30 |
|
31 class CMSPUtil : public CBase |
|
32 { |
|
33 public: |
|
34 /** |
|
35 * Static constructor. |
|
36 * @param aArray Array of unit texts. |
|
37 * @return Pointer to an instance of CMSPUtil. |
|
38 */ |
|
39 static CMSPUtil* NewL( CDesCArrayFlat* aArray ); |
|
40 |
|
41 /** |
|
42 * Virtual D'tor. |
|
43 */ |
|
44 virtual ~CMSPUtil( ); |
|
45 |
|
46 protected: |
|
47 /** |
|
48 * Default c'tor, protected to prevent using directly. |
|
49 */ |
|
50 CMSPUtil( ); |
|
51 |
|
52 public: |
|
53 /** |
|
54 * Type of unit. |
|
55 */ |
|
56 enum TUnitType |
|
57 { |
|
58 EByte = 0, |
|
59 EKiloByte, |
|
60 EMegaByte, |
|
61 EGigaByte, |
|
62 ETeraByte |
|
63 }; |
|
64 |
|
65 public: |
|
66 /** |
|
67 * Solves the correct unit for given data size. |
|
68 * @param aNumber Amount of data to be solved, changed accordingly. |
|
69 * @return Unit text descriptor. |
|
70 */ |
|
71 IMPORT_C TPtrC SolveUnitAndSize( TInt64& aNumber ); |
|
72 |
|
73 private: |
|
74 /** |
|
75 * Solves the correct unit for given data size, used internally. |
|
76 * @param aNumber Amount of data to be solved, changed accordingly. |
|
77 * @param aUnit Unit text index in unit array. |
|
78 */ |
|
79 void SolveUnitAndSize( TInt64& aNumber, TInt& aUnit ); |
|
80 |
|
81 private: |
|
82 CDesCArrayFlat* iUnitArray; |
|
83 }; |
|
84 |
|
85 #endif // __CMSPUTIL_H__ |