|
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include <ssm/ssmswp.h> |
|
17 |
|
18 /** |
|
19 Constructor taking the property key and value |
|
20 @param aKey The key that identifies the System Wide Property |
|
21 @param aValue The value to be assigned to the System Wide Property |
|
22 */ |
|
23 EXPORT_C TSsmSwp::TSsmSwp(TUint aKey, TInt32 aValue) |
|
24 : iKey(aKey), iValue(aValue) |
|
25 { |
|
26 } //lint !e1746 Suppress parameter 'aKey' could be made const reference |
|
27 |
|
28 /** |
|
29 Copy constructor. |
|
30 @param aSwp The existing object who's key and value will be assigned to this object. |
|
31 */ |
|
32 EXPORT_C TSsmSwp::TSsmSwp(const TSsmSwp& aSwp) |
|
33 : iKey(aSwp.iKey), iValue(aSwp.iValue) |
|
34 { |
|
35 } |
|
36 |
|
37 /** |
|
38 Set this object. |
|
39 @param aKey The key that identifies the System Wide Property |
|
40 @param aValue The value to be assigned to the System Wide Property |
|
41 */ |
|
42 EXPORT_C void TSsmSwp::Set(TUint aKey, TInt32 aValue) |
|
43 { |
|
44 iKey = aKey; |
|
45 iValue = aValue; |
|
46 } //lint !e1746 Suppress parameter 'aKey' could be made const reference |
|
47 |
|
48 /** |
|
49 @return This objects key |
|
50 */ |
|
51 EXPORT_C TUint TSsmSwp::Key() const |
|
52 { |
|
53 return iKey; |
|
54 } |
|
55 |
|
56 /** |
|
57 @return This objects value |
|
58 */ |
|
59 EXPORT_C TInt32 TSsmSwp::Value() const |
|
60 { |
|
61 return iValue; |
|
62 } |
|
63 |
|
64 /** |
|
65 @param aSwp The existing object who's key and value will be assigned to this object. |
|
66 @return A reference to this object. |
|
67 */ |
|
68 EXPORT_C TSsmSwp& TSsmSwp::operator=(const TSsmSwp& aSwp) |
|
69 { |
|
70 // protect against self assignment |
|
71 if( &aSwp == this) |
|
72 { |
|
73 return(*this); |
|
74 } |
|
75 |
|
76 // do assigment |
|
77 iKey = aSwp.iKey; |
|
78 iValue = aSwp.iValue; |
|
79 return(*this); |
|
80 } |
|
81 |
|
82 /** |
|
83 @param aSwp The object to be compared. |
|
84 @return True, if the key and value are equal; false otherwise. |
|
85 */ |
|
86 EXPORT_C TBool TSsmSwp::operator==(const TSsmSwp& aSwp) const |
|
87 { |
|
88 return ((iKey == aSwp.iKey) && (iValue == aSwp.iValue)); |
|
89 } |
|
90 |
|
91 /** |
|
92 @param aSwp The object to be compared. |
|
93 @return True, if the key and value are not equal; false otherwise. |
|
94 */ |
|
95 EXPORT_C TBool TSsmSwp::operator!=(const TSsmSwp& aSwp) const |
|
96 { |
|
97 return !(*this == aSwp); |
|
98 } |