sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
*
|
sl@0
|
16 |
*/
|
sl@0
|
17 |
|
sl@0
|
18 |
|
sl@0
|
19 |
#include <f32file.h>
|
sl@0
|
20 |
#include <apmstd.h>
|
sl@0
|
21 |
|
sl@0
|
22 |
#include "contentIterator.h"
|
sl@0
|
23 |
#include "virtualpath.h"
|
sl@0
|
24 |
#include "content.h"
|
sl@0
|
25 |
#include "manager.h"
|
sl@0
|
26 |
#include "EmbeddedObject.h"
|
sl@0
|
27 |
#include "EmbeddedcontentIterator.h"
|
sl@0
|
28 |
#include "EmbeddedcontentIteratorBase.h"
|
sl@0
|
29 |
|
sl@0
|
30 |
using namespace ContentAccess;
|
sl@0
|
31 |
|
sl@0
|
32 |
CEmbeddedContentIterator* CEmbeddedContentIterator::NewL(const TVirtualPathPtr& aVirtualPath, TBool aRecursive, const TDesC8& aMimeType)
|
sl@0
|
33 |
{
|
sl@0
|
34 |
CEmbeddedContentIterator* self = new (ELeave) CEmbeddedContentIterator;
|
sl@0
|
35 |
CleanupStack::PushL(self);
|
sl@0
|
36 |
self->ConstructL(aVirtualPath, aRecursive, aMimeType);
|
sl@0
|
37 |
CleanupStack::Pop(self);
|
sl@0
|
38 |
return self;
|
sl@0
|
39 |
}
|
sl@0
|
40 |
|
sl@0
|
41 |
CEmbeddedContentIterator::CEmbeddedContentIterator()
|
sl@0
|
42 |
{
|
sl@0
|
43 |
}
|
sl@0
|
44 |
|
sl@0
|
45 |
CEmbeddedContentIterator::~CEmbeddedContentIterator()
|
sl@0
|
46 |
{
|
sl@0
|
47 |
delete iSubIterator;
|
sl@0
|
48 |
delete iContent;
|
sl@0
|
49 |
delete iUri;
|
sl@0
|
50 |
delete iMimeType;
|
sl@0
|
51 |
}
|
sl@0
|
52 |
|
sl@0
|
53 |
void CEmbeddedContentIterator::ConstructL(const TVirtualPathPtr& aVirtualPath, TBool aRecursive, const TDesC8& aMimeType)
|
sl@0
|
54 |
{
|
sl@0
|
55 |
iUri = aVirtualPath.URI().AllocL();
|
sl@0
|
56 |
iContent = CContent::NewL(*iUri);
|
sl@0
|
57 |
iRecursive = aRecursive;
|
sl@0
|
58 |
iMimeType = aMimeType.AllocL();
|
sl@0
|
59 |
|
sl@0
|
60 |
if(aVirtualPath.UniqueId().Length() > 0)
|
sl@0
|
61 |
{
|
sl@0
|
62 |
iContent->OpenContainer(aVirtualPath.UniqueId());
|
sl@0
|
63 |
}
|
sl@0
|
64 |
|
sl@0
|
65 |
// Find the first content object
|
sl@0
|
66 |
iSubIterator = CEmbeddedContentIteratorBase::NewL(*iContent, iRecursive, *iMimeType);
|
sl@0
|
67 |
}
|
sl@0
|
68 |
|
sl@0
|
69 |
const TDesC& CEmbeddedContentIterator::FileName() const
|
sl@0
|
70 |
{
|
sl@0
|
71 |
return *iUri;
|
sl@0
|
72 |
}
|
sl@0
|
73 |
|
sl@0
|
74 |
const TDesC& CEmbeddedContentIterator::UniqueId() const
|
sl@0
|
75 |
{
|
sl@0
|
76 |
return iSubIterator->EmbeddedObject().UniqueId();
|
sl@0
|
77 |
}
|
sl@0
|
78 |
|
sl@0
|
79 |
const TDesC& CEmbeddedContentIterator::Name() const
|
sl@0
|
80 |
{
|
sl@0
|
81 |
return iSubIterator->EmbeddedObject().Name();
|
sl@0
|
82 |
}
|
sl@0
|
83 |
|
sl@0
|
84 |
const TDesC8& CEmbeddedContentIterator::MimeType() const
|
sl@0
|
85 |
{
|
sl@0
|
86 |
return iSubIterator->EmbeddedObject().MimeType();
|
sl@0
|
87 |
}
|
sl@0
|
88 |
|
sl@0
|
89 |
TInt CEmbeddedContentIterator::Next()
|
sl@0
|
90 |
{
|
sl@0
|
91 |
return iSubIterator->Next();
|
sl@0
|
92 |
}
|
sl@0
|
93 |
|