64
|
1 |
/*
|
|
2 |
* Copyright (c) 2007 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: Property value for Alfred
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
#include "alf/alfproperty.h"
|
|
21 |
|
|
22 |
CAlfProperty::CAlfProperty()
|
|
23 |
{
|
|
24 |
|
|
25 |
}
|
|
26 |
|
|
27 |
TInt CAlfProperty::CompareByName(const CAlfProperty& aA, const CAlfProperty& aB)
|
|
28 |
{
|
|
29 |
return aA.Name().CompareC(aB.Name());
|
|
30 |
}
|
|
31 |
|
|
32 |
TBool CAlfProperty::Matches(const CAlfProperty& aA, const CAlfProperty& aB)
|
|
33 |
{
|
|
34 |
if (CAlfProperty::CompareByName(aA, aB) == 0)
|
|
35 |
{
|
|
36 |
return ETrue;
|
|
37 |
}
|
|
38 |
|
|
39 |
return EFalse;
|
|
40 |
}
|
|
41 |
|
|
42 |
void CAlfProperty::ConstructL(const TDesC8& aName)
|
|
43 |
{
|
|
44 |
iName = aName.AllocL();
|
|
45 |
}
|
|
46 |
|
|
47 |
const TDesC8& CAlfProperty::Name() const
|
|
48 |
{
|
|
49 |
ASSERT(iName);
|
|
50 |
return *iName;
|
|
51 |
}
|
|
52 |
|
|
53 |
TAlfPropertyType CAlfProperty::Type() const
|
|
54 |
{
|
|
55 |
return iType;
|
|
56 |
}
|
|
57 |
|
|
58 |
CAlfProperty::~CAlfProperty()
|
|
59 |
{
|
|
60 |
delete iName;
|
|
61 |
}
|
|
62 |
|
|
63 |
|
|
64 |
// Integer property class
|
|
65 |
|
|
66 |
CAlfPropertyInteger::CAlfPropertyInteger()
|
|
67 |
{
|
|
68 |
iType = EAlfPropertyTypeInteger;
|
|
69 |
}
|
|
70 |
|
|
71 |
CAlfPropertyInteger::~CAlfPropertyInteger()
|
|
72 |
{
|
|
73 |
|
|
74 |
}
|
|
75 |
|
|
76 |
TRangedValue CAlfPropertyInteger::Data() const
|
|
77 |
{
|
|
78 |
return iValue;
|
|
79 |
};
|
|
80 |
|
|
81 |
void CAlfPropertyInteger::Set(const TRangedValue& aValue)
|
|
82 |
{
|
|
83 |
iValue = aValue;
|
|
84 |
}
|
|
85 |
|
|
86 |
|
|
87 |
// Timed value property class
|
|
88 |
|
|
89 |
CAlfPropertyTimedValue::CAlfPropertyTimedValue()
|
|
90 |
{
|
|
91 |
iType = EAlfPropertyTypeTimedValue;
|
|
92 |
}
|
|
93 |
|
|
94 |
CAlfPropertyTimedValue::~CAlfPropertyTimedValue()
|
|
95 |
{
|
|
96 |
}
|
|
97 |
|
|
98 |
TAlfTimedValue& CAlfPropertyTimedValue::Data()
|
|
99 |
{
|
|
100 |
return iTimedValue;
|
|
101 |
}
|
|
102 |
|
|
103 |
void CAlfPropertyTimedValue::Set(TAlfTimedValue& aTimedValue)
|
|
104 |
{
|
|
105 |
iTimedValue = aTimedValue;
|
|
106 |
}
|
|
107 |
|
|
108 |
|
|
109 |
// String property class
|
|
110 |
|
|
111 |
CAlfPropertyString::CAlfPropertyString()
|
|
112 |
{
|
|
113 |
iType = EAlfPropertyTypeString;
|
|
114 |
iString = NULL;
|
|
115 |
}
|
|
116 |
|
|
117 |
CAlfPropertyString::~CAlfPropertyString()
|
|
118 |
{
|
|
119 |
delete iString;
|
|
120 |
}
|
|
121 |
|
|
122 |
TDesC* CAlfPropertyString::Data() const
|
|
123 |
{
|
|
124 |
ASSERT(iString);
|
|
125 |
|
|
126 |
return iString;
|
|
127 |
}
|
|
128 |
|
|
129 |
void CAlfPropertyString::SetL(const TDesC& aString)
|
|
130 |
{
|
|
131 |
if (iString)
|
|
132 |
{
|
|
133 |
delete iString;
|
|
134 |
iString = NULL;
|
|
135 |
}
|
|
136 |
|
|
137 |
iString = aString.AllocL();
|
|
138 |
}
|