mmserv/metadatautility/Src/MetaDataParser.cpp
branchRCL_3
changeset 17 3570217d8c21
parent 0 71ca22bcf22a
child 18 2eb3b066cc7d
child 20 b67dd1fc57c5
equal deleted inserted replaced
13:f5c5c82a163e 17:3570217d8c21
    17 */
    17 */
    18 
    18 
    19 
    19 
    20 
    20 
    21 // INCLUDE FILES
    21 // INCLUDE FILES
    22 #include "MetaDataParser.h"
       
    23 #include <syslangutil.h>
    22 #include <syslangutil.h>
    24 #include <languages.hrh>
    23 #include <languages.hrh>
    25 #include <TopCharacterSet.rsg>
    24 #include <TopCharacterSet.rsg>
    26 #include <data_caging_path_literals.hrh>
    25 #include <data_caging_path_literals.hrh>
    27 #include <bautils.h>
    26 #include <bautils.h>
       
    27 
       
    28 #include "MetaDataParser.h"
       
    29 #include "MetaDataSourceFile.h"
       
    30 #include "MetaDataFieldContainer.h"
    28 
    31 
    29 _LIT(KCharacterSetRscFile, "TopCharacterSet.rsc");
    32 _LIT(KCharacterSetRscFile, "TopCharacterSet.rsc");
    30 
    33 
    31 // ============================ MEMBER FUNCTIONS ===============================
    34 // ============================ MEMBER FUNCTIONS ===============================
    32 
    35 
   119 // -----------------------------------------------------------------------------
   122 // -----------------------------------------------------------------------------
   120 //
   123 //
   121 TInt CMetaDataParser::UnicodeBOM(
   124 TInt CMetaDataParser::UnicodeBOM(
   122 	const TDesC8& aUnicode )
   125 	const TDesC8& aUnicode )
   123 	{
   126 	{
       
   127 #ifdef _DEBUG
       
   128      RDebug::Print(_L("CMetaDataParser::UnicodeBOM"));
       
   129 #endif
       
   130     
   124 	TPtrC8 bomData( aUnicode.Left( 2 ) );
   131 	TPtrC8 bomData( aUnicode.Left( 2 ) );
   125 
   132 
   126 	TBuf8<2> BEbom; // Big endian BOM
   133 	TBuf8<2> BEbom; // Big endian BOM
   127 	BEbom.Append( TChar( 0xFE ) );
   134 	BEbom.Append( TChar( 0xFE ) );
   128 	BEbom.Append( TChar( 0xFF ) );
   135 	BEbom.Append( TChar( 0xFF ) );
   160 // CMetaDataParser::MapID3v1GenreToString()
   167 // CMetaDataParser::MapID3v1GenreToString()
   161 // -----------------------------------------------------------------------------
   168 // -----------------------------------------------------------------------------
   162 //
   169 //
   163 void CMetaDataParser::MapID3GenreToStringL(TInt aNum, TDes& aGenrePtr)
   170 void CMetaDataParser::MapID3GenreToStringL(TInt aNum, TDes& aGenrePtr)
   164 {
   171 {
       
   172 #ifdef _DEBUG
       
   173      RDebug::Print(_L("CMetaDataParser::MapID3GenreToStringL"));
       
   174 #endif
       
   175     
   165 	if(aNum < 0 || aNum > 125 && aNum != 199)
   176 	if(aNum < 0 || aNum > 125 && aNum != 199)
   166 		{
   177 		{
   167 		return;
   178 		return;
   168 		}
   179 		}
   169 	switch(aNum)
   180 	switch(aNum)
   558 // CMetaDataParser::MapID3v2GenreToString()
   569 // CMetaDataParser::MapID3v2GenreToString()
   559 // -----------------------------------------------------------------------------
   570 // -----------------------------------------------------------------------------
   560 //
   571 //
   561 void CMetaDataParser::MapID3GenreToStringL(TInt aNum, TDes8& aGenrePtr)
   572 void CMetaDataParser::MapID3GenreToStringL(TInt aNum, TDes8& aGenrePtr)
   562 {
   573 {
       
   574 #ifdef _DEBUG
       
   575      RDebug::Print(_L("CMetaDataParser::MapID3GenreToStringL"));
       
   576 #endif
       
   577 
   563 	if(aNum < 0 || aNum > 125 && aNum != 199)
   578 	if(aNum < 0 || aNum > 125 && aNum != 199)
   564 		{
   579 		{
   565 		return;
   580 		return;
   566 		}
   581 		}
   567 	switch(aNum)
   582 	switch(aNum)
  1240 			return ETrue;
  1255 			return ETrue;
  1241 			}
  1256 			}
  1242 		}
  1257 		}
  1243 	return EFalse;
  1258 	return EFalse;
  1244 	}
  1259 	}
       
  1260 
       
  1261 
       
  1262 // -----------------------------------------------------------------------------
       
  1263 // CMetaDataParser::CommonParseL
       
  1264 // -----------------------------------------------------------------------------
       
  1265 //
       
  1266 void CMetaDataParser::CommonParseL(
       
  1267     CMetaDataSourceFile* aSource,
       
  1268     const RArray<TMetaDataFieldId>& aWantedFields,
       
  1269     CMetaDataFieldContainer& aContainer )
       
  1270     {
       
  1271 #ifdef _DEBUG
       
  1272      RDebug::Print(_L("CMetaDataParser::CommonParseL"));
       
  1273 #endif
       
  1274 
       
  1275     GetProtectedL(aSource, aContainer);
       
  1276     ParseL(aWantedFields, aContainer);
       
  1277     }
       
  1278 
       
  1279 // -----------------------------------------------------------------------------
       
  1280 // CMetaDataParser::GetProtectedL
       
  1281 // -----------------------------------------------------------------------------
       
  1282 //
       
  1283 void CMetaDataParser::GetProtectedL( CMetaDataSourceFile* aSource,
       
  1284         CMetaDataFieldContainer& aContainer )
       
  1285     {
       
  1286 #ifdef _DEBUG
       
  1287      RDebug::Print(_L("CMetaDataParser::GetProtectedL"));
       
  1288 #endif
       
  1289 
       
  1290     TBool fileProtected = aSource->FileProtected();
       
  1291     TBuf16<5> desc16;
       
  1292     desc16.AppendNum(fileProtected);
       
  1293 
       
  1294     aContainer.AppendL( EMetaDataProtected, desc16 );
       
  1295     
       
  1296 #ifdef _DEBUG
       
  1297      RDebug::Print(_L("CMetaDataParser::GetProtectedL, Protected=%S "), &desc16);
       
  1298 #endif
       
  1299     
       
  1300     }
       
  1301 
  1245 //  End of File
  1302 //  End of File