author | Sampo Huttunen <sampo.huttunen@nokia.com> |
Wed, 24 Nov 2010 09:39:46 +0200 | |
branch | IOP_Improvements |
changeset 45 | a6c41ca11adf |
parent 38 | 5360b7ddc251 |
permissions | -rw-r--r-- |
38
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1 |
/** @file |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
2 |
* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
3 |
* All rights reserved. |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
5 |
* under the terms of "Eclipse Public License v1.0" |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
8 |
* |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
9 |
* Initial Contributors: |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
11 |
* |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
12 |
* Contributors: |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
13 |
* |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
14 |
* Description: Element Factory. |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
15 |
* |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
16 |
*/ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
17 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
18 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
19 |
// INCLUDE FILES |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
20 |
#include <sysutil.h> |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
21 |
#include <uri8.h> |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
22 |
#include <xmlengdomparser.h> |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
23 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
24 |
#include "upnpelementfactory.h" |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
25 |
#include "upnpcontentdirectoryglobals.h" |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
26 |
#include "upnpstring.h" |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
27 |
#include "upnpprotocolinfo.h" |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
28 |
#include "upnpcommonupnplits.h" |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
29 |
#include "upnpcdutils.h" |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
30 |
#include "upnpprotocolinfolocal.h" |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
31 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
32 |
using namespace UpnpDlnaProtocolInfo; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
33 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
34 |
// ============================= LOCAL FUNCTIONS =============================== |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
35 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
36 |
// DestroyRPointerArray |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
37 |
// Used by TCleanupItem to destroy array |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
38 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
39 |
// |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
40 |
void DestroyRArray(TAny* aArray) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
41 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
42 |
RArray<RXmlEngDocument>* array = (RArray<RXmlEngDocument>*) aArray; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
43 |
for(TInt i = 0; i < array->Count(); i++ ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
44 |
(*array)[i].Close(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
45 |
(*array).Close(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
46 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
47 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
48 |
// ============================ MEMBER FUNCTIONS =============================== |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
49 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
50 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
51 |
// CUpnpElementFactory::~CUpnpElementFactory() |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
52 |
// C++ default destructor. (virtual destructor) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
53 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
54 |
// |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
55 |
CUpnpElementFactory::~CUpnpElementFactory() |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
56 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
57 |
//Close XML document |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
58 |
iDocument.Close(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
59 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
60 |
iDOMImpl.Close(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
61 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
62 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
63 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
64 |
// CUpnpElementFactory::NewL() |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
65 |
// Two-phased constructor |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
66 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
67 |
// |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
68 |
CUpnpElementFactory* CUpnpElementFactory::NewL( const TDesC& aObjectsXmlPath ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
69 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
70 |
CUpnpElementFactory* self = CUpnpElementFactory::NewLC( aObjectsXmlPath ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
71 |
CleanupStack::Pop( self ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
72 |
return self; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
73 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
74 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
75 |
// CUpnpElementFactory::NewLC() |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
76 |
// Two-phased constructor |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
77 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
78 |
// |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
79 |
CUpnpElementFactory* CUpnpElementFactory::NewLC( const TDesC& aObjectsXmlPath ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
80 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
81 |
CUpnpElementFactory* self = new (ELeave) CUpnpElementFactory(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
82 |
CleanupStack::PushL( self ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
83 |
self->ConstructL( aObjectsXmlPath ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
84 |
return self; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
85 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
86 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
87 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
88 |
// CUpnpElementFactory::ConstructL() |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
89 |
// Two-phased constructor |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
90 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
91 |
// |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
92 |
void CUpnpElementFactory::ConstructL(const TDesC& aObjectsXmlPath) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
93 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
94 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
95 |
iDOMImpl.OpenL(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
96 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
97 |
RXmlEngDOMParser parser; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
98 |
User::LeaveIfError( parser.Open(iDOMImpl) ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
99 |
CleanupClosePushL(parser); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
100 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
101 |
if ( aObjectsXmlPath == KNullDesC() ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
102 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
103 |
RFs fs; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
104 |
User::LeaveIfError(fs.Connect()); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
105 |
CleanupClosePushL(fs); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
106 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
107 |
TFileName path; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
108 |
User::LeaveIfError(fs.PrivatePath(path)); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
109 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
110 |
// Load dll file |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
111 |
TFileName objectsXmlFileName( KObjectsXmlFileName() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
112 |
TFileName dllName; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
113 |
Dll::FileName( dllName ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
114 |
TBuf<2> drive = dllName.Left( 2 ); // Drive letter followed by ':' |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
115 |
objectsXmlFileName.Insert( 0, drive ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
116 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
117 |
TParse fp; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
118 |
fp.Set(objectsXmlFileName,&path, 0); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
119 |
path = fp.FullName(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
120 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
121 |
iDocument = parser.ParseFileL( path ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
122 |
CleanupStack::PopAndDestroy(&fs); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
123 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
124 |
else |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
125 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
126 |
iDocument = parser.ParseFileL( aObjectsXmlPath ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
127 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
128 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
129 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
130 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
131 |
CleanupStack::PopAndDestroy(&parser); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
132 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
133 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
134 |
// CUpnpElementFactory::CUpnpElementFactory() |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
135 |
// Default constructor |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
136 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
137 |
// |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
138 |
CUpnpElementFactory::CUpnpElementFactory() |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
139 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
140 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
141 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
142 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
143 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
144 |
// CUpnpElementFactory::CheckRestrictedValue() |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
145 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
146 |
// |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
147 |
TBool CUpnpElementFactory::CheckRestrictedValue (TPtrC8& restrVal) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
148 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
149 |
TBool retVal = EFalse; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
150 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
151 |
if ( |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
152 |
(UpnpCD::Kfalse().Compare( restrVal ) != 0) && |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
153 |
(UpnpCD::KZero().Compare( restrVal ) != 0) && |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
154 |
(UpnpCD::Ktrue().Compare( restrVal ) != 0) && |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
155 |
(UpnpCD::KOne().Compare( restrVal ) != 0) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
156 |
) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
157 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
158 |
retVal = ETrue; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
159 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
160 |
return retVal; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
161 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
162 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
163 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
164 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
165 |
// CUpnpElementFactory::ValidateNewObjectL() |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
166 |
// Function to validate a new object given by Control Point, especially |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
167 |
// upnp:class element field eg. object.item.musictrack |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
168 |
// IMPORTANT: If objects's description is invalid due to missing elements |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
169 |
// it tries to repair it by adding those missing elements. |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
170 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
171 |
// |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
172 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
173 |
TUpnpErrorCode CUpnpElementFactory::ValidateNewObjectL( const TXmlEngElement& aNewElement, TBool aNew, TBool aLocalSharing) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
174 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
175 |
TInt i; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
176 |
TPtrC8 objectType = KItem(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
177 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
178 |
RXmlEngNodeList<TXmlEngElement> elements; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
179 |
CleanupClosePushL(elements); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
180 |
aNewElement.GetChildElements( elements ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
181 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
182 |
// invalid element if the count of the objects is less than 1 (=0) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
183 |
if ( elements.Count() != 1 ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
184 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
185 |
User::Leave( EInvalidArgs ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
186 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
187 |
CleanupStack::PopAndDestroy(&elements); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
188 |
// try to find the new item from the xml |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
189 |
TXmlEngElement object; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
190 |
UpnpDomInterface::GetElementL( aNewElement, object, KItem() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
191 |
if ( object.IsNull() ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
192 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
193 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
194 |
// if it's not an item, it's a container |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
195 |
UpnpDomInterface::GetElementL( aNewElement, object, KContainer() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
196 |
if ( object.IsNull() ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
197 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
198 |
// not even a container, leave! |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
199 |
User::Leave ( EInvalidArgs ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
200 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
201 |
objectType.Set( KContainer() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
202 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
203 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
204 |
// restriced value |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
205 |
TPtrC8 restrVal = UpnpDomInterface::GetAttrValueL( object, KRestricted ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
206 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
207 |
if (CheckRestrictedValue(restrVal)) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
208 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
209 |
User::Leave ( EBadMetadata); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
210 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
211 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
212 |
// for convenience later, take now a reference to the children of the object |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
213 |
RXmlEngNodeList<TXmlEngElement> children; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
214 |
CleanupClosePushL(children); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
215 |
object.GetChildElements( children ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
216 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
217 |
// an exception: we can't have <res importUri=".. element in |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
218 |
// a new object (set by control point) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
219 |
while ( children.HasNext() ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
220 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
221 |
TXmlEngElement child = children.Next(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
222 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
223 |
if ( IsNotEmptyImportUriL( child ) && aNew ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
224 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
225 |
User::Leave ( EBadMetadata ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
226 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
227 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
228 |
//---- check res@duration, 7.3.22 MM DIDL-Lite res@duration Format |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
229 |
CheckDurationOfResElementL(child); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
230 |
CheckSizeOfResElementL(child); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
231 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
232 |
RXmlEngNodeList<TXmlEngElement> forbiddenChildren; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
233 |
CleanupClosePushL(forbiddenChildren); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
234 |
child.GetChildElements( forbiddenChildren ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
235 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
236 |
if ( forbiddenChildren.HasNext() |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
237 |
&& child.Name() != KVendorDescriptor ) // ignore <desc></desc> |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
238 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
239 |
User::Leave ( EBadMetadata ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
240 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
241 |
CleanupStack::PopAndDestroy(&forbiddenChildren); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
242 |
if ( child.Name() == KDate8() ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
243 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
244 |
if (!UpnpCdUtils::ValidateDateL(child.Value())) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
245 |
child.Remove(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
246 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
247 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
248 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
249 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
250 |
// if survived here, we have the new element of type item or container |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
251 |
// let's analyze its type |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
252 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
253 |
// let's inspect each of types |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
254 |
// at first, collect object type descriptions from objects xml |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
255 |
// to a pointer array |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
256 |
RArray<TXmlEngElement> objectDescrs; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
257 |
CleanupClosePushL( objectDescrs ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
258 |
// store class descriptor elements in this array |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
259 |
ClassesL( object, objectDescrs, objectType ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
260 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
261 |
// validate each separately |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
262 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
263 |
ValidatePropertiesL(object, objectDescrs); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
264 |
if(aNew) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
265 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
266 |
ValidateBigImageL(object); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
267 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
268 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
269 |
// for each type, check that |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
270 |
// this new object has all the required fields |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
271 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
272 |
for (i=0; i<objectDescrs.Count(); i++) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
273 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
274 |
// now we have to go through all the fields of the new item |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
275 |
// first, for convenience take a pointer to <ps>(properties) element |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
276 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
277 |
RXmlEngNodeList<TXmlEngElement> propElems; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
278 |
CleanupClosePushL(propElems); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
279 |
objectDescrs[i].GetChildElements( propElems ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
280 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
281 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
282 |
while ( propElems.HasNext() ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
283 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
284 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
285 |
TXmlEngElement ps = propElems.Next(); // ps stands for properties |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
286 |
if ( ps.Name() == KProperties() ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
287 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
288 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
289 |
// take the properties |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
290 |
RXmlEngNodeList<TXmlEngElement> properties; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
291 |
CleanupClosePushL(properties); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
292 |
ps.GetChildElements( properties ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
293 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
294 |
const TDesC8& propertyType = UpnpDomInterface::GetAttrValueL( ps, KType() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
295 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
296 |
TBool elementFound(EFalse); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
297 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
298 |
// check each property |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
299 |
while ( properties.HasNext() ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
300 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
301 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
302 |
TXmlEngElement el = properties.Next(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
303 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
304 |
elementFound = ValidateElementL (object, propertyType, el, elementFound, aNew, aLocalSharing); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
305 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
306 |
// Validate attribute |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
307 |
if ( propertyType == KAttribute() ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
308 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
309 |
elementFound = EFalse; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
310 |
ValidateAttributeL(el, object); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
311 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
312 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
313 |
CleanupStack::PopAndDestroy(&properties); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
314 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
315 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
316 |
CleanupStack::PopAndDestroy(&propElems); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
317 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
318 |
CleanupStack::PopAndDestroy(); //objectDescrs.Close(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
319 |
CleanupStack::PopAndDestroy(&children); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
320 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
321 |
// now the object |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
322 |
// * has the all required fields (if some were missing, they are added) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
323 |
// * had a proper xml structure (_not_ using UpnpDomInterface:: functions that do not care) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
324 |
// * has for sure a mostly proper object structure |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
325 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
326 |
return EUndefined; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
327 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
328 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
329 |
TBool CUpnpElementFactory::ValidateElementL (TXmlEngElement aObject, |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
330 |
const TDesC8& aPropertyType, TXmlEngElement aEl, TBool aElementFound, TBool aNew, |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
331 |
TBool aLocalSharing) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
332 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
333 |
TBool elementFound = aElementFound; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
334 |
RXmlEngNodeList<TXmlEngElement> children; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
335 |
// Validate element |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
336 |
if ( aPropertyType == KElement() ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
337 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
338 |
elementFound = EFalse; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
339 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
340 |
// Check if this element is requiered |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
341 |
const TDesC8& required = UpnpDomInterface::GetAttrValueL( aEl, KRequiredObject() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
342 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
343 |
TPtrC8 elementName = UpnpDomInterface::GetAttrValueL( aEl, KName() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
344 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
345 |
// If it's required then check it's existence |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
346 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
347 |
if ( required == UpnpCD::KOne() || elementName == KRes() || elementName == KAlbumArtURI() ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
348 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
349 |
if( !KRes().Compare(elementName) || !KAlbumArtURI().Compare(elementName)) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
350 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
351 |
elementFound = ETrue; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
352 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
353 |
// get children once more, because this kind of list does not have any reset function |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
354 |
aObject.GetChildElements( children ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
355 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
356 |
elementFound = HandleChildrenL (children, aNew, aLocalSharing, elementFound, aEl); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
357 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
358 |
// If not found, add it |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
359 |
if ( !elementFound ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
360 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
361 |
User::Leave(EBadMetadata); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
362 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
363 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
364 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
365 |
return elementFound; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
366 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
367 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
368 |
TBool CUpnpElementFactory::HandleChildrenL (RXmlEngNodeList<TXmlEngElement> aChildren, TBool aNew, TBool aLocalSharing, |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
369 |
TBool aElementFound, TXmlEngElement aEl) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
370 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
371 |
TBool elementFound = aElementFound; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
372 |
TPtrC8 elementName = UpnpDomInterface::GetAttrValueL( aEl, KName() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
373 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
374 |
while ( aChildren.HasNext() ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
375 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
376 |
TXmlEngElement child = aChildren.Next(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
377 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
378 |
HBufC8* nameWithNs = NameWithNsLC( child ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
379 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
380 |
if ( *nameWithNs == elementName ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
381 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
382 |
// local sharing |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
383 |
if(aNew && *nameWithNs == KRes) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
384 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
385 |
TUriParser8 up; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
386 |
TPtrC8 rv(child.Text()); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
387 |
if(rv.Length()) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
388 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
389 |
User::LeaveIfError( up.Parse(child.Text()) ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
390 |
TPtrC8 path( up.Extract(EUriPath) ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
391 |
TPtrC8 scheme( up.Extract(EUriScheme) ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
392 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
393 |
if(aLocalSharing) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
394 |
{ // local action |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
395 |
if( scheme == UpnpHTTP::KSchemeFile8()) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
396 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
397 |
// The path can be: /c:/.... |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
398 |
// or /c/... - without colon. |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
399 |
// Both situation are correct but |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
400 |
// in further operations we assume |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
401 |
// there is not any colon next to the drive letter. |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
402 |
// Therefore, remove it if second element of path table equals ':' |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
403 |
if(path[2] == KColon8()[0]) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
404 |
{ // There IS a colon next to the drive letter. |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
405 |
// Here is an example uri: |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
406 |
// file:///c:/... |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
407 |
// As you can see the second colon must be removed |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
408 |
HBufC8* uri = child.Text().AllocLC(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
409 |
TPtr8 uriPtr(uri->Des()); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
410 |
TPtrC8 tmp(uri->Des()); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
411 |
TInt second = 2; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
412 |
TInt colonPos = 0; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
413 |
for(TInt i = 0; i < second; i++) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
414 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
415 |
colonPos += tmp.Find(KColon8) + 1; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
416 |
tmp.Set( uriPtr.Mid(colonPos) ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
417 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
418 |
// remove the colon |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
419 |
uriPtr.Replace(colonPos - 1, KColon8().Length(), KNullString8); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
420 |
// set TXmlEngElement value |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
421 |
child.SetTextL(uriPtr); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
422 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
423 |
// clean up |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
424 |
CleanupStack::PopAndDestroy(uri); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
425 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
426 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
427 |
// check other restrictions |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
428 |
TUriParser8 up; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
429 |
User::LeaveIfError( up.Parse(child.Text()) ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
430 |
TPtrC8 path( up.Extract(EUriPath) ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
431 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
432 |
// sharing from Z: drive is forbidden |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
433 |
// second character is a drive letter |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
434 |
if(path[1] == KForbiddenDrivez()[0] || path[1] == KForbiddenDriveZ()[0]) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
435 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
436 |
User::Leave(EArgumentValue); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
437 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
438 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
439 |
// cannot share from private directory |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
440 |
if(!path.Match(KForbiddenPrivatePattern)) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
441 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
442 |
User::Leave(EArgumentValue); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
443 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
444 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
445 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
446 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
447 |
else |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
448 |
{ // not local action |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
449 |
// "file" schema is forbidden here |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
450 |
if(scheme == UpnpHTTP::KSchemeFile8()) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
451 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
452 |
User::Leave(EArgumentValue); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
453 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
454 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
455 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
456 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
457 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
458 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
459 |
if ( elementFound ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
460 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
461 |
// multiple values for one element! |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
462 |
const TDesC8& multiple = UpnpDomInterface::GetAttrValueL( aEl, KMultiple() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
463 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
464 |
// if it's not allowed for this element, leave! |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
465 |
if ( !multiple.Length() ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
466 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
467 |
User::Leave( EInvalidArgs ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
468 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
469 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
470 |
elementFound = ETrue; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
471 |
// mark the element required - if not res |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
472 |
if( KRes().Compare(elementName) && KAlbumArtURI().Compare(elementName)) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
473 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
474 |
child.AddNewAttributeL(KRequiredAtrName,KTrueValue8); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
475 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
476 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
477 |
// nested validation |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
478 |
RXmlEngNodeList<TXmlEngElement> nestEls; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
479 |
CleanupClosePushL(nestEls); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
480 |
aEl.GetChildElements(nestEls); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
481 |
CheckNestedElementsL(nestEls, child, aLocalSharing); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
482 |
CleanupStack::PopAndDestroy(&nestEls); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
483 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
484 |
CleanupStack::PopAndDestroy( nameWithNs ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
485 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
486 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
487 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
488 |
return elementFound; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
489 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
490 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
491 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
492 |
void CUpnpElementFactory::CheckNestedElementsL(RXmlEngNodeList<TXmlEngElement> aNestEls, TXmlEngElement aChild, |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
493 |
TBool aLocalSharing) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
494 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
495 |
HBufC8* nameWithNs = NameWithNsLC( aChild ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
496 |
while(aNestEls.HasNext()) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
497 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
498 |
TXmlEngElement nestPs = aNestEls.Next(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
499 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
500 |
// take the properties |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
501 |
RXmlEngNodeList<TXmlEngElement> nestProperties; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
502 |
nestPs.GetChildElements( nestProperties ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
503 |
const TDesC8& nestPropertyType = UpnpDomInterface::GetAttrValueL( nestPs, KType() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
504 |
// Validate attribute |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
505 |
if ( nestPropertyType == KAttribute() ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
506 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
507 |
while(nestProperties.HasNext()) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
508 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
509 |
TXmlEngElement nestEl = nestProperties.Next(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
510 |
//TBool nestElementFound; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
511 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
512 |
//nestElementFound = EFalse; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
513 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
514 |
const TDesC8& nestRequired = UpnpDomInterface::GetAttrValueL( nestEl, KRequiredObject() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
515 |
TPtrC8 nestElementName = UpnpDomInterface::GetAttrValueL( nestEl, KName() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
516 |
if ( nestRequired == UpnpCD::KOne() || nestElementName == KDlnaProfileID) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
517 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
518 |
TPtrC8 nestCurrentValue = UpnpDomInterface::GetAttrValueL( aChild, nestElementName ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
519 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
520 |
TPtrC8 nameOfAttr; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
521 |
TPtrC8 valOfAttr; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
522 |
nameOfAttr.Set( nestElementName ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
523 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
524 |
// Start of 'dlna:profileID' attribute case |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
525 |
if( nameWithNs->Des() == KAlbumArtURI && nestElementName == KDlnaProfileID) // ---------------- 1 ------------ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
526 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
527 |
TXmlEngAttr profId = aChild.AttributeNodeL(KProfileID, KXmlnsDlna); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
528 |
if(profId.NotNull()) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
529 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
530 |
if (profId.Value().Compare(KDefaultProfileID)) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
531 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
532 |
User::Leave( EBadMetadata ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
533 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
534 |
// setting real name of attribute -> localName |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
535 |
nestElementName.Set(KProfileID); // descriptor |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
536 |
nameOfAttr.Set( nestElementName ); // related TString |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
537 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
538 |
// generating a new value of 'dlna:profileID' |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
539 |
HBufC8* albumArtURIelemValue = UpnpDomInterface::GetElementValueL(aChild).AllocLC(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
540 |
TPtr8 albumArtURIelemValuePtr( albumArtURIelemValue->Des() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
541 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
542 |
albumArtURIelemValuePtr.Trim(); // deletes leading and trailing whitespace characters |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
543 |
aChild.SetValueL(albumArtURIelemValuePtr); // sets new trimmed value to albumArtURI |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
544 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
545 |
CUpnpDlnaProtocolInfo* tempProtocolInfo = NULL; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
546 |
TInt error = iContentDirectory->GetProtocolInfoL( albumArtURIelemValuePtr, tempProtocolInfo ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
547 |
TPtrC8 tempPnParam; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
548 |
if( error >=0 ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
549 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
550 |
tempPnParam.Set( tempProtocolInfo->PnParameter() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
551 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
552 |
nestCurrentValue.Set(tempPnParam); // descriptor |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
553 |
valOfAttr.Set(tempPnParam); // related TString |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
554 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
555 |
else |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
556 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
557 |
User::Leave( EBadMetadata ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
558 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
559 |
CleanupStack::PopAndDestroy(albumArtURIelemValue); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
560 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
561 |
// if albumArtURI doesn't contain profileID -> it creates one and also related namespace |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
562 |
// if albumArtURI contains profileID -> it modifies profileID's value |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
563 |
aChild.SetAttributeL( nameOfAttr, valOfAttr, KXmlnsDlna(), KDlnaPrefix() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
564 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
565 |
delete tempProtocolInfo; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
566 |
tempProtocolInfo = NULL; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
567 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
568 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
569 |
} // End of 'dlna:profileID' attribute case |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
570 |
else |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
571 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
572 |
if ( !nestCurrentValue.Length() ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
573 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
574 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
575 |
if(nestElementName == KprotocolInfo) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
576 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
577 |
if( ! aLocalSharing ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
578 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
579 |
valOfAttr.Set( KEmptyProtocolInfoVal8() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
580 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
581 |
else |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
582 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
583 |
User::Leave( EBadMetadata ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
584 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
585 |
} //------- 2 ----- //------- 2 ----- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
586 |
else |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
587 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
588 |
valOfAttr.Set( KNullDesC8() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
589 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
590 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
591 |
aChild.AddNewAttributeL( nameOfAttr, valOfAttr ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
592 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
593 |
else |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
594 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
595 |
if(nestElementName == KprotocolInfo) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
596 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
597 |
HBufC8* protInfoValue = NULL; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
598 |
TRAPD(err, protInfoValue = ValidateProtocolInfoInResL( nestCurrentValue, aLocalSharing )); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
599 |
if(err) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
600 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
601 |
User::Leave(EBadMetadata); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
602 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
603 |
CleanupStack::PushL( protInfoValue ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
604 |
valOfAttr.Set( *protInfoValue ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
605 |
aChild.SetAttributeL( nameOfAttr, valOfAttr ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
606 |
CleanupStack::PopAndDestroy( protInfoValue ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
607 |
} //------- 3 ----- //------- 3 ----- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
608 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
609 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
610 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
611 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
612 |
// if not main tag mark the attr is required |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
613 |
if( !IsMainObjectTagL(aChild) && nestElementName != KDlnaProfileID) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
614 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
615 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
616 |
HBufC8* attrReq = HBufC8::NewLC( |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
617 |
nestElementName.Length() |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
618 |
+KRequiredAtrSuf().Length() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
619 |
TPtr8 attrReqPtr(attrReq->Des()); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
620 |
attrReqPtr = nestElementName; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
621 |
attrReqPtr.Append(KRequiredAtrSuf); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
622 |
aChild.AddNewAttributeL( attrReqPtr, KTrueValue8 ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
623 |
CleanupStack::PopAndDestroy(attrReq); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
624 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
625 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
626 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
627 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
628 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
629 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
630 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
631 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
632 |
void CUpnpElementFactory::ValidateAttributeL(TXmlEngElement aElement, TXmlEngElement aObject) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
633 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
634 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
635 |
const TDesC8& required = UpnpDomInterface::GetAttrValueL( aElement, KRequiredObject() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
636 |
if ( required == UpnpCD::KOne() ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
637 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
638 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
639 |
const TDesC8& elementName = UpnpDomInterface::GetAttrValueL( aElement, KName() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
640 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
641 |
const TDesC8& currentValue = UpnpDomInterface::GetAttrValueL( aObject, elementName ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
642 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
643 |
if ( !currentValue.Length() ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
644 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
645 |
TXmlEngAttr attr = aObject.AttributeNodeL( elementName ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
646 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
647 |
if(attr.NotNull()) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
648 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
649 |
attr.SetValueL(KNullDesC8); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
650 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
651 |
else |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
652 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
653 |
aObject.AddNewAttributeL( elementName, KNullDesC8 ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
654 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
655 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
656 |
// if not main tag mark the attr is required |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
657 |
if(!IsMainObjectTagL(aObject)) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
658 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
659 |
HBufC8* attrReq = HBufC8::NewLC( |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
660 |
elementName.Length()+KRequiredAtrSuf().Length() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
661 |
TPtr8 attrReqPtr(attrReq->Des()); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
662 |
attrReqPtr = elementName; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
663 |
attrReqPtr.Append(KRequiredAtrSuf); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
664 |
aObject.AddNewAttributeL( attrReqPtr, KTrueValue8 ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
665 |
CleanupStack::PopAndDestroy(attrReq); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
666 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
667 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
668 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
669 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
670 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
671 |
// CUpnpElementFactory::ValidatePropertiesL() |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
672 |
// Function leaves on error. |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
673 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
674 |
// |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
675 |
void CUpnpElementFactory::ValidatePropertiesL( TXmlEngElement aObj, |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
676 |
RArray<TXmlEngElement>& aClassList) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
677 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
678 |
// validate main object's attributes |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
679 |
ValidateMainAttributesL(aObj, aClassList); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
680 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
681 |
// validate elements |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
682 |
RXmlEngNodeList<TXmlEngElement> elements; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
683 |
CleanupClosePushL(elements); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
684 |
aObj.GetChildElements (elements); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
685 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
686 |
// for each element |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
687 |
while(elements.HasNext()) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
688 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
689 |
TXmlEngElement el = elements.Next(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
690 |
ValidateElementL(el, aClassList); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
691 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
692 |
CleanupStack::PopAndDestroy(&elements); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
693 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
694 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
695 |
// CUpnpElementFactory::ValidateBigImageL() |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
696 |
// Function leaves on error. |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
697 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
698 |
// |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
699 |
void CUpnpElementFactory::ValidateBigImageL( TXmlEngElement aObj) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
700 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
701 |
RArray<TXmlEngElement> elms; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
702 |
CleanupClosePushL(elms); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
703 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
704 |
if( UpnpDomInterface::GetElementListL(aObj, elms, KRes) ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
705 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
706 |
for(TInt i = 0; i < elms.Count(); i++) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
707 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
708 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
709 |
TXmlEngAttr prInfAttr = elms[i].AttributeNodeL(KprotocolInfo()); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
710 |
if(prInfAttr.NotNull()) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
711 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
712 |
CUpnpProtocolInfoLocal* protInf = CUpnpProtocolInfoLocal::NewL( |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
713 |
UpnpDomInterface::GetAttrValueL(elms[i], KprotocolInfo) ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
714 |
CleanupStack::PushL(protInf); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
715 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
716 |
/* Only support for DLNA pn-params: |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
717 |
* 1) JPEG_SM |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
718 |
* 2) MP3 |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
719 |
* 3) AAC_ISO_320 |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
720 |
* 4) AVC_MP4_BL_CIF15_AAC_520 |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
721 |
*/ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
722 |
if( protInf->PnParameter() != KDLNA_PN_JPEG_SM && |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
723 |
protInf->PnParameter() != KDLNA_PN_MP3 && |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
724 |
protInf->PnParameter() != KDLNA_PN_AAC_ISO_320 && |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
725 |
protInf->PnParameter() != KDLNA_PN_AVC_MP4_BL_CIF15_AAC_520 |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
726 |
) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
727 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
728 |
// set 4th parameter to "*" |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
729 |
protInf->SetFourthFieldL(KAsterisk8); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
730 |
TPtrC8 prInfo = protInf->ProtocolInfoL(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
731 |
HBufC8* prInfTmp = prInfo.Alloc(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
732 |
CleanupStack::PushL(prInfTmp); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
733 |
prInfAttr.SetValueL( *prInfTmp ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
734 |
CleanupStack::PopAndDestroy(prInfTmp); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
735 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
736 |
// clean up |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
737 |
CleanupStack::PopAndDestroy(protInf); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
738 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
739 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
740 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
741 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
742 |
// clean up |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
743 |
CleanupStack::PopAndDestroy(&elms); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
744 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
745 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
746 |
// CUpnpElementFactory::ValidateElementL() |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
747 |
// Function leaves on error. |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
748 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
749 |
// |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
750 |
void CUpnpElementFactory::ValidateElementL( TXmlEngElement aElement, |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
751 |
RArray<TXmlEngElement>& aClassList) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
752 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
753 |
if(aElement.Name() == KRes) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
754 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
755 |
ValidateResElL(aElement, aClassList); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
756 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
757 |
else |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
758 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
759 |
// get pattern |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
760 |
HBufC8* name = UpnpCdUtils::GetElmNameWithNsL(aElement); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
761 |
CleanupStack::PushL(name); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
762 |
TXmlEngElement pattern = GetPatternL(*name, aClassList, KElement); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
763 |
if(pattern.NotNull()) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
764 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
765 |
ValidateElWithPatternL(aElement, pattern); // leaves on error |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
766 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
767 |
else |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
768 |
{ // attr is not supported - remove |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
769 |
aElement.Remove(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
770 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
771 |
// clean up |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
772 |
CleanupStack::PopAndDestroy(name); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
773 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
774 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
775 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
776 |
// CUpnpElementFactory::ValidateMainAttributesL() |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
777 |
// Function leaves on error. |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
778 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
779 |
// |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
780 |
void CUpnpElementFactory::ValidateMainAttributesL( TXmlEngElement aObj, |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
781 |
RArray<TXmlEngElement>& aClassList) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
782 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
783 |
// list of attributes |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
784 |
RXmlEngNodeList<TXmlEngAttr> attrList; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
785 |
CleanupClosePushL(attrList); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
786 |
aObj.GetAttributes(attrList); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
787 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
788 |
// for each attr |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
789 |
while(attrList.HasNext()) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
790 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
791 |
// get attr |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
792 |
TXmlEngAttr attr = attrList.Next(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
793 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
794 |
// get pattern |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
795 |
TXmlEngElement pattern = GetPatternL(attr.Name(), aClassList, KAttribute); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
796 |
if(pattern.NotNull()) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
797 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
798 |
ValidateAttrWithPatternL(attr, pattern); // leaves on error |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
799 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
800 |
else |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
801 |
{ // attr is not supported - remove |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
802 |
attr.Remove(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
803 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
804 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
805 |
CleanupStack::PopAndDestroy(&attrList); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
806 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
807 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
808 |
// CUpnpElementFactory::ValidateElWithPatternL() |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
809 |
// Function leaves on error. |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
810 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
811 |
// |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
812 |
void CUpnpElementFactory::ValidateResElL( TXmlEngElement aElement, |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
813 |
RArray<TXmlEngElement>& aClassList) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
814 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
815 |
// list of attributes |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
816 |
RXmlEngNodeList<TXmlEngAttr> attrList; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
817 |
CleanupClosePushL(attrList); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
818 |
aElement.GetAttributes(attrList); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
819 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
820 |
// for each attr |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
821 |
while(attrList.HasNext()) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
822 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
823 |
// get attr |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
824 |
TXmlEngAttr attr = attrList.Next(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
825 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
826 |
// get pattern |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
827 |
TXmlEngElement pattern = GetPatternForResAttrL(attr.Name(), aClassList); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
828 |
if(pattern.NotNull()) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
829 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
830 |
ValidateAttrWithPatternL(attr, pattern); // leaves on error |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
831 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
832 |
else |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
833 |
{ // attr is not supported - remove |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
834 |
attr.Remove(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
835 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
836 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
837 |
CleanupStack::PopAndDestroy(&attrList); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
838 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
839 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
840 |
// CUpnpElementFactory::ValidateElWithPatternL() |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
841 |
// Function leaves on error. |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
842 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
843 |
// |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
844 |
void CUpnpElementFactory::ValidateElWithPatternL( TXmlEngElement aElement, |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
845 |
TXmlEngElement aPattern ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
846 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
847 |
// is required? |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
848 |
if(IsRequiredL(aPattern) ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
849 |
{ // cannot be empty |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
850 |
if( !aElement.Value().Length() || |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
851 |
UpnpCdUtils::IsWhiteString( aElement.Value() ) ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
852 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
853 |
User::Leave(EBadMetadata); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
854 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
855 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
856 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
857 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
858 |
// CUpnpElementFactory::ValidateAttrWithPatternL() |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
859 |
// Function leaves on error. |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
860 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
861 |
// |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
862 |
void CUpnpElementFactory::ValidateAttrWithPatternL( TXmlEngAttr aAttr, |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
863 |
TXmlEngElement aPattern ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
864 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
865 |
// is required? |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
866 |
if(IsRequiredL(aPattern) ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
867 |
{ // cannot be empty |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
868 |
if( !aAttr.Value().Length() || |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
869 |
UpnpCdUtils::IsWhiteString( aAttr.Value() ) ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
870 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
871 |
User::Leave(EBadMetadata); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
872 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
873 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
874 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
875 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
876 |
// CUpnpElementFactory::ValidateAttrWithPatternL() |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
877 |
// Function leaves on error. |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
878 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
879 |
// |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
880 |
TBool CUpnpElementFactory::IsRequiredL(TXmlEngElement aPattern) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
881 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
882 |
TXmlEngAttr reqAttr = aPattern.AttributeNodeL(KRequiredObject()); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
883 |
TBool ret = EFalse; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
884 |
if( reqAttr.NotNull() && |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
885 |
reqAttr.Value().Length() && |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
886 |
reqAttr.Value() == KTrueValue8() ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
887 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
888 |
ret = ETrue; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
889 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
890 |
return ret; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
891 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
892 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
893 |
// CUpnpElementFactory::GetPatternForElL() |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
894 |
// Function leaves on error. |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
895 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
896 |
// |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
897 |
TXmlEngElement CUpnpElementFactory::GetPatternL( const TDesC8& aPropertyName, |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
898 |
RArray<TXmlEngElement>& aClassList, |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
899 |
const TDesC8& aType ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
900 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
901 |
TXmlEngElement retEl; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
902 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
903 |
// for each class |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
904 |
for(TInt i = 0; i < aClassList.Count(); i++) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
905 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
906 |
TXmlEngElement elPattEl; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
907 |
UpnpDomInterface::GetDirectoryElementL(aClassList[i], elPattEl, KProperties, KType, aType); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
908 |
if(elPattEl.NotNull()) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
909 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
910 |
UpnpDomInterface::GetDirectoryElementL(elPattEl, retEl, KObjectProperty, KObjectName, aPropertyName); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
911 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
912 |
// break if found |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
913 |
if(retEl.NotNull()) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
914 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
915 |
break; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
916 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
917 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
918 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
919 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
920 |
return retEl; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
921 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
922 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
923 |
// CUpnpElementFactory::GetPatternForResAttrL() |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
924 |
// Function leaves on error. |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
925 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
926 |
// |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
927 |
TXmlEngElement CUpnpElementFactory::GetPatternForResAttrL(const TDesC8& aPropertyName, |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
928 |
RArray<TXmlEngElement>& aClassList ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
929 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
930 |
TXmlEngElement retEl; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
931 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
932 |
// for each class |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
933 |
for(TInt i = 0; i < aClassList.Count(); i++) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
934 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
935 |
TXmlEngElement resAttrPattEl; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
936 |
UpnpDomInterface::GetDirectoryElementL(aClassList[i], resAttrPattEl, KProperties, KType, KResAttr); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
937 |
if(resAttrPattEl.NotNull()) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
938 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
939 |
UpnpDomInterface::GetDirectoryElementL(resAttrPattEl, retEl, KObjectProperty, KObjectName, aPropertyName); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
940 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
941 |
// break if found |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
942 |
if(retEl.NotNull()) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
943 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
944 |
break; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
945 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
946 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
947 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
948 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
949 |
return retEl; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
950 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
951 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
952 |
// CUpnpElementFactory::IsMainObjectTagL() |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
953 |
// (other items were commented in a header). |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
954 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
955 |
// |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
956 |
TBool CUpnpElementFactory::IsMainObjectTagL(TXmlEngElement aElement) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
957 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
958 |
TXmlEngElement notNeeded; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
959 |
return UpnpDomInterface::GetElementL(aElement, notNeeded, KClassTagName); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
960 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
961 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
962 |
// CUpnpElementFactory::ActiveElementL() |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
963 |
// Gets active element from XML document. An active element |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
964 |
// is a first element different from <DIDL-Lite> element. |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
965 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
966 |
// |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
967 |
TXmlEngElement CUpnpElementFactory::ActiveElementL( const RXmlEngDocument& aDocument ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
968 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
969 |
if( aDocument.IsNull() || aDocument.DocumentElement().IsNull() ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
970 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
971 |
User::Leave( KErrNotFound ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
972 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
973 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
974 |
if ( aDocument.DocumentElement().Name().CompareF( KDidlLite() ) != 0 ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
975 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
976 |
return aDocument.DocumentElement(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
977 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
978 |
else |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
979 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
980 |
TXmlEngElement root = aDocument.DocumentElement(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
981 |
RXmlEngNodeList<TXmlEngElement> children; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
982 |
CleanupClosePushL(children); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
983 |
root.GetChildElements( children ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
984 |
children.HasNext(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
985 |
CleanupStack::PopAndDestroy(&children); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
986 |
return children.Next(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
987 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
988 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
989 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
990 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
991 |
// CUpnpElementFactory::ExtractActiveElementL() |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
992 |
// Extracts active element from XML document. |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
993 |
// An active element is a first element different from <DIDL-Lite> element. |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
994 |
// IMPORTANT: Caller takes responsibility for returned element. |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
995 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
996 |
// |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
997 |
RXmlEngDocument CUpnpElementFactory::ExtractActiveElementL( const RXmlEngDocument& aDocument ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
998 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
999 |
TXmlEngElement active; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1000 |
RXmlEngDocument ret; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1001 |
ret.OpenL(iDOMImpl); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1002 |
CleanupClosePushL(ret); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1003 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1004 |
if( aDocument.IsNull() || aDocument.DocumentElement().IsNull() ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1005 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1006 |
User::Leave( KErrNotFound ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1007 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1008 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1009 |
if ( aDocument.DocumentElement().Name().CompareF( KDidlLite() ) != 0 ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1010 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1011 |
active = aDocument.DocumentElement().Unlink().AsElement(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1012 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1013 |
else |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1014 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1015 |
TXmlEngElement root = aDocument.DocumentElement(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1016 |
RXmlEngNodeList<TXmlEngElement> children; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1017 |
CleanupClosePushL(children); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1018 |
root.GetChildElements( children ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1019 |
children.HasNext(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1020 |
active = children.Next().Unlink().AsElement(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1021 |
CleanupStack::PopAndDestroy(&children); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1022 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1023 |
ret.SetDocumentElement(active); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1024 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1025 |
CleanupStack::Pop(&ret); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1026 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1027 |
return ret; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1028 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1029 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1030 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1031 |
// CUpnpElementFactory::ElementsMatchL() |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1032 |
// Checks if two elements are equal and have exactly the same subtrees. |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1033 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1034 |
// |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1035 |
TBool CUpnpElementFactory::ElementsMatchL( TXmlEngElement aFirst, TXmlEngElement aSecond ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1036 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1037 |
// this function checks following things: |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1038 |
// 1. element names |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1039 |
// 2. contents of the elements |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1040 |
// 3. attributes of the elements |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1041 |
// 4. child elements of the elements |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1042 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1043 |
if ( aFirst.Name().Compare(aSecond.Name()) == 0 ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1044 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1045 |
// aFirst names match. next: check namespace |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1046 |
if ( aFirst.Prefix().Compare( aSecond.Prefix()) == 0 ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1047 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1048 |
if (!aFirst.Text().Compare(aSecond.Text())) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1049 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1050 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1051 |
// namespacess match, next: check attributes |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1052 |
RXmlEngNodeList<TXmlEngAttr> elemAttrs; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1053 |
CleanupClosePushL(elemAttrs); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1054 |
RXmlEngNodeList<TXmlEngAttr> currAttrs; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1055 |
CleanupClosePushL(currAttrs); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1056 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1057 |
aFirst.GetAttributes( elemAttrs ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1058 |
aSecond.GetAttributes( currAttrs ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1059 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1060 |
if ( elemAttrs.Count() == currAttrs.Count() ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1061 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1062 |
// first step in comparing attributes ready (counts match!) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1063 |
// next, check names and values (for each attribute) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1064 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1065 |
while( elemAttrs.HasNext() && currAttrs.HasNext() ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1066 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1067 |
TXmlEngAttr elemAttr = elemAttrs.Next(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1068 |
TXmlEngAttr currAttr = currAttrs.Next(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1069 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1070 |
// compare names and values |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1071 |
if ( elemAttr.Name().Compare( currAttr.Name() ) ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1072 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1073 |
CleanupStack::PopAndDestroy(&currAttrs); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1074 |
CleanupStack::PopAndDestroy(&elemAttrs); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1075 |
return EFalse; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1076 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1077 |
if ( elemAttr.Value().Compare( currAttr.Value() ) ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1078 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1079 |
CleanupStack::PopAndDestroy(&currAttrs); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1080 |
CleanupStack::PopAndDestroy(&elemAttrs); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1081 |
return EFalse; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1082 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1083 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1084 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1085 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1086 |
// compare child elements (recursive function call) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1087 |
RXmlEngNodeList<TXmlEngElement> fChildren; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1088 |
CleanupClosePushL(fChildren); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1089 |
RXmlEngNodeList<TXmlEngElement> sChildren; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1090 |
CleanupClosePushL(sChildren); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1091 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1092 |
aFirst.GetChildElements( fChildren ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1093 |
aSecond.GetChildElements( sChildren ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1094 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1095 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1096 |
if ( fChildren.Count() == sChildren.Count() ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1097 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1098 |
while ( fChildren.HasNext() && sChildren.HasNext() ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1099 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1100 |
// call this function again for children |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1101 |
TBool matching = ElementsMatchL( fChildren.Next(), sChildren.Next() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1102 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1103 |
// if some of the elements do not match, return false! |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1104 |
if (matching == EFalse) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1105 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1106 |
CleanupStack::PopAndDestroy(&sChildren); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1107 |
CleanupStack::PopAndDestroy(&fChildren); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1108 |
CleanupStack::PopAndDestroy(&currAttrs); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1109 |
CleanupStack::PopAndDestroy(&elemAttrs); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1110 |
return EFalse; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1111 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1112 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1113 |
// only place to return ETrue |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1114 |
// all the checks are made; if survived here, elements match! |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1115 |
CleanupStack::PopAndDestroy(&sChildren); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1116 |
CleanupStack::PopAndDestroy(&fChildren); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1117 |
CleanupStack::PopAndDestroy(&currAttrs); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1118 |
CleanupStack::PopAndDestroy(&elemAttrs); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1119 |
return ETrue; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1120 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1121 |
CleanupStack::PopAndDestroy(&sChildren); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1122 |
CleanupStack::PopAndDestroy(&fChildren); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1123 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1124 |
CleanupStack::PopAndDestroy(&currAttrs); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1125 |
CleanupStack::PopAndDestroy(&elemAttrs); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1126 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1127 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1128 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1129 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1130 |
return EFalse; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1131 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1132 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1133 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1134 |
// CUpnpElementFactory::CountElementsL() |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1135 |
// Prepares corresponding RArray<TXmlEngElements> and calls |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1136 |
// CountElementsL( const TDesC8& aName, RArray<TXmlEngElement>& aArray ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1137 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1138 |
// |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1139 |
TInt CUpnpElementFactory::CountElementsL( const TDesC8& aName, RArray<RXmlEngDocument>& aArray ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1140 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1141 |
TInt count(0); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1142 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1143 |
for(TInt i = 0; i < aArray.Count(); i++) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1144 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1145 |
if ( aArray[i].DocumentElement().NotNull() ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1146 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1147 |
if ( aArray[i].DocumentElement().Name() == aName ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1148 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1149 |
count++; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1150 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1151 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1152 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1153 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1154 |
return count; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1155 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1156 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1157 |
// CUpnpElementFactory::CountElementsL() |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1158 |
// Counts elements in array that have the same name. |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1159 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1160 |
// |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1161 |
TInt CUpnpElementFactory::CountElementsL( const TDesC8& aName, RArray<TXmlEngElement>& aArray ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1162 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1163 |
TInt count(0); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1164 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1165 |
for (TInt v(0); v<aArray.Count(); v++) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1166 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1167 |
if ( aArray[v].NotNull() ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1168 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1169 |
if ( aArray[v].Name() == aName ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1170 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1171 |
count++; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1172 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1173 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1174 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1175 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1176 |
return count; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1177 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1178 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1179 |
// CUpnpElementFactory::NameWithNsLC() |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1180 |
// Constructs descriptor with element's name and namespace prefix separated with colon. |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1181 |
// IMPORTANT: As the function name indicates, it leaves pointer to heap descriptor on |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1182 |
// cleanup stack. |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1183 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1184 |
// |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1185 |
HBufC8* CUpnpElementFactory::NameWithNsLC(const TXmlEngElement& aElement) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1186 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1187 |
const TDesC8& localName = aElement.Name(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1188 |
TPtrC8 prefix = aElement.Prefix(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1189 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1190 |
if ( prefix.Length() > 0) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1191 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1192 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1193 |
HBufC8* nameWithNs = HBufC8::NewLC( |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1194 |
localName.Length() + |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1195 |
UpnpString::KColon().Length() + |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1196 |
prefix.Length() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1197 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1198 |
nameWithNs->Des().Append( prefix ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1199 |
nameWithNs->Des().Append( UpnpString::KColon() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1200 |
nameWithNs->Des().Append( localName ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1201 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1202 |
return nameWithNs; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1203 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1204 |
else |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1205 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1206 |
return localName.AllocLC(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1207 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1208 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1209 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1210 |
void CUpnpElementFactory::CheckElementValidity (TXmlEngElement& aElement) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1211 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1212 |
if ( aElement.IsNull() ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1213 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1214 |
// no <class> element! leave |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1215 |
User::Leave( EBadMetadata ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1216 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1217 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1218 |
// check that does the new element have all the required fields for its type |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1219 |
// and also check that it does not have whatever fields (only optional allowed) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1220 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1221 |
TPtrC8 content = aElement.Text(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1222 |
if( !content.Length() ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1223 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1224 |
User::Leave( EBadMetadata ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1225 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1226 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1227 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1228 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1229 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1230 |
// CUpnpElementFactory::ClassesL() |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1231 |
// Gets classes descriptions for given object. |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1232 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1233 |
// |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1234 |
void CUpnpElementFactory::ClassesL( const TXmlEngElement& aObject, RArray<TXmlEngElement>& aArray, const TDesC8& aObjType ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1235 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1236 |
TInt i(0); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1237 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1238 |
// if survived here, we have the new element of type item or container |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1239 |
// let's analyze its type |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1240 |
TXmlEngElement type; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1241 |
UpnpDomInterface::GetElementL ( aObject, type, KClass() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1242 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1243 |
CheckElementValidity (type); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1244 |
RPointerArray<TPtrC8> objectFields; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1245 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1246 |
//--- removing white spaces ------------------ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1247 |
HBufC8* tempBuffer = type.Text().AllocLC(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1248 |
TPtr8 tmpPtr(tempBuffer->Des()); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1249 |
UpnpCdUtils::RemoveWhiteSpacesL(tmpPtr); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1250 |
CleanupStack::Check(tempBuffer); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1251 |
type.SetTextL(tmpPtr); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1252 |
//-------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1253 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1254 |
UpnpString::CutToPiecesL(tmpPtr, TChar('.'), objectFields ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1255 |
CleanupStack::Check(tempBuffer); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1256 |
// let's inspect each of types |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1257 |
// at first, collect object type descriptions from objects xml |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1258 |
// to a pointer array |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1259 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1260 |
TInt NumberOfObjectFields = objectFields.Count(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1261 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1262 |
for ( i=0; i < NumberOfObjectFields; i++ ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1263 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1264 |
// seek for such object type |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1265 |
TXmlEngElement objectDescription; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1266 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1267 |
UpnpDomInterface::GetDirectoryElementL( |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1268 |
iDocument.DocumentElement(), |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1269 |
objectDescription, |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1270 |
KElement, |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1271 |
KType, |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1272 |
*objectFields[i] ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1273 |
CleanupStack::Check(tempBuffer); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1274 |
// if such type found |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1275 |
if ( objectDescription.NotNull() ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1276 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1277 |
aArray.Append( objectDescription ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1278 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1279 |
/* This case is valid for any numeric value of containerID used in CreateObject() action |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1280 |
* We do some checking starting from 3rd string of <upnp:class> element, if the string isn't |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1281 |
* recognizable, instead of leaving, we trims the value of <upnp:class> element, e.g: |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1282 |
* 'object.item.imageItem.abcd' -> is trimmed into -> 'object.item.imageItem' |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1283 |
* DLNA 7.3.120.4 requirement |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1284 |
*/ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1285 |
else if( i >= 2 ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1286 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1287 |
for( TInt j = NumberOfObjectFields - 1; j >= i; j-- ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1288 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1289 |
TInt pos = tmpPtr.LocateReverse( TChar('.') ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1290 |
if( pos > KErrNotFound ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1291 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1292 |
tmpPtr.Copy( tmpPtr.Left(pos) ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1293 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1294 |
delete objectFields[j]; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1295 |
objectFields.Remove(j); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1296 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1297 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1298 |
type.SetTextL(tmpPtr); // changing xml |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1299 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1300 |
break; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1301 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1302 |
else |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1303 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1304 |
objectFields.ResetAndDestroy(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1305 |
objectFields.Close(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1306 |
User::Leave( EBadMetadata ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1307 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1308 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1309 |
CleanupStack::Check(tempBuffer); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1310 |
/* for each type, check that: |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1311 |
* 1. it is referenced to its current parent type (e.g. audioItem -> item) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1312 |
* 2. this new object has all the required fields |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1313 |
* 3. relations between object types and values of 'upnp:class': |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1314 |
* <item> -> 'object.item' or <container> -> 'object.container' |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1315 |
*/ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1316 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1317 |
// we count the number of elements once again, because size of the array might change |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1318 |
NumberOfObjectFields = objectFields.Count(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1319 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1320 |
for ( i=0; i < NumberOfObjectFields; i++ ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1321 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1322 |
const TDesC8& field = *objectFields[i]; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1323 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1324 |
// 1. first, check the parent relation |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1325 |
// first type must be "object"! |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1326 |
if ( i==0 ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1327 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1328 |
/* Leave if: |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1329 |
* 1. first type isn't the 'object' OR |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1330 |
* 2. 'upnp:class' contains only 'object' type [which in matter of fact isn't instantiable] |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1331 |
*/ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1332 |
if ( field != KObject() || |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1333 |
field == KObject() && NumberOfObjectFields == 1 |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1334 |
) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1335 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1336 |
// if not "item", leave! |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1337 |
objectFields.ResetAndDestroy(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1338 |
objectFields.Close(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1339 |
User::Leave( EBadMetadata ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1340 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1341 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1342 |
// for later types, check the relation really |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1343 |
else |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1344 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1345 |
// checking relations between object types and values of 'upnp:class' |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1346 |
if( i == 1 && aObjType.Length() > 0 ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1347 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1348 |
if( !field.Compare(KItem) && aObjType.Compare(KItem) || |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1349 |
!field.Compare(KContainer) && aObjType.Compare(KContainer) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1350 |
) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1351 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1352 |
objectFields.ResetAndDestroy(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1353 |
objectFields.Close(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1354 |
User::Leave( EBadMetadata ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1355 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1356 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1357 |
//---------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1358 |
const TDesC8& parent = *objectFields[i-1]; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1359 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1360 |
// if we've survived to this point, this parent string |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1361 |
// should match with the one in the previous object description xml element |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1362 |
TXmlEngElement iparent; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1363 |
UpnpDomInterface::GetElementL ( aArray[i], iparent, KIParent() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1364 |
CleanupStack::Check(tempBuffer); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1365 |
TPtrC8 cont = iparent.Text(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1366 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1367 |
// now check the actual relation. leave if strings do not match! |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1368 |
if ( cont.Length() && parent != cont ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1369 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1370 |
objectFields.ResetAndDestroy(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1371 |
objectFields.Close(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1372 |
User::Leave( EBadMetadata ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1373 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1374 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1375 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1376 |
CleanupStack::PopAndDestroy(tempBuffer); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1377 |
objectFields.ResetAndDestroy(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1378 |
objectFields.Close(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1379 |
return; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1380 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1381 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1382 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1383 |
// CUpnpElementFactory::IsNotEmptyImportUriL() |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1384 |
// (other items were commented in a header). |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1385 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1386 |
// |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1387 |
TBool CUpnpElementFactory::IsNotEmptyImportUriL( const TXmlEngElement& aElement ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1388 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1389 |
TXmlEngAttr importUri; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1390 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1391 |
if ( aElement.Name() == KRes() ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1392 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1393 |
importUri = aElement.AttributeNodeL( KImportUri8() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1394 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1395 |
// remove if empty importUri: DLNA Requirement [7.3.134.5] |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1396 |
TPtrC8 val( importUri.Value() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1397 |
if( UpnpCdUtils::IsWhiteString( val ) ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1398 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1399 |
importUri.Remove(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1400 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1401 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1402 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1403 |
return importUri.NotNull(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1404 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1405 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1406 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1407 |
// CUpnpElementFactory::IsClassElement() |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1408 |
// (other items were commented in a header). |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1409 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1410 |
// |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1411 |
TBool CUpnpElementFactory::IsClassElement( const TXmlEngElement& aElement ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1412 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1413 |
if ( aElement.Name() == KClass() ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1414 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1415 |
return ETrue; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1416 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1417 |
else |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1418 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1419 |
return EFalse; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1420 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1421 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1422 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1423 |
// CUpnpElementFactory::ValidateProtocolInfoInResL |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1424 |
// Allocates string, which is object type for this object. |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1425 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1426 |
HBufC8* CUpnpElementFactory::ValidateProtocolInfoInResL( const TDesC8& aProtocolInfo, TBool aLocalSharing ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1427 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1428 |
HBufC8* result = NULL; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1429 |
// CUpnpDlnaProtocolInfo* protocolInfo = CUpnpDlnaProtocolInfo::NewL( (TDesC8&)aProtocolInfo ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1430 |
CUpnpProtocolInfoLocal* protocolInfo = CUpnpProtocolInfoLocal::NewL( (TDesC8&)aProtocolInfo ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1431 |
CleanupStack::PushL( protocolInfo ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1432 |
_LIT8(KProtocolInfoHttpGet, "http-get"); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1433 |
protocolInfo->SetFirstFieldL( (TDesC8&)KProtocolInfoHttpGet() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1434 |
protocolInfo->SetSecondFieldL( (TDesC8&)KAsterisk8() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1435 |
TPtrC8 third = protocolInfo->ThirdField(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1436 |
if(( third.Find( KSlash8()) == KErrNotFound) && |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1437 |
( third.Compare( KAsterisk8()) != KErrNone)) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1438 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1439 |
if( aLocalSharing) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1440 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1441 |
User::Leave( EBadMetadata ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1442 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1443 |
protocolInfo->SetThirdFieldL( (TDesC8&) KAsterisk8()); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1444 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1445 |
// if( protocolInfo->IsDlnaInformationIncluded() ) // Check it !!! |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1446 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1447 |
protocolInfo->SetOpParameterL( UpnpDlnaProtocolInfo::B_VAL , ETrue ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1448 |
protocolInfo->SetOpParameterL( UpnpDlnaProtocolInfo::A_VAL , EFalse ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1449 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1450 |
TPtrC8 prInfo = protocolInfo->ProtocolInfoL(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1451 |
result = prInfo.Alloc(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1452 |
CleanupStack::PopAndDestroy( protocolInfo ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1453 |
return result; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1454 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1455 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1456 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1457 |
// CUpnpElementFactory::GetContentDirectoryReference |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1458 |
// Function gets pointer to CUpnpContentDirectory and puts it into CUpnpElementFactory object |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1459 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1460 |
void CUpnpElementFactory::GetContentDirectoryReference(CUpnpContentDirectory* aCD) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1461 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1462 |
iContentDirectory = aCD; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1463 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1464 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1465 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1466 |
// CUpnpElementFactory::CheckDurationOfResElement |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1467 |
// If res@duration attribute exists, the method checks whether it has valid format |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1468 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1469 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1470 |
void CUpnpElementFactory::CheckDurationOfResElementL(const TXmlEngElement& aElement) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1471 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1472 |
TXmlEngAttr duration; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1473 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1474 |
// if this is the 'res' element |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1475 |
if( aElement.Name() == KRes() ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1476 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1477 |
// and it has res@duration attribute |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1478 |
duration = aElement.AttributeNodeL( KDuration8() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1479 |
if( duration.NotNull() ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1480 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1481 |
TCurrentAction action = iContentDirectory->ExecutedAction(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1482 |
TPtrC8 val( duration.Value() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1483 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1484 |
// if res@duration atrribute value is invalid [has improper format] |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1485 |
if( !UpnpCdUtils::ValidateDurationValue(val) ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1486 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1487 |
// remove it from 'res' element if it is CreateObject() |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1488 |
if( action == ECreateObjectAction ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1489 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1490 |
duration.Remove(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1491 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1492 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1493 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1494 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1495 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1496 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1497 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1498 |
// CUpnpElementFactory::CheckSizeOfResElement |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1499 |
// If res@size attribute exists, the method checks whether it has valid format |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1500 |
// size should be unsigned int. |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1501 |
// ----------------------------------------------------------------------------- |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1502 |
void CUpnpElementFactory::CheckSizeOfResElementL( |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1503 |
const TXmlEngElement& aElement ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1504 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1505 |
TXmlEngAttr sizeAttr; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1506 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1507 |
// if this is the 'res' element |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1508 |
if ( aElement.Name() == KRes() ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1509 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1510 |
// and it has res@size attribute |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1511 |
sizeAttr = aElement.AttributeNodeL( KSize() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1512 |
if ( sizeAttr.NotNull() ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1513 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1514 |
TCurrentAction action = iContentDirectory->ExecutedAction(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1515 |
TPtrC8 val( sizeAttr.Value() ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1516 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1517 |
// if res@size atrribute value is invalid [is not an unsigned long] |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1518 |
TUint32 unsignedLong = 0; |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1519 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1520 |
TLex8 lexULong(val); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1521 |
TInt error = lexULong.Val( unsignedLong, EDecimal ); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1522 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1523 |
TInt remainder = lexULong.Remainder().Length(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1524 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1525 |
if ( error != KErrNone || remainder ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1526 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1527 |
// remove it from 'res' element if it is CreateObject() |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1528 |
if ( action == ECreateObjectAction ) |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1529 |
{ |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1530 |
sizeAttr.Remove(); |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1531 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1532 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1533 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1534 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1535 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1536 |
} |
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1537 |
|
5360b7ddc251
New development branch with e.g. rendering state machine and a simple Qt example application using it.
samhuttu
parents:
32
diff
changeset
|
1538 |
// End of File |