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