|
1 /* |
|
2 * Copyright (c) 2006 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: Class to provide carrier of program data to search view.* |
|
15 */ |
|
16 |
|
17 |
|
18 |
|
19 // USER INCLUDES |
|
20 #include "CIptvEpgScheduleSearch.h" |
|
21 |
|
22 // ---------------------------------------------------------------------------- |
|
23 // CIptvEpgScheduleSearch::CIptvEpgProgram() |
|
24 // |
|
25 // Constructor |
|
26 // ---------------------------------------------------------------------------- |
|
27 // |
|
28 EXPORT_C CIptvEpgScheduleSearch* CIptvEpgScheduleSearch::NewL() |
|
29 { |
|
30 CIptvEpgScheduleSearch* self = new (ELeave) CIptvEpgScheduleSearch(); |
|
31 CleanupStack::PushL( self ); |
|
32 self->ConstructL(); |
|
33 CleanupStack::Pop( self ); |
|
34 return self; |
|
35 } |
|
36 |
|
37 // ---------------------------------------------------------------------------- |
|
38 // CIptvEpgScheduleSearch::CIptvEpgScheduleSearch() |
|
39 // ---------------------------------------------------------------------------- |
|
40 // |
|
41 CIptvEpgScheduleSearch::CIptvEpgScheduleSearch() : iChannelId( 0 ), |
|
42 iProgramId( 0 ), iStartTime( 0 ), iEndTime( 0 ) |
|
43 { |
|
44 } |
|
45 |
|
46 // ---------------------------------------------------------------------------- |
|
47 // CIptvEpgScheduleSearch::~CIptvEpgScheduleSearch() |
|
48 // ---------------------------------------------------------------------------- |
|
49 // |
|
50 CIptvEpgScheduleSearch::~CIptvEpgScheduleSearch() |
|
51 { |
|
52 delete iProgramName; |
|
53 } |
|
54 |
|
55 // ---------------------------------------------------------------------------- |
|
56 // CIptvEpgScheduleSearch::ConstructL() |
|
57 // ---------------------------------------------------------------------------- |
|
58 // |
|
59 void CIptvEpgScheduleSearch::ConstructL() |
|
60 { |
|
61 } |
|
62 |
|
63 // ---------------------------------------------------------------------------- |
|
64 // CIptvEpgScheduleSearch::LinearOrderOfSchedulesByTime() |
|
65 // |
|
66 // Method that returns -1 if s1 is earlier than s2, 0 if equal and 1 if |
|
67 // s1 is later than s2 |
|
68 // ---------------------------------------------------------------------------- |
|
69 // |
|
70 TInt CIptvEpgScheduleSearch::LinearOrderOfSchedulesByTime( |
|
71 const CIptvEpgScheduleSearch &s1, const CIptvEpgScheduleSearch &s2 ) |
|
72 { |
|
73 return ( s1.iStartTime < s2.iStartTime ? -1 : ( s1.iStartTime == s2.iStartTime ? 0 : 1 ) ); |
|
74 } |
|
75 |
|
76 // ---------------------------------------------------------------------------- |
|
77 // CIptvEpgScheduleSearch::LinearOrderOfSchedulesByName() |
|
78 // |
|
79 // Method that returns -1 if s1 is earlier than s2, 0 if equal and 1 if |
|
80 // s1 is later than s2 |
|
81 // ---------------------------------------------------------------------------- |
|
82 // |
|
83 EXPORT_C TInt CIptvEpgScheduleSearch::LinearOrderOfSchedulesByName( |
|
84 const CIptvEpgScheduleSearch &s1, const CIptvEpgScheduleSearch &s2 ) |
|
85 { |
|
86 if ( s1.iProgramName && s2.iProgramName ) |
|
87 { |
|
88 TInt result( s1.iProgramName->Des().Compare( s2.iProgramName->Des() ) ); |
|
89 if ( result < 0 || result > 0 ) |
|
90 { |
|
91 return result; |
|
92 } |
|
93 else |
|
94 { |
|
95 // names are equal, compare start times |
|
96 if ( s1.iStartTime < s2.iStartTime ) |
|
97 { |
|
98 result = -1; |
|
99 } |
|
100 else if ( s1.iStartTime == s2.iStartTime ) |
|
101 { |
|
102 result = 0; |
|
103 } |
|
104 else |
|
105 { |
|
106 result = 1; |
|
107 } |
|
108 } |
|
109 return result; |
|
110 } |
|
111 else |
|
112 { |
|
113 return 0; |
|
114 } |
|
115 |
|
116 } |
|
117 |
|
118 |
|
119 // End of file |