mtpfws/mtpfw/dataproviders/dataproviderapi/src/cmtpmetadata.cpp
changeset 0 d0791faffa3f
equal deleted inserted replaced
-1:000000000000 0:d0791faffa3f
       
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include <mtp/cmtpmetadata.h>
       
    17 #include <e32hashtab.h>
       
    18 #include <e32debug.h>
       
    19 
       
    20 #ifdef _DEBUG
       
    21 /**
       
    22 CMTPMetaData panic category.
       
    23 */
       
    24 _LIT(KMTPPanicCategory, "CMTPMetaData");
       
    25 
       
    26 /**
       
    27 CMTPMetaData panic reasons.
       
    28 */
       
    29 enum TMTPPanicReasons
       
    30     {
       
    31     EPanicBadLayout     = 0,
       
    32     EPanicTypeMismatch  = 1,
       
    33     EPanicTypeUnknown   = 2,
       
    34     };
       
    35 
       
    36 /**
       
    37 Creates a CMTPMetaData category panic condition.
       
    38 @param The panic condition reason code.
       
    39 @panic CMTPMetaData aReason Always.
       
    40 */
       
    41 LOCAL_C void Panic(TInt aReason)
       
    42     {
       
    43     User::Panic(KMTPPanicCategory, aReason);
       
    44     }
       
    45 #endif // _DEBUG
       
    46 
       
    47 /**
       
    48 Destructor.
       
    49 */
       
    50 EXPORT_C CMTPMetaData::~CMTPMetaData()
       
    51     {
       
    52     iElementsDesC.ResetAndDestroy();
       
    53     iElementsDesCArray.ResetAndDestroy();
       
    54     iElementsDesCArrayType.Close();	
       
    55     iElementsDesCArrayType.Reset();
       
    56     iElementsInt.Reset();
       
    57     TInt count(iElementsIntArray.Count());
       
    58     while (count)
       
    59         {
       
    60         DeleteIntArray(--count);
       
    61         }
       
    62     iElementsIntArray.Reset();
       
    63     
       
    64     iElementsUint.Reset();
       
    65     count = (iElementsUintArray.Count());
       
    66     while (count)
       
    67         {
       
    68         DeleteUintArray(--count);
       
    69         }
       
    70     iElementsUintArray.Reset();	
       
    71 	iPathHash.Close();
       
    72     } 
       
    73     
       
    74 /**
       
    75 Provides the value of the specified element.
       
    76 @param aId The element identifier.
       
    77 @return The element value.
       
    78 @panic CMTPMetaData 0 In debug builds, if the specified element is not of
       
    79 the requested type.
       
    80 */
       
    81 EXPORT_C const TDesC& CMTPMetaData::DesC(TUint aId) const
       
    82     {
       
    83     __ASSERT_DEBUG((iElements[aId].iType == EDesC), Panic(EPanicTypeMismatch));
       
    84     return *iElementsDesC[iElements[aId].iOffset];
       
    85     }    
       
    86     
       
    87 /**
       
    88 Provides the value of the specified element.
       
    89 @param aId The element identifier.
       
    90 @return The element value.
       
    91 @panic CMTPMetaData 0 In debug builds, if the specified element is not of
       
    92 the requested type.
       
    93 */
       
    94 EXPORT_C const CDesCArray& CMTPMetaData::DesCArray(TUint aId)
       
    95     {
       
    96     __ASSERT_DEBUG((iElements[aId].iType == EDesCArray), Panic(EPanicTypeMismatch));
       
    97     return *iElementsDesCArray[iElements[aId].iOffset];
       
    98     }
       
    99     
       
   100 /**
       
   101 Provides the value of the specified element.
       
   102 @param aId The element identifier.
       
   103 @return The element value.
       
   104 @panic CMTPMetaData 0 In debug builds, if the specified element is not of
       
   105 the requested type.
       
   106 */
       
   107 EXPORT_C TInt CMTPMetaData::Int(TUint aId) const
       
   108     {
       
   109     __ASSERT_DEBUG((iElements[aId].iType == EInt), Panic(EPanicTypeMismatch));
       
   110     return iElementsInt[iElements[aId].iOffset];
       
   111     }
       
   112     
       
   113 /**
       
   114 Provides the value of the specified element.
       
   115 @param aId The element identifier.
       
   116 @return The element value.
       
   117 @panic CMTPMetaData 0 In debug builds, if the specified element is not of
       
   118 the requested type.
       
   119 */
       
   120 EXPORT_C const RArray<TInt>& CMTPMetaData::IntArray(TUint aId) const
       
   121     {
       
   122     __ASSERT_DEBUG((iElements[aId].iType == EIntArray), Panic(EPanicTypeMismatch));
       
   123     return *(reinterpret_cast<const RArray<TInt>*> (iElementsIntArray[iElements[aId].iOffset]));
       
   124     }
       
   125     
       
   126 /**
       
   127 Provides the value of the specified element.
       
   128 @param aId The element identifier.
       
   129 @return The element value.
       
   130 @panic CMTPMetaData 0 In debug builds, if the specified element is not of
       
   131 the requested type.
       
   132 */
       
   133 EXPORT_C TUint CMTPMetaData::Uint(TUint aId) const
       
   134     {
       
   135     __ASSERT_DEBUG((iElements[aId].iType == EUint), Panic(EPanicTypeMismatch));
       
   136     return iElementsUint[iElements[aId].iOffset];
       
   137     }
       
   138     
       
   139 /**
       
   140 Provides the value of the specified element.
       
   141 @param aId The element identifier.
       
   142 @return The element value.
       
   143 @panic CMTPMetaData 0 In debug builds, if the specified element is not of
       
   144 the requested type.
       
   145 */
       
   146 EXPORT_C const RArray<TUint>& CMTPMetaData::UintArray(TUint aId) const
       
   147     {
       
   148     __ASSERT_DEBUG((iElements[aId].iType == EUintArray), Panic(EPanicTypeMismatch));
       
   149     return *(reinterpret_cast<const RArray<TUint>*> (iElementsUintArray[iElements[aId].iOffset]));
       
   150     }
       
   151 
       
   152 /**
       
   153 Provides a copy of the specified element.
       
   154 @param aId The element identifier.
       
   155 @param aValue On successful completion, a copy of the element value.
       
   156 @panic CMTPMetaData 0 In debug builds, if the specified element is not of
       
   157 the requested type.
       
   158 @leave One of the system wide error codes, if a processing failure occurs.
       
   159 */
       
   160 EXPORT_C void CMTPMetaData::GetIntArrayL(TUint aId, RArray<TInt>& aValue)
       
   161     {
       
   162     __ASSERT_DEBUG((iElements[aId].iType == EUintArray), Panic(EPanicTypeMismatch));
       
   163     CopyL(IntArray(aId), aValue);
       
   164     }
       
   165 
       
   166 /**
       
   167 Provides a copy of the specified element.
       
   168 @param aId The element identifier.
       
   169 @param aValue On successful completion, a copy of the element value.
       
   170 @panic CMTPMetaData 0 In debug builds, if the specified element is not of
       
   171 the requested type.
       
   172 @leave One of the system wide error codes, if a processing failure occurs.
       
   173 */
       
   174 EXPORT_C void CMTPMetaData::GetUintArrayL(TUint aId, RArray<TUint>& aValue)
       
   175     {
       
   176     __ASSERT_DEBUG((iElements[aId].iType == EUintArray), Panic(EPanicTypeMismatch));
       
   177     CopyL(UintArray(aId), aValue);
       
   178     }
       
   179     
       
   180 /**
       
   181 Sets the value of the specified element.
       
   182 @param aId The element identifier.
       
   183 @param aValue The element value.
       
   184 @panic CMTPMetaData 0 In debug builds, if the specified element is not of
       
   185 the requested type.
       
   186 @leave One of the system wide error codes, if a processing failure occurs.
       
   187 */
       
   188 EXPORT_C void CMTPMetaData::SetDesCL(TUint aId, const TDesC& aValue)
       
   189     {
       
   190     const TElementMetaData& KElement(iElements[aId]);
       
   191     __ASSERT_DEBUG((KElement.iType == EDesC), Panic(EPanicTypeMismatch));
       
   192     delete iElementsDesC[KElement.iOffset];
       
   193     iElementsDesC[KElement.iOffset] = NULL;
       
   194 	iElementsDesC[KElement.iOffset] = aValue.AllocL();	
       
   195     }
       
   196     
       
   197 /**
       
   198 Sets the value of the specified element.
       
   199 @param aId The element identifier.
       
   200 @param aValue The element value.
       
   201 @panic CMTPMetaData 0 In debug builds, if the specified element is not of
       
   202 the requested type.
       
   203 @leave One of the system wide error codes, if a processing failure occurs.
       
   204 */
       
   205 EXPORT_C void CMTPMetaData::SetDesCArrayL(TUint aId, const CDesCArrayFlat& aValue)
       
   206     {
       
   207     __ASSERT_DEBUG((iElements[aId].iType == EDesCArray), Panic(EPanicTypeMismatch));
       
   208     TUint idx(iElements[aId].iOffset);
       
   209     delete iElementsDesCArray[idx];
       
   210     iElementsDesCArray[idx] = NULL;
       
   211     iElementsDesCArray[idx] = new(ELeave) CDesCArrayFlat(KGranularity);
       
   212 	iElementsDesCArrayType[idx]=EDesCArrayFlat;
       
   213     CopyL(aValue, *iElementsDesCArray[idx]);
       
   214     }
       
   215     
       
   216 /**
       
   217 Sets the value of the specified element.
       
   218 @param aId The element identifier.
       
   219 @param aValue The element value.
       
   220 @panic CMTPMetaData 0 In debug builds, if the specified element is not of
       
   221 the requested type.
       
   222 @leave One of the system wide error codes, if a processing failure occurs.
       
   223 */
       
   224 EXPORT_C void CMTPMetaData::SetDesCArrayL(TUint aId, const CDesCArraySeg& aValue)
       
   225     {
       
   226     __ASSERT_DEBUG((iElements[aId].iType == EDesCArray), Panic(EPanicTypeMismatch));
       
   227     TUint idx(iElements[aId].iOffset);
       
   228     delete iElementsDesCArray[idx];
       
   229     iElementsDesCArray[idx] = NULL;
       
   230     iElementsDesCArray[idx] = new(ELeave) CDesCArraySeg(KGranularity);
       
   231 	iElementsDesCArrayType[idx]=EDesCArraySeg;
       
   232     CopyL(aValue, *iElementsDesCArray[idx]);
       
   233     }
       
   234     
       
   235 /**
       
   236 Sets the value of the specified element.
       
   237 @param aId The element identifier.
       
   238 @param aValue The element value.
       
   239 @panic CMTPMetaData 0 In debug builds, if the specified element is not of
       
   240 the requested type.
       
   241 */
       
   242 EXPORT_C void CMTPMetaData::SetInt(TUint aId, TInt aValue)
       
   243     {
       
   244     __ASSERT_DEBUG((iElements[aId].iType == EInt), Panic(EPanicTypeMismatch));
       
   245     iElementsInt[iElements[aId].iOffset] = aValue;
       
   246     }
       
   247     
       
   248 /**
       
   249 Sets the value of the specified element.
       
   250 @param aId The element identifier.
       
   251 @param aValue The element value.
       
   252 @panic CMTPMetaData 0 In debug builds, if the specified element is not of
       
   253 the requested type.
       
   254 @leave One of the system wide error codes, if a processing failure occurs.
       
   255 */
       
   256 EXPORT_C void CMTPMetaData::SetIntArrayL(TUint aId, const RArray<TInt>& aValue)
       
   257     {
       
   258     __ASSERT_DEBUG((iElements[aId].iType == EIntArray), Panic(EPanicTypeMismatch));
       
   259     TUint idx(iElements[aId].iOffset);
       
   260     DeleteIntArray(idx);
       
   261     iElementsIntArray[idx] = new(ELeave) RArray<TInt>;
       
   262     CopyL(aValue, *(reinterpret_cast<RArray<TInt>*>(iElementsIntArray[iElements[aId].iOffset])));
       
   263     }
       
   264     
       
   265 /**
       
   266 Sets the value of the specified element.
       
   267 @param aId The element identifier.
       
   268 @param aValue The element value.
       
   269 @panic CMTPMetaData 0 In debug builds, if the specified element is not of
       
   270 the requested type.
       
   271 */
       
   272 EXPORT_C void CMTPMetaData::SetUint(TUint aId, TUint aValue)
       
   273     {
       
   274     __ASSERT_DEBUG((iElements[aId].iType == EUint), Panic(EPanicTypeMismatch));
       
   275     iElementsUint[iElements[aId].iOffset] = aValue;
       
   276     }
       
   277     
       
   278 /**
       
   279 Sets the value of the specified element.
       
   280 @param aId The element identifier.
       
   281 @param aValue The element value.
       
   282 @panic CMTPMetaData 0 In debug builds, if the specified element is not of
       
   283 the requested type.
       
   284 @leave One of the system wide error codes, if a processing failure occurs.
       
   285 */
       
   286 EXPORT_C void CMTPMetaData::SetUintArrayL(TUint aId, const RArray<TUint>& aValue)
       
   287     {
       
   288     __ASSERT_DEBUG((iElements[aId].iType == EUintArray), Panic(EPanicTypeMismatch));
       
   289     TUint idx(iElements[aId].iOffset);
       
   290     DeleteUintArray(idx);
       
   291     iElementsUintArray[idx] = new(ELeave) RArray<TUint>;
       
   292     CopyL(aValue, *(reinterpret_cast<RArray<TUint>*>(iElementsUintArray[iElements[aId].iOffset])));
       
   293     }
       
   294 
       
   295 /**
       
   296 Provides an MTP object manager's object meta data record extension 
       
   297 interface implementation for the specified interface Uid. 
       
   298 @param aInterfaceUid Unique identifier for the extension interface being 
       
   299 requested.
       
   300 @return Pointer to an interface instance or 0 if the interface is not 
       
   301 supported. Ownership is NOT transfered.
       
   302 */
       
   303 EXPORT_C TAny* CMTPMetaData::GetExtendedInterface(TUid /*aInterfaceUid*/)
       
   304     {
       
   305     return iExtensionInterfaces;
       
   306     }
       
   307 
       
   308 /**
       
   309 Constructor.
       
   310 */
       
   311 CMTPMetaData::CMTPMetaData(const TElementMetaData* aElements, TUint aCount) :
       
   312     iElements(sizeof(*aElements), const_cast<TElementMetaData*>(aElements), aCount),
       
   313     iElementsDesC(KGranularity)
       
   314     {
       
   315 
       
   316     }
       
   317     
       
   318 /**
       
   319 Second phase constructor.
       
   320 @leave One of the system wide error code, if a processing failure occurs.
       
   321 */
       
   322 void CMTPMetaData::ConstructL()
       
   323     {
       
   324     const TUint KCount(iElements.Count());
       
   325     for (TUint i(0); (i < KCount); i++)
       
   326         {
       
   327         const TElementMetaData& KElement(iElements[i]);
       
   328         switch (KElement.iType)
       
   329             {
       
   330         case EDesC:
       
   331             __ASSERT_DEBUG((iElementsDesC.Count() == KElement.iOffset), Panic(EPanicBadLayout));
       
   332             iElementsDesC.AppendL(KNullDesC().AllocLC());
       
   333             CleanupStack::Pop();
       
   334             break;
       
   335             
       
   336         case EDesCArray:
       
   337         	{
       
   338             __ASSERT_DEBUG((iElementsDesCArray.Count() == KElement.iOffset), Panic(EPanicBadLayout));
       
   339             CDesCArrayFlat* desarray = new(ELeave) CDesCArrayFlat(KGranularity);
       
   340             CleanupStack::PushL(desarray);
       
   341             iElementsDesCArray.AppendL(desarray);
       
   342             CleanupStack::Pop(desarray);
       
   343 			iElementsDesCArrayType.AppendL(EDesCArrayFlat);
       
   344             break;
       
   345         	}
       
   346             
       
   347         case EInt:
       
   348             __ASSERT_DEBUG((iElementsInt.Count() == KElement.iOffset), Panic(EPanicBadLayout));
       
   349             iElementsInt.AppendL(0);
       
   350             break;
       
   351             
       
   352         case EIntArray:
       
   353         	{
       
   354             __ASSERT_DEBUG((iElementsIntArray.Count() == KElement.iOffset), Panic(EPanicBadLayout));
       
   355             RArray<TInt>* intarray = new(ELeave) RArray<TInt>;
       
   356             CleanupStack::PushL(intarray);
       
   357             iElementsIntArray.AppendL(intarray);
       
   358             CleanupStack::Pop(intarray);
       
   359             break;
       
   360         	}
       
   361             
       
   362         case EUint:
       
   363             __ASSERT_DEBUG((iElementsUint.Count() == KElement.iOffset), Panic(EPanicBadLayout));
       
   364             iElementsUint.AppendL(0);
       
   365             break;
       
   366             
       
   367         case EUintArray:
       
   368         	{
       
   369             __ASSERT_DEBUG((iElementsUintArray.Count() == KElement.iOffset), Panic(EPanicBadLayout));
       
   370             RArray<TUint>* uintarray = new(ELeave) RArray<TUint>;
       
   371             CleanupStack::PushL(uintarray);
       
   372             iElementsUintArray.AppendL(uintarray);
       
   373             CleanupStack::Pop(uintarray);
       
   374             break;
       
   375         	}
       
   376             
       
   377         default:
       
   378             __DEBUG_ONLY(Panic(EPanicTypeUnknown));
       
   379             break;
       
   380             }
       
   381         }
       
   382     }      
       
   383     
       
   384 /**
       
   385 Second phase copy constructor.
       
   386 @param aFrom The source meta-data.
       
   387 @leave One of the system wide error code, if a processing failure occurs.
       
   388 */
       
   389 void CMTPMetaData::ConstructL(const CMTPMetaData& aFrom)
       
   390     {
       
   391     // iElementsDesC
       
   392     TUint count(aFrom.iElementsDesC.Count());
       
   393     for (TUint i(0); (i < count); i++)
       
   394         {
       
   395         iElementsDesC.AppendL(aFrom.iElementsDesC[i]->AllocLC());
       
   396         CleanupStack::Pop();
       
   397         }
       
   398     
       
   399     // iElementsDesCArray 
       
   400     count = aFrom.iElementsDesCArray.Count();
       
   401     for (TUint i(0); (i < count); i++)
       
   402         {
       
   403         if ((aFrom.iElementsDesCArrayType[i])==EDesCArrayFlat)
       
   404             {
       
   405             CDesCArrayFlat* flatarray = new(ELeave) CDesCArrayFlat(KGranularity);
       
   406         	CleanupStack::PushL(flatarray);
       
   407             iElementsDesCArray.AppendL(flatarray);
       
   408             CleanupStack::Pop(flatarray);
       
   409             }
       
   410         else
       
   411             {
       
   412             CDesCArraySeg* segarray = new(ELeave) CDesCArraySeg(KGranularity);
       
   413         	CleanupStack::PushL(segarray);
       
   414             iElementsDesCArray.AppendL(segarray);
       
   415             CleanupStack::Pop(segarray);
       
   416             }
       
   417         CopyL(*aFrom.iElementsDesCArray[i], *iElementsDesCArray[i]);
       
   418         }
       
   419     
       
   420     // iElementsInt    
       
   421     CopyL(aFrom.iElementsInt, iElementsInt);
       
   422     
       
   423     // iElementsIntArray
       
   424     count = aFrom.iElementsIntArray.Count();
       
   425     for (TUint i(0); (i < count); i++)
       
   426         {        
       
   427         RArray<TInt>* intarray = new(ELeave) RArray<TInt>;
       
   428     	CleanupStack::PushL(intarray);
       
   429         iElementsIntArray.AppendL(intarray);
       
   430         CleanupStack::Pop(intarray);
       
   431         const RArray<TInt>& from(*reinterpret_cast<RArray<TInt>*>(aFrom.iElementsIntArray[i]));
       
   432         RArray<TInt>& to(*reinterpret_cast<RArray<TInt>*>(iElementsIntArray[i]));
       
   433         CopyL(from, to);
       
   434         }
       
   435         
       
   436     // iElementsUint
       
   437     CopyL(aFrom.iElementsUint, iElementsUint);
       
   438     
       
   439     // iElementsIntArray
       
   440     count = aFrom.iElementsUintArray.Count();
       
   441     for (TUint i(0); (i < count); i++)
       
   442         {
       
   443         RArray<TUint>* array = new(ELeave) RArray<TUint>;
       
   444     	CleanupStack::PushL(array);
       
   445         iElementsUintArray.AppendL(array);
       
   446         CleanupStack::Pop(array);
       
   447         const RArray<TUint>& from(*reinterpret_cast<RArray<TUint>*>(aFrom.iElementsUintArray[i]));
       
   448         RArray<TUint>& to(*reinterpret_cast<RArray<TUint>*>(iElementsUintArray[i]));
       
   449         CopyL(from, to);
       
   450         }
       
   451     // iPathHash
       
   452     for(TInt i=0; i<aFrom.iPathHash.Count(); ++i)
       
   453     	{
       
   454     	this->iPathHash.Append(aFrom.iPathHash[i]);
       
   455     	}
       
   456     }
       
   457 
       
   458 /**
       
   459 Default constructor.
       
   460 */
       
   461 CMTPMetaData::CMTPMetaData() :
       
   462     iElementsDesC(KGranularity)
       
   463     {
       
   464     
       
   465     }  
       
   466     
       
   467 /**
       
   468 Copies the specified array contents.
       
   469 @param aFrom The source array.
       
   470 @param aTo The target array.
       
   471 @leave One of the system wide error code, if a processing failure occurs.
       
   472 */
       
   473 void CMTPMetaData::CopyL(const CDesCArray& aFrom, CDesCArray& aTo)
       
   474     {
       
   475     const TUint KCount(aFrom.Count());
       
   476     for (TUint i(0); (i < KCount); i++)
       
   477         {
       
   478         aTo.AppendL(aFrom[i]);
       
   479         }
       
   480     }
       
   481     
       
   482 /**
       
   483 Copies the specified array contents.
       
   484 @param aFrom The source array.
       
   485 @param aTo The target array.
       
   486 @leave One of the system wide error code, if a processing failure occurs.
       
   487 */
       
   488 void CMTPMetaData::CopyL(const RArray<TInt>& aFrom, RArray<TInt>& aTo)
       
   489     {
       
   490     aTo.Reset();
       
   491     const TUint KCount(aFrom.Count());
       
   492     for (TUint i(0); (i < KCount); i++)
       
   493         {
       
   494         aTo.AppendL(aFrom[i]);
       
   495         }
       
   496     }
       
   497     
       
   498 /**
       
   499 Copies the specified array contents.
       
   500 @param aFrom The source array.
       
   501 @param aTo The target array.
       
   502 @leave One of the system wide error code, if a processing failure occurs.
       
   503 */
       
   504 void CMTPMetaData::CopyL(const RArray<TUint>& aFrom, RArray<TUint>& aTo)
       
   505     {
       
   506     aTo.Reset();
       
   507     const TUint KCount(aFrom.Count());
       
   508     for (TUint i(0); (i < KCount); i++)
       
   509         {
       
   510         aTo.AppendL(aFrom[i]);
       
   511         }
       
   512     }
       
   513     
       
   514 /**
       
   515 Deletes the specified IntArray.
       
   516 @param aIdx The iElementsIntArray index.
       
   517 */
       
   518 void CMTPMetaData::DeleteIntArray(TUint aIdx)
       
   519     {
       
   520     RArray<TInt>* array(reinterpret_cast<RArray<TInt>*>(iElementsIntArray[aIdx]));
       
   521     array->Reset();
       
   522     delete array;
       
   523     }
       
   524     
       
   525 /**
       
   526 Deletes the specified IntArray.
       
   527 @param aIdx The iElementsIntArray index.
       
   528 */
       
   529 void CMTPMetaData::DeleteUintArray(TUint aIdx)
       
   530     {
       
   531     RArray<TUint>* array(reinterpret_cast<RArray<TUint>*>(iElementsUintArray[aIdx]));
       
   532     array->Reset();
       
   533     delete array;
       
   534     }
       
   535 EXPORT_C void CMTPMetaData::SetHashPath(const TDesC16& aExclusionPath, TUint aIndex)
       
   536 	{
       
   537 	TFileName ex(aExclusionPath);
       
   538 	ex.LowerCase();
       
   539 	TUint32 HashCode=DefaultHash::Des16(ex);
       
   540 	TPathHash entry;
       
   541     entry.iHash=HashCode;
       
   542     entry.iIndex=aIndex;
       
   543 	
       
   544 	TLinearOrder<TPathHash> order(CMTPMetaData::CompareTPathHash);
       
   545 	iPathHash.InsertInOrderAllowRepeats(entry, order);
       
   546 	}
       
   547 
       
   548 EXPORT_C TInt CMTPMetaData::CompareTPathHash(const TPathHash& aVal1, const TPathHash& aVal2)
       
   549 	{
       
   550 	return (aVal1.iHash>aVal2.iHash)?1:((aVal1.iHash==aVal2.iHash)?0:-1);
       
   551 	}
       
   552 
       
   553 EXPORT_C const RArray<CMTPMetaData::TPathHash>& CMTPMetaData::GetHashPathArray()
       
   554 	{
       
   555 	return iPathHash;
       
   556 	}