sl@0: // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #include "parsers.h" sl@0: sl@0: // sl@0: // This file format is treated differently from all the others in that if the sl@0: // file extension is not recognised then the file is not recognised. sl@0: // Only once the extension is recognised does it try to match any header data. sl@0: // sl@0: void TRAMParser::DoRecognise(const TDesC& aFileExt, CReader& aReader, TMatch& aMatch) sl@0: { sl@0: TBool extMatch = (aFileExt.MatchF(TPtrC(KExtRAM)) != KErrNotFound); sl@0: if (extMatch) sl@0: { sl@0: aMatch.iMime = KMimeRAM; sl@0: TPtrC8 header = MAKE_TPtrC8(KSigRAM); sl@0: sl@0: if (aReader.Match(header)) sl@0: { sl@0: aMatch.iConfidence = KConfProbable; sl@0: } sl@0: else sl@0: { sl@0: aMatch.iConfidence = KConfPossible; sl@0: } sl@0: } sl@0: } sl@0: sl@0: sl@0: // sl@0: // SDP and XPS have almost identical header signatures, so when it comes to sl@0: // recognise an SDP file with a bad extension, it can be incorrectly identified sl@0: // as an XPS file. sl@0: // sl@0: void TSDPParser::DoRecognise(const TDesC& aFileExt, CReader& aReader, TMatch& aMatch) sl@0: { sl@0: TBool extMatch = (aFileExt.MatchF(TPtrC(KExtSDP)) != KErrNotFound); sl@0: if (extMatch) sl@0: { sl@0: aMatch.iMime = KMimeSDP; sl@0: TPtrC8 header = MAKE_TPtrC8(KSigSDP); sl@0: sl@0: if (aReader.Match(header)) sl@0: { sl@0: aMatch.iConfidence = KConfProbable; sl@0: } sl@0: else sl@0: { sl@0: aMatch.iConfidence = KConfPossible; sl@0: } sl@0: } sl@0: } sl@0: sl@0: sl@0: // sl@0: // See TSDPParser::DoRecognise comment. sl@0: // sl@0: void TXPSParser::DoRecognise(const TDesC& aFileExt, CReader& aReader, TMatch& aMatch) sl@0: { sl@0: TBool extMatch = (aFileExt.MatchF(TPtrC(KExtXPS)) != KErrNotFound); sl@0: if (extMatch) sl@0: { sl@0: aMatch.iMime = KMimeXPS; sl@0: TPtrC8 header = MAKE_TPtrC8(KSigXPS); sl@0: sl@0: if (aReader.Match(header)) sl@0: { sl@0: aMatch.iConfidence = KConfProbable; sl@0: } sl@0: else sl@0: { sl@0: aMatch.iConfidence = KConfPossible; sl@0: } sl@0: } sl@0: } sl@0: