os/security/contentmgmt/referencedrmagent/contentiterator/embeddedcontentiterator.cpp
First public contribution.
2 * Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
22 #include "contentIterator.h"
23 #include "virtualpath.h"
26 #include "EmbeddedObject.h"
27 #include "EmbeddedcontentIterator.h"
28 #include "EmbeddedcontentIteratorBase.h"
30 using namespace ContentAccess;
32 CEmbeddedContentIterator* CEmbeddedContentIterator::NewL(const TVirtualPathPtr& aVirtualPath, TBool aRecursive, const TDesC8& aMimeType)
34 CEmbeddedContentIterator* self = new (ELeave) CEmbeddedContentIterator;
35 CleanupStack::PushL(self);
36 self->ConstructL(aVirtualPath, aRecursive, aMimeType);
37 CleanupStack::Pop(self);
41 CEmbeddedContentIterator::CEmbeddedContentIterator()
45 CEmbeddedContentIterator::~CEmbeddedContentIterator()
53 void CEmbeddedContentIterator::ConstructL(const TVirtualPathPtr& aVirtualPath, TBool aRecursive, const TDesC8& aMimeType)
55 iUri = aVirtualPath.URI().AllocL();
56 iContent = CContent::NewL(*iUri);
57 iRecursive = aRecursive;
58 iMimeType = aMimeType.AllocL();
60 if(aVirtualPath.UniqueId().Length() > 0)
62 iContent->OpenContainer(aVirtualPath.UniqueId());
65 // Find the first content object
66 iSubIterator = CEmbeddedContentIteratorBase::NewL(*iContent, iRecursive, *iMimeType);
69 const TDesC& CEmbeddedContentIterator::FileName() const
74 const TDesC& CEmbeddedContentIterator::UniqueId() const
76 return iSubIterator->EmbeddedObject().UniqueId();
79 const TDesC& CEmbeddedContentIterator::Name() const
81 return iSubIterator->EmbeddedObject().Name();
84 const TDesC8& CEmbeddedContentIterator::MimeType() const
86 return iSubIterator->EmbeddedObject().MimeType();
89 TInt CEmbeddedContentIterator::Next()
91 return iSubIterator->Next();