os/security/contentmgmt/referencedrmagent/contentiterator/FileContentIterator.cpp
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/security/contentmgmt/referencedrmagent/contentiterator/FileContentIterator.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,96 @@
1.4 +/*
1.5 +* Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of the License "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +
1.23 +#include <f32file.h>
1.24 +#include <apmstd.h>
1.25 +
1.26 +#include "contentIterator.h"
1.27 +#include "virtualpath.h"
1.28 +#include "content.h"
1.29 +#include "manager.h"
1.30 +#include "EmbeddedObject.h"
1.31 +#include "FileContentIterator.h"
1.32 +#include "FileContentIteratorBase.h"
1.33 +
1.34 +using namespace ContentAccess;
1.35 +
1.36 +CFileContentIterator* CFileContentIterator::NewL(const TDesC& aPath, TBool aRecursive, const TDesC8& aMimeType)
1.37 + {
1.38 + CFileContentIterator* self = new (ELeave) CFileContentIterator();
1.39 + CleanupStack::PushL(self);
1.40 + self->ConstructL(aPath, aRecursive, aMimeType);
1.41 + CleanupStack::Pop(self);
1.42 + return self;
1.43 + }
1.44 +
1.45 +void CFileContentIterator::ConstructL(const TDesC& aPath, TBool aRecursive, const TDesC8& aMimeType)
1.46 + {
1.47 + if(aPath.Length() == 0)
1.48 + {
1.49 + User::Leave(KErrPathNotFound);
1.50 + }
1.51 +
1.52 + iPath = aPath.AllocL();
1.53 + iRecursive = aRecursive;
1.54 + iMimeType = aMimeType.AllocL();
1.55 +
1.56 + iManager = CManager::NewL();
1.57 +
1.58 + // Find the first content object
1.59 + iSubIterator = CFileContentIteratorBase::NewL(*iManager, *iPath, iRecursive, *iMimeType);
1.60 + }
1.61 +
1.62 +CFileContentIterator::CFileContentIterator()
1.63 + {
1.64 +
1.65 + }
1.66 +CFileContentIterator::~CFileContentIterator()
1.67 + {
1.68 + delete iSubIterator;
1.69 + delete iManager;
1.70 + delete iPath;
1.71 + delete iMimeType;
1.72 + }
1.73 +
1.74 +
1.75 +const TDesC& CFileContentIterator::FileName() const
1.76 + {
1.77 + return iSubIterator->FileName();
1.78 + }
1.79 +
1.80 +const TDesC& CFileContentIterator::UniqueId() const
1.81 + {
1.82 + return iSubIterator->UniqueId();
1.83 + }
1.84 +
1.85 +const TDesC& CFileContentIterator::Name() const
1.86 + {
1.87 + return iSubIterator->Name();
1.88 + }
1.89 +
1.90 +const TDesC8& CFileContentIterator::MimeType() const
1.91 + {
1.92 + return iSubIterator->MimeType();
1.93 + }
1.94 +
1.95 +TInt CFileContentIterator::Next()
1.96 + {
1.97 + return iSubIterator->Next();
1.98 + }
1.99 +