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 |
|
sl@0
|
20 |
#include <f32file.h>
|
sl@0
|
21 |
#include <apmstd.h>
|
sl@0
|
22 |
|
sl@0
|
23 |
#include "contentIterator.h"
|
sl@0
|
24 |
#include "virtualpath.h"
|
sl@0
|
25 |
#include "content.h"
|
sl@0
|
26 |
#include "manager.h"
|
sl@0
|
27 |
#include "EmbeddedObject.h"
|
sl@0
|
28 |
#include "FileContentIterator.h"
|
sl@0
|
29 |
#include "FileContentIteratorBase.h"
|
sl@0
|
30 |
|
sl@0
|
31 |
using namespace ContentAccess;
|
sl@0
|
32 |
|
sl@0
|
33 |
CFileContentIterator* CFileContentIterator::NewL(const TDesC& aPath, TBool aRecursive, const TDesC8& aMimeType)
|
sl@0
|
34 |
{
|
sl@0
|
35 |
CFileContentIterator* self = new (ELeave) CFileContentIterator();
|
sl@0
|
36 |
CleanupStack::PushL(self);
|
sl@0
|
37 |
self->ConstructL(aPath, aRecursive, aMimeType);
|
sl@0
|
38 |
CleanupStack::Pop(self);
|
sl@0
|
39 |
return self;
|
sl@0
|
40 |
}
|
sl@0
|
41 |
|
sl@0
|
42 |
void CFileContentIterator::ConstructL(const TDesC& aPath, TBool aRecursive, const TDesC8& aMimeType)
|
sl@0
|
43 |
{
|
sl@0
|
44 |
if(aPath.Length() == 0)
|
sl@0
|
45 |
{
|
sl@0
|
46 |
User::Leave(KErrPathNotFound);
|
sl@0
|
47 |
}
|
sl@0
|
48 |
|
sl@0
|
49 |
iPath = aPath.AllocL();
|
sl@0
|
50 |
iRecursive = aRecursive;
|
sl@0
|
51 |
iMimeType = aMimeType.AllocL();
|
sl@0
|
52 |
|
sl@0
|
53 |
iManager = CManager::NewL();
|
sl@0
|
54 |
|
sl@0
|
55 |
// Find the first content object
|
sl@0
|
56 |
iSubIterator = CFileContentIteratorBase::NewL(*iManager, *iPath, iRecursive, *iMimeType);
|
sl@0
|
57 |
}
|
sl@0
|
58 |
|
sl@0
|
59 |
CFileContentIterator::CFileContentIterator()
|
sl@0
|
60 |
{
|
sl@0
|
61 |
|
sl@0
|
62 |
}
|
sl@0
|
63 |
CFileContentIterator::~CFileContentIterator()
|
sl@0
|
64 |
{
|
sl@0
|
65 |
delete iSubIterator;
|
sl@0
|
66 |
delete iManager;
|
sl@0
|
67 |
delete iPath;
|
sl@0
|
68 |
delete iMimeType;
|
sl@0
|
69 |
}
|
sl@0
|
70 |
|
sl@0
|
71 |
|
sl@0
|
72 |
const TDesC& CFileContentIterator::FileName() const
|
sl@0
|
73 |
{
|
sl@0
|
74 |
return iSubIterator->FileName();
|
sl@0
|
75 |
}
|
sl@0
|
76 |
|
sl@0
|
77 |
const TDesC& CFileContentIterator::UniqueId() const
|
sl@0
|
78 |
{
|
sl@0
|
79 |
return iSubIterator->UniqueId();
|
sl@0
|
80 |
}
|
sl@0
|
81 |
|
sl@0
|
82 |
const TDesC& CFileContentIterator::Name() const
|
sl@0
|
83 |
{
|
sl@0
|
84 |
return iSubIterator->Name();
|
sl@0
|
85 |
}
|
sl@0
|
86 |
|
sl@0
|
87 |
const TDesC8& CFileContentIterator::MimeType() const
|
sl@0
|
88 |
{
|
sl@0
|
89 |
return iSubIterator->MimeType();
|
sl@0
|
90 |
}
|
sl@0
|
91 |
|
sl@0
|
92 |
TInt CFileContentIterator::Next()
|
sl@0
|
93 |
{
|
sl@0
|
94 |
return iSubIterator->Next();
|
sl@0
|
95 |
}
|
sl@0
|
96 |
|