00001 00011 #include "recsid.h" 00012 00013 #ifdef _UNICODE 00014 const TUid KUidRecSid = {0x10009a99}; 00015 #else 00016 const TUid KUidRecSid = {0x10009a98}; 00017 #endif 00018 00019 const TInt KMinBufferLength = 5; // minimum amount of file needed to determine a SID file IF it's not called .sid 00020 const TInt KMaxBufferLength = 1000; // maximum amount of buffer space we will ever use 00021 00022 _LIT8(KRecSidSignature, "PSID"); 00023 _LIT8(KDataTypeSid, "application/sid"); //TODO it this correct ? 00024 00025 00026 // 00027 // implementation of CRecSid 00028 // 00029 00030 00031 CRecSid::CRecSid() 00035 :CApaDataRecognizerType(KUidRecSid, CApaDataRecognizerType::ELow) 00036 { 00037 iCountDataTypes = 1; 00038 } 00039 00040 00041 TUint CRecSid::PreferredBufSize() 00045 { 00046 return KMaxBufferLength; 00047 } 00048 00049 00050 TDataType CRecSid::SupportedDataTypeL(TInt aIndex) const 00054 { 00055 __ASSERT_DEBUG(aIndex==0, User::Invariant()); 00056 return TDataType(KDataTypeSid); 00057 } 00058 00059 00060 void CRecSid::DoRecognizeL(const TDesC& /* aName */, const TDesC8& aBuffer) 00065 { 00066 // check if file bigger than 5 bytes 00067 if (aBuffer.Length() < KMinBufferLength) 00068 return; 00069 00070 // search for 'PSID' 00071 if (aBuffer.FindF(KRecSidSignature) >= 0) 00072 { 00073 // Yes it was found 00074 iConfidence = ECertain; 00075 iDataType = TDataType(KDataTypeSid); 00076 } 00077 } 00078 00079 00080 EXPORT_C CApaDataRecognizerType* CreateRecognizer() 00090 { 00091 return new CRecSid(); 00092 } 00093 00094 00095 GLDEF_C TInt E32Dll(TDllReason /*aReason*/) 00099 { 00100 return KErrNone; 00101 } 00102 00103 // EOF - recsid.cpp