mmserv/metadatautility/Src/MetaDataUtility.cpp
changeset 0 71ca22bcf22a
equal deleted inserted replaced
-1:000000000000 0:71ca22bcf22a
       
     1 /*
       
     2 * Copyright (c) 2004 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 "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:  This class is the main interface to MetaDataUtility.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include	<MetaDataUtility.h>
       
    22 #include	"MetaDataUtilityBody.h"
       
    23 #ifdef _DEBUG
       
    24 #include	<e32svr.h>
       
    25 #endif
       
    26 
       
    27 // ============================ MEMBER FUNCTIONS ===============================
       
    28 
       
    29 // -----------------------------------------------------------------------------
       
    30 // CMetaDataUtility::CMetaDataUtility
       
    31 // C++ default constructor can NOT contain any code, that
       
    32 // might leave.
       
    33 // -----------------------------------------------------------------------------
       
    34 //
       
    35 CMetaDataUtility::CMetaDataUtility()
       
    36 	:	iBody(NULL)
       
    37     {
       
    38     }
       
    39 
       
    40 // -----------------------------------------------------------------------------
       
    41 // CMetaDataUtility::ConstructL
       
    42 // Symbian 2nd phase constructor can leave.
       
    43 // -----------------------------------------------------------------------------
       
    44 //
       
    45 void CMetaDataUtility::ConstructL()
       
    46     {
       
    47 	iBody = CMetaDataUtilityBody::NewL();
       
    48 #ifdef _DEBUG
       
    49 	RDebug::Print(_L("CMetaDataUtility::ConstructL - Done!"));
       
    50 #endif
       
    51     }
       
    52 
       
    53 // -----------------------------------------------------------------------------
       
    54 // CMetaDataUtility::NewL
       
    55 // Two-phased constructor.
       
    56 // -----------------------------------------------------------------------------
       
    57 //
       
    58 EXPORT_C CMetaDataUtility* CMetaDataUtility::NewL()
       
    59     {
       
    60 #ifdef _DEBUG
       
    61 	RDebug::Print(_L("CMetaDataUtility::NewL"));
       
    62 #endif
       
    63 	CMetaDataUtility* self = new( ELeave ) CMetaDataUtility;
       
    64     CleanupStack::PushL( self );
       
    65     self->ConstructL();
       
    66     CleanupStack::Pop();
       
    67     return self;
       
    68     }
       
    69 
       
    70 // Destructor
       
    71 EXPORT_C CMetaDataUtility::~CMetaDataUtility()
       
    72 	{
       
    73 	delete iBody;
       
    74 	}
       
    75 
       
    76 // -----------------------------------------------------------------------------
       
    77 // CMetaDataUtility::OpenFileL
       
    78 // -----------------------------------------------------------------------------
       
    79 //
       
    80 EXPORT_C void CMetaDataUtility::OpenFileL(
       
    81 	const TDesC& aFileName )
       
    82 	{
       
    83 	RArray<TMetaDataFieldId> wantedFields;
       
    84 	CleanupClosePushL(wantedFields);
       
    85 	iBody->OpenFileL(aFileName, wantedFields);
       
    86 	CleanupStack::PopAndDestroy();
       
    87 	}
       
    88 
       
    89 // -----------------------------------------------------------------------------
       
    90 // CMetaDataUtility::OpenFileL
       
    91 // -----------------------------------------------------------------------------
       
    92 //
       
    93 EXPORT_C void CMetaDataUtility::OpenFileL(
       
    94 	const TDesC& aFileName,
       
    95 	const RArray<TMetaDataFieldId>& aWantedFields )
       
    96 	{
       
    97 	iBody->OpenFileL(aFileName, aWantedFields);
       
    98 	}
       
    99 
       
   100 // -----------------------------------------------------------------------------
       
   101 // CMetaDataUtility::OpenFileL
       
   102 // -----------------------------------------------------------------------------
       
   103 //
       
   104 EXPORT_C void CMetaDataUtility::OpenFileL(
       
   105 	RFile& aFile )
       
   106 	{
       
   107 	RArray<TMetaDataFieldId> wantedFields;
       
   108 	CleanupClosePushL(wantedFields);
       
   109 	iBody->OpenFileL(aFile, wantedFields);
       
   110 	CleanupStack::PopAndDestroy();
       
   111 	}
       
   112 
       
   113 // -----------------------------------------------------------------------------
       
   114 // CMetaDataUtility::OpenFileL
       
   115 // -----------------------------------------------------------------------------
       
   116 //
       
   117 EXPORT_C void CMetaDataUtility::OpenFileL(
       
   118 	RFile& aFile,
       
   119 	const RArray<TMetaDataFieldId>& aWantedFields )
       
   120 	{
       
   121 	iBody->OpenFileL(aFile, aWantedFields);
       
   122 	}
       
   123 
       
   124 // -----------------------------------------------------------------------------
       
   125 // CMetaDataUtility::OpenDesL
       
   126 // -----------------------------------------------------------------------------
       
   127 //
       
   128 EXPORT_C void CMetaDataUtility::OpenDesL(
       
   129 	const TDesC8& aDes )
       
   130 	{
       
   131 	RArray<TMetaDataFieldId> wantedFields;
       
   132 	CleanupClosePushL(wantedFields);
       
   133 	iBody->OpenDesL(aDes, wantedFields);
       
   134 	CleanupStack::PopAndDestroy();
       
   135 	}
       
   136 
       
   137 // -----------------------------------------------------------------------------
       
   138 // CMetaDataUtility::OpenDesL
       
   139 // -----------------------------------------------------------------------------
       
   140 //
       
   141 EXPORT_C void CMetaDataUtility::OpenDesL(
       
   142 	const TDesC8& aDes,
       
   143 	const RArray<TMetaDataFieldId>& aWantedFields )
       
   144 	{
       
   145 	iBody->OpenDesL(aDes, aWantedFields);
       
   146 	}
       
   147 // -----------------------------------------------------------------------------
       
   148 // CMetaDataUtility::OpenFileL
       
   149 // -----------------------------------------------------------------------------
       
   150 //
       
   151 EXPORT_C void CMetaDataUtility::OpenFileL(
       
   152 	const TDesC& aFileName,
       
   153 	const TDesC8& aMimeType )
       
   154 	{
       
   155 	#ifdef _DEBUG
       
   156 	RDebug::Print(_L("CMetaDataUtility::OpenFileL with MimeType"));
       
   157 	#endif
       
   158 	RArray<TMetaDataFieldId> wantedFields;
       
   159 	CleanupClosePushL(wantedFields);
       
   160 	iBody->OpenFileL(aFileName, wantedFields, aMimeType);
       
   161 	CleanupStack::PopAndDestroy();
       
   162 	}
       
   163 
       
   164 // -----------------------------------------------------------------------------
       
   165 // CMetaDataUtility::OpenFileL
       
   166 // -----------------------------------------------------------------------------
       
   167 //
       
   168 EXPORT_C void CMetaDataUtility::OpenFileL(
       
   169 	const TDesC& aFileName,
       
   170 	const RArray<TMetaDataFieldId>& aWantedFields,
       
   171 	const TDesC8& aMimeType )
       
   172 	{
       
   173 	#ifdef _DEBUG
       
   174 		RDebug::Print(_L("CMetaDataUtility::OpenFileL with MimeType"));
       
   175 	#endif
       
   176 		iBody->OpenFileL(aFileName, aWantedFields, aMimeType);
       
   177 	}
       
   178 
       
   179 // -----------------------------------------------------------------------------
       
   180 // CMetaDataUtility::OpenFileL
       
   181 // -----------------------------------------------------------------------------
       
   182 //
       
   183 EXPORT_C void CMetaDataUtility::OpenFileL(
       
   184 	RFile& aFile,
       
   185 	const TDesC8& aMimeType )
       
   186 	{
       
   187 	#ifdef _DEBUG
       
   188 		RDebug::Print(_L("CMetaDataUtility::OpenFileL with MimeType"));
       
   189 	#endif
       
   190 		RArray<TMetaDataFieldId> wantedFields;
       
   191 		CleanupClosePushL(wantedFields);
       
   192 		iBody->OpenFileL(aFile, wantedFields, aMimeType);
       
   193 		CleanupStack::PopAndDestroy();
       
   194 	}
       
   195 
       
   196 // -----------------------------------------------------------------------------
       
   197 // CMetaDataUtility::OpenFileL
       
   198 // -----------------------------------------------------------------------------
       
   199 //
       
   200 EXPORT_C void CMetaDataUtility::OpenFileL(
       
   201 	RFile& aFile,
       
   202 	const RArray<TMetaDataFieldId>& aWantedFields,
       
   203 	const TDesC8& aMimeType )
       
   204 	{
       
   205 	#ifdef _DEBUG
       
   206 		RDebug::Print(_L("CMetaDataUtility::OpenFileL with MimeType"));
       
   207 	#endif
       
   208 		iBody->OpenFileL(aFile, aWantedFields, aMimeType);
       
   209 	}
       
   210 
       
   211 // -----------------------------------------------------------------------------
       
   212 // CMetaDataUtility::OpenDesL
       
   213 // -----------------------------------------------------------------------------
       
   214 //
       
   215 EXPORT_C void CMetaDataUtility::OpenDesL(
       
   216 	const TDesC8& aDes,
       
   217 	const TDesC8& aMimeType )
       
   218 	{
       
   219 	#ifdef _DEBUG
       
   220 		RDebug::Print(_L("CMetaDataUtility::OpenFileL with MimeType"));
       
   221 	#endif
       
   222 		RArray<TMetaDataFieldId> wantedFields;
       
   223 		CleanupClosePushL(wantedFields);
       
   224 		iBody->OpenDesL(aDes, wantedFields, aMimeType);
       
   225 		CleanupStack::PopAndDestroy();
       
   226 	}
       
   227 
       
   228 // -----------------------------------------------------------------------------
       
   229 // CMetaDataUtility::OpenDesL
       
   230 // -----------------------------------------------------------------------------
       
   231 //
       
   232 EXPORT_C void CMetaDataUtility::OpenDesL(
       
   233 	const TDesC8& aDes,
       
   234 	const RArray<TMetaDataFieldId>& aWantedFields,
       
   235 	const TDesC8& aMimeType )
       
   236 	{
       
   237 	#ifdef _DEBUG
       
   238 		RDebug::Print(_L("CMetaDataUtility::OpenFileL with MimeType"));
       
   239 	#endif
       
   240 		iBody->OpenDesL(aDes, aWantedFields, aMimeType);
       
   241 	}
       
   242 
       
   243 // -----------------------------------------------------------------------------
       
   244 // CMetaDataUtility::MetaDataCount
       
   245 // -----------------------------------------------------------------------------
       
   246 //
       
   247 EXPORT_C TInt CMetaDataUtility::MetaDataCount() const
       
   248    	{
       
   249 	return iBody->MetaDataCount();
       
   250     }
       
   251 
       
   252 // -----------------------------------------------------------------------------
       
   253 // CMetaDataUtility::MetaDataFieldsL
       
   254 // -----------------------------------------------------------------------------
       
   255 //
       
   256 EXPORT_C const CMetaDataFieldContainer& CMetaDataUtility::MetaDataFieldsL()
       
   257    	{
       
   258 	return iBody->MetaDataFieldsL();
       
   259 	}
       
   260 
       
   261 // -----------------------------------------------------------------------------
       
   262 // CMetaDataUtility::ResetL
       
   263 // -----------------------------------------------------------------------------
       
   264 //
       
   265 EXPORT_C void CMetaDataUtility::ResetL()
       
   266    	{
       
   267 	iBody->ResetL();
       
   268 	}
       
   269 	
       
   270 // -----------------------------------------------------------------------------
       
   271 // CMetaDataUtility::ID3Version
       
   272 // -----------------------------------------------------------------------------
       
   273 //	
       
   274 EXPORT_C TID3Version CMetaDataUtility::ID3Version()
       
   275     {
       
   276 	return iBody->ID3Version();
       
   277     }
       
   278 
       
   279 // -----------------------------------------------------------------------------
       
   280 // CMetaDataUtility::InitChunkData
       
   281 // -----------------------------------------------------------------------------
       
   282 //	
       
   283 EXPORT_C TInt CMetaDataUtility::InitChunkData(
       
   284         const TDesC8& aMimeType, 
       
   285         MMDUChunkDataObserver& aObserver )
       
   286     {
       
   287 	return iBody->InitChunkData( (TDesC8&) aMimeType, aObserver );
       
   288     }
       
   289 
       
   290 // -----------------------------------------------------------------------------
       
   291 // CMetaDataUtility::ProcessChunkData
       
   292 // -----------------------------------------------------------------------------
       
   293 //	
       
   294 EXPORT_C TInt CMetaDataUtility::ProcessChunkData( 
       
   295         const TDesC8& aChunk,
       
   296         TBool aFinalChunk )
       
   297     {
       
   298 	return iBody->ProcessChunkData( (TDesC8&) aChunk, aFinalChunk );
       
   299     }
       
   300 
       
   301 // -----------------------------------------------------------------------------
       
   302 // CMetaDataUtility::ParseChunkData
       
   303 // -----------------------------------------------------------------------------
       
   304 //  
       
   305 EXPORT_C TInt CMetaDataUtility::ParseChunkData()
       
   306     {
       
   307     return iBody->ParseChunkData();
       
   308     }
       
   309 
       
   310 // -----------------------------------------------------------------------------
       
   311 // CMetaDataUtility::IsChunkDataMode
       
   312 // -----------------------------------------------------------------------------
       
   313 //	
       
   314 EXPORT_C TBool CMetaDataUtility::IsChunkDataMode()
       
   315     {
       
   316 	return iBody->IsChunkDataMode();
       
   317     }
       
   318 
       
   319 // -----------------------------------------------------------------------------
       
   320 // CMetaDataUtility::CloseChunkData
       
   321 // -----------------------------------------------------------------------------
       
   322 //	
       
   323 EXPORT_C void CMetaDataUtility::CloseChunkData()
       
   324     {
       
   325 	return iBody->CloseChunkData();
       
   326     }
       
   327 
       
   328 
       
   329 
       
   330 //  End of File