|
1 /* |
|
2 * Copyright (c) 2010 Ixonos Plc. |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the "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 * Ixonos Plc |
|
14 * |
|
15 * Description: |
|
16 * Represents an N-bit bit field. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #ifndef BITFIELD_H |
|
22 #define BITFIELD_H |
|
23 |
|
24 #include <e32std.h> |
|
25 |
|
26 /** Class name */ |
|
27 _LIT(KClassName, "BitField"); |
|
28 |
|
29 /** Max size */ |
|
30 const TUint32 KSize = 32; |
|
31 |
|
32 |
|
33 /** |
|
34 * Represents an N-bit bit field |
|
35 * |
|
36 * @code |
|
37 * ?good_class_usage_example(s) |
|
38 * @endcode |
|
39 * |
|
40 * @lib ImageEditorUtils.lib |
|
41 * @since S60 v5.0 |
|
42 */ |
|
43 class TBitField |
|
44 { |
|
45 |
|
46 public: |
|
47 |
|
48 |
|
49 /** : Should be changed to private and NewL used */ |
|
50 IMPORT_C TBitField (); |
|
51 |
|
52 /** |
|
53 * Destructor. |
|
54 */ |
|
55 IMPORT_C ~TBitField (); |
|
56 |
|
57 /** |
|
58 * Copy constructor, disabled |
|
59 * |
|
60 * @since S60 v5.0 |
|
61 * @param rhs reference to TBitField |
|
62 * @return - |
|
63 */ |
|
64 IMPORT_C TBitField (const TBitField & rhs); |
|
65 |
|
66 /** |
|
67 * Assignment operator, disabled |
|
68 * |
|
69 * @since S60 v5.0 |
|
70 * @param rhs reference to TBitField |
|
71 * @return reference to the copied TBitField |
|
72 */ |
|
73 IMPORT_C TBitField & operator= (const TBitField & rhs); |
|
74 |
|
75 /** |
|
76 * Reset |
|
77 * |
|
78 * @since S60 v5.0 |
|
79 * @param - |
|
80 * @return - |
|
81 */ |
|
82 IMPORT_C void Reset (); |
|
83 |
|
84 /** |
|
85 * Set bit |
|
86 * |
|
87 * @since S60 v5.0 |
|
88 * @param aIndex bit field position |
|
89 * @return - |
|
90 */ |
|
91 IMPORT_C void SetBit (const TUint32 aIndex); |
|
92 |
|
93 /** |
|
94 * Get bit |
|
95 * |
|
96 * @since S60 v5.0 |
|
97 * @param aIndex bit field position |
|
98 * @return bit value in TInt |
|
99 */ |
|
100 IMPORT_C TInt GetBit (const TUint32 aIndex) const; |
|
101 |
|
102 |
|
103 protected: |
|
104 |
|
105 private: |
|
106 |
|
107 /** |
|
108 * Data |
|
109 */ |
|
110 TUint8 iData[(KSize >> 3) + 1]; |
|
111 |
|
112 }; |
|
113 |
|
114 #endif // BITFIELD_H |