os/security/contentmgmt/referencedrmagent/contentiterator/embeddedcontentiterator.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /*
     2 * Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     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".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description: 
    15 *
    16 */
    17 
    18 
    19 #include <f32file.h>
    20 #include <apmstd.h>
    21 
    22 #include "contentIterator.h"
    23 #include "virtualpath.h"
    24 #include "content.h"
    25 #include "manager.h"
    26 #include "EmbeddedObject.h"
    27 #include "EmbeddedcontentIterator.h"
    28 #include "EmbeddedcontentIteratorBase.h"
    29 
    30 using namespace ContentAccess;
    31 
    32 CEmbeddedContentIterator* CEmbeddedContentIterator::NewL(const TVirtualPathPtr& aVirtualPath, TBool aRecursive, const TDesC8& aMimeType)
    33 	{
    34 	CEmbeddedContentIterator* self = new (ELeave) CEmbeddedContentIterator;
    35 	CleanupStack::PushL(self);
    36 	self->ConstructL(aVirtualPath, aRecursive, aMimeType);
    37 	CleanupStack::Pop(self);
    38 	return self;
    39 	}
    40 
    41 CEmbeddedContentIterator::CEmbeddedContentIterator() 
    42 	{
    43 	}
    44 
    45 CEmbeddedContentIterator::~CEmbeddedContentIterator()
    46 	{	
    47 	delete iSubIterator;
    48 	delete iContent;
    49 	delete iUri;
    50 	delete iMimeType;
    51 	}
    52 
    53 void CEmbeddedContentIterator::ConstructL(const TVirtualPathPtr& aVirtualPath, TBool aRecursive, const TDesC8& aMimeType)
    54 	{
    55 	iUri = aVirtualPath.URI().AllocL();
    56 	iContent = CContent::NewL(*iUri);
    57 	iRecursive = aRecursive;
    58 	iMimeType = aMimeType.AllocL();
    59 	
    60 	if(aVirtualPath.UniqueId().Length() > 0)
    61 		{
    62 		iContent->OpenContainer(aVirtualPath.UniqueId());
    63 		}
    64 	
    65 	// Find the first content object
    66 	iSubIterator = CEmbeddedContentIteratorBase::NewL(*iContent, iRecursive, *iMimeType);
    67 	}
    68 
    69 const TDesC& CEmbeddedContentIterator::FileName() const
    70 	{
    71 	return *iUri;
    72 	}
    73 
    74 const TDesC& CEmbeddedContentIterator::UniqueId() const
    75 	{
    76 	return iSubIterator->EmbeddedObject().UniqueId();
    77 	}
    78 
    79 const TDesC& CEmbeddedContentIterator::Name() const
    80 	{
    81 	return iSubIterator->EmbeddedObject().Name();
    82 	}
    83 
    84 const TDesC8& CEmbeddedContentIterator::MimeType() const
    85 	{
    86 	return iSubIterator->EmbeddedObject().MimeType();
    87 	}
    88 
    89 TInt CEmbeddedContentIterator::Next()
    90 	{
    91 	return iSubIterator->Next();
    92 	}
    93