diff options
author | 2008-09-29 17:17:50 +0000 | |
---|---|---|
committer | 2008-09-29 17:17:50 +0000 | |
commit | 850e275390052b330d93020bf619a739a3c277ac (patch) | |
tree | db372d287586cf504a5ead4801f6c6cf7eb31449 /gnu/usr.bin/perl/symbian/PerlRecog.cpp | |
parent | more updates on which args do and do not mix (doc only, this time): (diff) | |
download | wireguard-openbsd-850e275390052b330d93020bf619a739a3c277ac.tar.xz wireguard-openbsd-850e275390052b330d93020bf619a739a3c277ac.zip |
import perl 5.10.0 from CPAN
Diffstat (limited to 'gnu/usr.bin/perl/symbian/PerlRecog.cpp')
-rw-r--r-- | gnu/usr.bin/perl/symbian/PerlRecog.cpp | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/gnu/usr.bin/perl/symbian/PerlRecog.cpp b/gnu/usr.bin/perl/symbian/PerlRecog.cpp new file mode 100644 index 00000000000..d2db54491b6 --- /dev/null +++ b/gnu/usr.bin/perl/symbian/PerlRecog.cpp @@ -0,0 +1,57 @@ +/* Copyright (c) 2004-2005 Nokia. All rights reserved. */ + +/* The PerlRecog application is licensed under the same terms as Perl itself. */ + +#include <apmrec.h> +#include <apmstd.h> +#include <f32file.h> + +const TUid KUidPerlRecog = { 0x102015F7 }; +_LIT8(KPerlMimeType, "x-application/x-perl"); +_LIT8(KPerlSig, "#!/usr/bin/perl"); +const TInt KPerlSigLen = 15; + +class CApaPerlRecognizer : public CApaDataRecognizerType { + public: + CApaPerlRecognizer():CApaDataRecognizerType(KUidPerlRecog, EHigh) { + iCountDataTypes = 1; + } + virtual TUint PreferredBufSize() { return KPerlSigLen; } + virtual TDataType SupportedDataTypeL(TInt /* aIndex */) const { + return TDataType(KPerlMimeType); + } + private: + virtual void DoRecognizeL(const TDesC& aName, const TDesC8& aBuffer); +}; + +void CApaPerlRecognizer::DoRecognizeL(const TDesC& aName, const TDesC8& aBuffer) +{ + iConfidence = ENotRecognized; + + if (aBuffer.Length() >= KPerlSigLen && + aBuffer.Left(KPerlSigLen).Compare(KPerlSig) == 0) { + iConfidence = ECertain; + iDataType = TDataType(KPerlMimeType); + } else { + TParsePtrC p(aName); + + if ((p.Ext().CompareF(_L(".pl")) == 0) || + (p.Ext().CompareF(_L(".pm")) == 0)) { + iConfidence = ECertain; + iDataType = TDataType(KPerlMimeType); + } + } +} + +EXPORT_C CApaDataRecognizerType* CreateRecognizer() +{ + return new CApaPerlRecognizer; +} + +GLDEF_C TInt E32Dll(TDllReason /* aReason */) +{ + return KErrNone; +} + + + |