author | Sampo Huttunen <sampo.huttunen@nokia.com> |
Wed, 03 Nov 2010 11:45:09 +0200 | |
branch | IOP_Improvements |
changeset 40 | 08b5eae9f9ff |
permissions | -rw-r--r-- |
40
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
1 |
/* |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
5 |
* under the terms of "Eclipse Public License v1.0" |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
8 |
* |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
11 |
* |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
12 |
* Contributors: |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
13 |
* |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
14 |
* Description: Implementation of CUpnpCdsLiteObjectArray |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
15 |
* |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
16 |
*/ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
17 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
18 |
// INCLUDE FILES, SYSTEM |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
19 |
#include <f32file.h> // TParse |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
20 |
#include <e32def.h> // const_cast |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
21 |
#include <escapeutils.h> // ConvertFromUnicodeToUtf8L |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
22 |
#include <upnpobject.h> |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
23 |
#include <upnpcontainer.h> |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
24 |
#include <upnpitem.h> |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
25 |
#include <upnpelement.h> |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
26 |
#include "upnpconstantdefs.h" |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
27 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
28 |
// INCLUDE FILES, USER |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
29 |
#include "upnpcdsliteobject.h" |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
30 |
#include "upnpcdsliteobjectarray.h" |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
31 |
#include "upnpsharingalgorithmconstants.h" |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
32 |
#include "upnplog.h" |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
33 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
34 |
// CONSTANTS |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
35 |
_LIT8( KSpace, " "); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
36 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
37 |
// -------------------------------------------------------------------------- |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
38 |
// CUpnpCdsLiteObjectArray::NewL |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
39 |
// -------------------------------------------------------------------------- |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
40 |
// |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
41 |
EXPORT_C CUpnpCdsLiteObjectArray* CUpnpCdsLiteObjectArray::NewL() |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
42 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
43 |
__LOG( "[CUpnpSharingAlgorithm]\t CUpnpCdsLiteObjectArray::NewL" ); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
44 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
45 |
CUpnpCdsLiteObjectArray* self = new ( ELeave ) CUpnpCdsLiteObjectArray(); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
46 |
CleanupStack::PushL( self ); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
47 |
self->ConstructL(); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
48 |
CleanupStack::Pop( self ); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
49 |
return self; |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
50 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
51 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
52 |
// -------------------------------------------------------------------------- |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
53 |
// CUpnpCdsLiteObjectArray::~CUpnpCdsLiteObjectArray |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
54 |
// -------------------------------------------------------------------------- |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
55 |
// |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
56 |
EXPORT_C CUpnpCdsLiteObjectArray::~CUpnpCdsLiteObjectArray() |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
57 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
58 |
__LOG( "[CUpnpSharingAlgorithm]\t CUpnpCdsLiteObjectArray::\ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
59 |
~CUpnpCdsLiteObjectArray" ); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
60 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
61 |
// Empty and close the array |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
62 |
iArray.ResetAndDestroy(); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
63 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
64 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
65 |
// -------------------------------------------------------------------------- |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
66 |
// CUpnpCdsLiteObjectArray::AppendL |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
67 |
// -------------------------------------------------------------------------- |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
68 |
// |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
69 |
EXPORT_C void CUpnpCdsLiteObjectArray::AppendL( CUpnpCdsLiteObject *aObject ) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
70 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
71 |
// Validate the parameter |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
72 |
if( !aObject || |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
73 |
aObject->Name() == KNullDesC8 || |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
74 |
aObject->ObjectId() == KNullDesC8 || |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
75 |
aObject->ParentId() == KNullDesC8 || |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
76 |
aObject->ObjectClass() == KNullDesC8 || |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
77 |
( aObject->Type() != CUpnpCdsLiteObject::EContainer && |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
78 |
aObject->Type() != CUpnpCdsLiteObject::EItem && |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
79 |
aObject->Type() != CUpnpCdsLiteObject::EItemReference ) || |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
80 |
( aObject->Type() == CUpnpCdsLiteObject::EItemReference && |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
81 |
aObject->OriginalItemIdL() == KNullDesC8 ) ) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
82 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
83 |
User::Leave( KErrArgument ); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
84 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
85 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
86 |
// Append the item into the array. Leave if there is a problem. |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
87 |
TInt appendError = iArray.Append( aObject ); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
88 |
if( appendError != KErrNone ) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
89 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
90 |
User::Leave( appendError ); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
91 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
92 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
93 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
94 |
// -------------------------------------------------------------------------- |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
95 |
// CUpnpCdsLiteObjectArray::FindByName |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
96 |
// -------------------------------------------------------------------------- |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
97 |
// |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
98 |
EXPORT_C TInt CUpnpCdsLiteObjectArray::FindByName( TDesC8& aName ) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
99 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
100 |
__LOG( "[CUpnpSharingAlgorithm]\t CUpnpCdsLiteObjectArray::FindByName" ); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
101 |
TInt returnvalue = KErrNotFound; |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
102 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
103 |
// Continue only if the given parameter is valid |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
104 |
if( aName != KNullDesC8 ) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
105 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
106 |
// Go through the array |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
107 |
for( TInt index=0; index<iArray.Count(); index++ ) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
108 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
109 |
// if a match is found, exit the loop |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
110 |
if( aName.Match( iArray[index]->Name() ) >= 0 ) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
111 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
112 |
returnvalue = index; |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
113 |
index = iArray.Count() + 1; |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
114 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
115 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
116 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
117 |
return returnvalue; |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
118 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
119 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
120 |
// -------------------------------------------------------------------------- |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
121 |
// CUpnpCdsLiteObjectArray::FindByNameAndParentId |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
122 |
// -------------------------------------------------------------------------- |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
123 |
// |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
124 |
EXPORT_C TInt CUpnpCdsLiteObjectArray::FindByNameAndParentId( |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
125 |
const TDesC8& aName, |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
126 |
const TDesC8& aParentId ) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
127 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
128 |
__LOG( "[CUpnpSharingAlgorithm]\t CUpnpCdsLiteObjectArray::\ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
129 |
FindByNameAndParentId" ); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
130 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
131 |
TInt returnvalue = KErrNotFound; |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
132 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
133 |
// Continue only if the given parameter is valid |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
134 |
if( aName != KNullDesC8 && aParentId != KNullDesC8 ) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
135 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
136 |
// Go through the array |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
137 |
for( TInt index=0; index<iArray.Count(); index++ ) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
138 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
139 |
// if a match is found, exit the loop |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
140 |
if( aName.Match( iArray[index]->Name() ) >= 0 && |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
141 |
aParentId.Match( iArray[index]->ParentId() ) >= 0 ) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
142 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
143 |
returnvalue = index; |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
144 |
index = iArray.Count() + 1; |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
145 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
146 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
147 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
148 |
return returnvalue; |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
149 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
150 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
151 |
// -------------------------------------------------------------------------- |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
152 |
// CUpnpCdsLiteObjectArray::FindByMediaClassAndParentId |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
153 |
// -------------------------------------------------------------------------- |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
154 |
// |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
155 |
EXPORT_C TInt CUpnpCdsLiteObjectArray::FindByMediaClassAndParentId( |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
156 |
const TDesC8& aMediaClass, |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
157 |
const TDesC8& aParentId ) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
158 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
159 |
__LOG( "[CUpnpSharingAlgorithm]\t CUpnpCdsLiteObjectArray::\ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
160 |
FindByMediaClassAndParentId" ); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
161 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
162 |
TInt returnvalue = KErrNotFound; |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
163 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
164 |
// Continue only if the given parameter is valid |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
165 |
if( aMediaClass != KNullDesC8 && |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
166 |
aParentId != KNullDesC8 ) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
167 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
168 |
// Go through the array |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
169 |
for( TInt index=0; index<iArray.Count(); index++ ) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
170 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
171 |
// if a match is found, exit the loop |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
172 |
if( aMediaClass.Match( iArray[index]->ObjectClass() ) >= 0 && |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
173 |
aParentId.Match( iArray[index]->ParentId() ) >= 0 ) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
174 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
175 |
returnvalue = index; |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
176 |
index = iArray.Count() + 1; |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
177 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
178 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
179 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
180 |
return returnvalue; |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
181 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
182 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
183 |
// -------------------------------------------------------------------------- |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
184 |
// CUpnpCdsLiteObjectArray::FindByObjectId |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
185 |
// -------------------------------------------------------------------------- |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
186 |
// |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
187 |
EXPORT_C TInt CUpnpCdsLiteObjectArray::FindByObjectId( |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
188 |
const TDesC8& aObjectId ) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
189 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
190 |
__LOG( "[CUpnpSharingAlgorithm]\t CUpnpCdsLiteObjectArray::\ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
191 |
FindByObjectId" ); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
192 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
193 |
TInt returnvalue = KErrNotFound; |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
194 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
195 |
// Continue only if the given parameter is valid |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
196 |
if( aObjectId != KNullDesC8 ) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
197 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
198 |
// Go through the array |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
199 |
for( TInt index=0; index<iArray.Count(); index++ ) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
200 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
201 |
// if a match is found, exit the loop |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
202 |
if( aObjectId.Match( iArray[index]->ObjectId() ) >= 0 ) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
203 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
204 |
returnvalue = index; |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
205 |
index = iArray.Count() + 1; |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
206 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
207 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
208 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
209 |
return returnvalue; |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
210 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
211 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
212 |
// -------------------------------------------------------------------------- |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
213 |
// CUpnpCdsLiteObjectArray::FindRefItemIdByOriginalIdL |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
214 |
// -------------------------------------------------------------------------- |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
215 |
// |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
216 |
EXPORT_C TInt CUpnpCdsLiteObjectArray::FindRefItemIdByOriginalIdL( |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
217 |
const TDesC8& aOriginalId ) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
218 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
219 |
__LOG( "[CUpnpSharingAlgorithm]\t CUpnpCdsLiteObjectArray::\ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
220 |
FindRefItemIdByOriginalIdL" ); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
221 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
222 |
TInt returnvalue = KErrNotFound; |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
223 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
224 |
// Continue only if the given parameter is valid |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
225 |
if( aOriginalId != KNullDesC8 ) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
226 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
227 |
// Go through the array |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
228 |
for( TInt index=0; index<iArray.Count(); index++ ) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
229 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
230 |
// if a match is found, exit the loop |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
231 |
if( iArray[index]->Type() == |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
232 |
CUpnpCdsLiteObject::EItemReference && |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
233 |
aOriginalId.Match( iArray[index]->OriginalItemIdL() ) >= 0 ) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
234 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
235 |
returnvalue = index; |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
236 |
index = iArray.Count() + 1; |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
237 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
238 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
239 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
240 |
return returnvalue; |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
241 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
242 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
243 |
// -------------------------------------------------------------------------- |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
244 |
// CUpnpCdsLiteObjectArray::ChildCount |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
245 |
// -------------------------------------------------------------------------- |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
246 |
// |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
247 |
EXPORT_C TInt CUpnpCdsLiteObjectArray::ChildCount( const TDesC8& aObjectId ) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
248 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
249 |
__LOG( "[CUpnpSharingAlgorithm]\t CUpnpCdsLiteObjectArray::ChildCount" ); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
250 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
251 |
TInt returnvalue ( 0 ); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
252 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
253 |
// Continue only if the given parameter is valid |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
254 |
if( aObjectId != KNullDesC8 ) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
255 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
256 |
// Go through the array |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
257 |
for( TInt index=0; index<iArray.Count(); index++ ) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
258 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
259 |
// if a match is found, increase child count |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
260 |
if( aObjectId.Match( iArray[index]->ParentId() ) >= 0 ) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
261 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
262 |
returnvalue++; |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
263 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
264 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
265 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
266 |
return returnvalue; |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
267 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
268 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
269 |
// -------------------------------------------------------------------------- |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
270 |
// CUpnpCdsLiteObjectArray::Count |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
271 |
// -------------------------------------------------------------------------- |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
272 |
// |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
273 |
EXPORT_C TInt CUpnpCdsLiteObjectArray::Count( ) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
274 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
275 |
return iArray.Count(); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
276 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
277 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
278 |
// -------------------------------------------------------------------------- |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
279 |
// CUpnpCdsLiteObjectArray::ObjectAtL |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
280 |
// -------------------------------------------------------------------------- |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
281 |
// |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
282 |
EXPORT_C CUpnpCdsLiteObject& CUpnpCdsLiteObjectArray::ObjectAtL( |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
283 |
TUint aIndex ) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
284 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
285 |
__LOG( "[CUpnpSharingAlgorithm]\t CUpnpCdsLiteObjectArray::ObjectAtL" ); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
286 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
287 |
// Validate the parameter |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
288 |
if( aIndex > iArray.Count() ) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
289 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
290 |
User::Leave( KErrArgument ); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
291 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
292 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
293 |
// Return a reference to the object |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
294 |
CUpnpCdsLiteObject* object = iArray[aIndex]; |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
295 |
return *object; |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
296 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
297 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
298 |
// -------------------------------------------------------------------------- |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
299 |
// CUpnpCdsLiteObjectArray::RemoveObjectAtL |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
300 |
// -------------------------------------------------------------------------- |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
301 |
// |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
302 |
EXPORT_C void CUpnpCdsLiteObjectArray::RemoveObjectAtL( TUint aIndex ) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
303 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
304 |
__LOG( "[CUpnpSharingAlgorithm]\t CUpnpCdsLiteObjectArray::\ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
305 |
RemoveObjectAtL" ); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
306 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
307 |
// Validate the parameter |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
308 |
if( aIndex > iArray.Count() ) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
309 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
310 |
User::Leave( KErrArgument ); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
311 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
312 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
313 |
// Get the pointer from the array |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
314 |
CUpnpCdsLiteObject* object = iArray[aIndex]; |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
315 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
316 |
// Remove the object and compress the array |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
317 |
iArray.Remove( aIndex ); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
318 |
iArray.Compress(); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
319 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
320 |
// Delete the object |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
321 |
delete object; |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
322 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
323 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
324 |
// -------------------------------------------------------------------------- |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
325 |
// CUpnpCdsLiteObjectArray::AppendL |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
326 |
// -------------------------------------------------------------------------- |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
327 |
// |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
328 |
EXPORT_C void CUpnpCdsLiteObjectArray::AppendL( const CUpnpObject *aObject ) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
329 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
330 |
// First, create a new CreateUpnpCdsLiteObject |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
331 |
CUpnpCdsLiteObject* object = CreateUpnpCdsLiteObjectL( aObject ); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
332 |
CleanupStack::PushL( object ); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
333 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
334 |
// Append the item to the array |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
335 |
AppendL( object ); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
336 |
CleanupStack::Pop( object ); // ownership transfered |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
337 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
338 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
339 |
// -------------------------------------------------------------------------- |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
340 |
// CUpnpCdsLiteObjectArray::RemoveL |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
341 |
// -------------------------------------------------------------------------- |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
342 |
// |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
343 |
EXPORT_C void CUpnpCdsLiteObjectArray::RemoveL( const CUpnpObject *aObject ) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
344 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
345 |
__LOG( "[CUpnpSharingAlgorithm]\t CUpnpCdsLiteObjectArray::RemoveL" ); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
346 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
347 |
// First, create a new CreateUpnpCdsLiteObject |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
348 |
CUpnpCdsLiteObject* object = CreateUpnpCdsLiteObjectL( aObject ); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
349 |
CleanupStack::PushL( object ); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
350 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
351 |
// Search the array and remove the object if found |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
352 |
TInt index = FindByObjectId( object->ObjectId() ); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
353 |
if( index >= 0 ) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
354 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
355 |
RemoveObjectAtL( index ); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
356 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
357 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
358 |
// Clean up |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
359 |
CleanupStack::PopAndDestroy( object ); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
360 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
361 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
362 |
// -------------------------------------------------------------------------- |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
363 |
// CUpnpCdsLiteObjectArray::CreateUpnpCdsLiteObjectL |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
364 |
// -------------------------------------------------------------------------- |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
365 |
// |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
366 |
CUpnpCdsLiteObject* CUpnpCdsLiteObjectArray::CreateUpnpCdsLiteObjectL( |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
367 |
const CUpnpObject *aObject ) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
368 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
369 |
// Check the param |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
370 |
if( !aObject ) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
371 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
372 |
User::Leave( KErrArgument ); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
373 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
374 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
375 |
CUpnpCdsLiteObject* object = NULL; |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
376 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
377 |
// Object is a container |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
378 |
if( aObject->ObjectClass().Find( KContainerClass() ) >= 0 ) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
379 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
380 |
// Cast to container object |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
381 |
CUpnpContainer* container = (CUpnpContainer*)aObject; |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
382 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
383 |
// Create the object accordingly |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
384 |
object = CUpnpCdsLiteObject::NewL( container->Title(), |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
385 |
CUpnpCdsLiteObject::EContainer, |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
386 |
container->Id(), |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
387 |
container->ParentId(), |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
388 |
container->ObjectClass() ); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
389 |
CleanupStack::PushL( object ); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
390 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
391 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
392 |
// Object is an item / reference item |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
393 |
else if( aObject->ObjectClass().Find( KItemClass() ) >= 0 ) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
394 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
395 |
// Cast to container object |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
396 |
CUpnpItem* item = (CUpnpItem*)aObject; |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
397 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
398 |
HBufC8* fileName = NULL; |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
399 |
// Resolve the type |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
400 |
CUpnpCdsLiteObject::TCdsLiteObjectType type = |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
401 |
CUpnpCdsLiteObject::EUnknown; |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
402 |
if( item->RefId() == KNullDesC8 ) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
403 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
404 |
type = CUpnpCdsLiteObject::EItem; |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
405 |
fileName = ResolveFileNameL( aObject ); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
406 |
CleanupStack::PushL( fileName ); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
407 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
408 |
else |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
409 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
410 |
type = CUpnpCdsLiteObject::EItemReference; |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
411 |
// Set space for reference filename. |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
412 |
// Item validation requires that CDS lite object's name field must |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
413 |
// be different that KNullDesC8. |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
414 |
// Mediaserver doesn't store this field for reference item and it |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
415 |
// is KNullDesC8 when structrure is read from server. |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
416 |
fileName = KSpace().AllocLC(); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
417 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
418 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
419 |
// Create the object accordingly |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
420 |
object = CUpnpCdsLiteObject::NewL( *fileName, |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
421 |
type, |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
422 |
item->Id(), |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
423 |
item->ParentId(), |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
424 |
item->ObjectClass() ); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
425 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
426 |
if ( fileName ) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
427 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
428 |
CleanupStack::PopAndDestroy( fileName ); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
429 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
430 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
431 |
CleanupStack::PushL( object ); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
432 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
433 |
// Set the reference ID, if necessary |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
434 |
if( type == CUpnpCdsLiteObject::EItemReference ) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
435 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
436 |
object->SetOriginalItemIdL( item->RefId() ); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
437 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
438 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
439 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
440 |
// Object is neither a container nor an item, leave |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
441 |
else |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
442 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
443 |
User::Leave( KErrArgument ); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
444 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
445 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
446 |
CleanupStack::Pop( object ); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
447 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
448 |
return object; |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
449 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
450 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
451 |
// -------------------------------------------------------------------------- |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
452 |
// CUpnpCdsLiteObjectArray::ResolveFileNameL |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
453 |
// -------------------------------------------------------------------------- |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
454 |
// |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
455 |
HBufC8* CUpnpCdsLiteObjectArray::ResolveFileNameL( |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
456 |
const CUpnpObject *aObject ) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
457 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
458 |
__LOG( "[CUpnpSharingAlgorithm]\t CUpnpCdsLiteObjectArray::\ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
459 |
ResolveFileNameL" ); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
460 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
461 |
// Check parameter |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
462 |
if( !aObject ) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
463 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
464 |
User::Leave( KErrArgument ); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
465 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
466 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
467 |
HBufC8* returnValue = NULL; |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
468 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
469 |
// Get all the elements |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
470 |
const RUPnPElementsArray& elements = |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
471 |
( const_cast<CUpnpObject*>(aObject) )->GetElements(); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
472 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
473 |
// Find the "res" element |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
474 |
for( TInt index=0; index<elements.Count(); index++ ) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
475 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
476 |
if( elements[index]->Name() == KElementRes ) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
477 |
{ |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
478 |
// Parse the filename |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
479 |
TParse fp; |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
480 |
fp.Set( elements[index]->FilePath(), 0, 0 ); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
481 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
482 |
// Full filename (path and drive letter included) |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
483 |
returnValue = |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
484 |
EscapeUtils::ConvertFromUnicodeToUtf8L( fp.FullName() ); |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
485 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
486 |
// Exit the loop |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
487 |
index = elements.Count() + 1; |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
488 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
489 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
490 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
491 |
return returnValue; |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
492 |
} |
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
493 |
|
08b5eae9f9ff
merge from Nokia's internal development branch
Sampo Huttunen <sampo.huttunen@nokia.com>
parents:
diff
changeset
|
494 |
// End of file |