epoc32/include/mw/apaflrec.h
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 2fe1408b6811
child 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/mw/apaflrec.h	Wed Mar 31 12:27:01 2010 +0100
     1.3 @@ -0,0 +1,208 @@
     1.4 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#if !defined(__APAFLREC_H__)
    1.20 +#define __APAFLREC_H__
    1.21 +
    1.22 +#if !defined(__APADEF_H__)
    1.23 +#include <apadef.h>
    1.24 +#endif
    1.25 +#if !defined(__APAID_H__)
    1.26 +#include <apaid.h>
    1.27 +#endif
    1.28 +
    1.29 +// classes defined:
    1.30 +class MApaAppStarter;
    1.31 +class CApaAppLocator;
    1.32 +class CApaFileRecognizer;
    1.33 +class CApaFileRecognizerType;
    1.34 +class CFileRecognizerExtension;
    1.35 +//
    1.36 +// classes referenced:
    1.37 +class TApaAppEntry;
    1.38 +class CApaCommandLine;
    1.39 +class RFs;
    1.40 +//
    1.41 +
    1.42 +// KUidFileRecognizer is UID[1] for app recognizer dll's (UID[2] identifies a particular identifier)
    1.43 +/**
    1.44 +@publishedAll
    1.45 +@released
    1.46 +*/
    1.47 +#ifdef _UNICODE
    1.48 +#define KUidFileRecognizer KUidFileRecognizer16
    1.49 +#else
    1.50 +#define KUidFileRecognizer KUidFileRecognizer8
    1.51 +#endif
    1.52 +
    1.53 +/**
    1.54 +@publishedAll 
    1.55 +@deprecated
    1.56 +*/
    1.57 +const TInt KFileRecognizerUidValue8=0x1000013E;
    1.58 +
    1.59 +/**
    1.60 +@publishedAll 
    1.61 +@deprecated
    1.62 +*/
    1.63 +const TUid KUidFileRecognizer8={KFileRecognizerUidValue8};
    1.64 +
    1.65 +/**
    1.66 +@publishedAll
    1.67 +@released
    1.68 +*/
    1.69 +const TUid KUidFileRecognizer16={0x10003A37};
    1.70 +//
    1.71 +
    1.72 +
    1.73 +class CApaAppLocator : public CBase
    1.74 +/**
    1.75 +@internalComponent
    1.76 +*/
    1.77 +	{
    1.78 +public:
    1.79 +	virtual TInt GetAppEntryByUid(TApaAppEntry& aAppEntry,TUid aAppUid)=0;
    1.80 +	virtual TInt GetAppCapabilityByUid(TDes8& aCapabilityBuf,TUid aAppUid)=0;
    1.81 +	};
    1.82 +
    1.83 +
    1.84 +
    1.85 +class CApaFileRecognizer : public CBase
    1.86 +/**
    1.87 +@internalComponent
    1.88 +@deprecated
    1.89 +*/
    1.90 +	{
    1.91 +public:
    1.92 +	//
    1.93 +	IMPORT_C CApaFileRecognizerType* RecognizeFileL(const TDesC& aFullFileName,const TUidType* aUidType=NULL);
    1.94 +	IMPORT_C CApaAppLocator* AppLocator() const;
    1.95 +	//
    1.96 +	IMPORT_C ~CApaFileRecognizer();
    1.97 +protected:
    1.98 +	IMPORT_C CApaFileRecognizer(RFs& aFs);
    1.99 +	IMPORT_C void AddFileRecognizerType(CApaFileRecognizerType* aFileRecognizerType);
   1.100 +	IMPORT_C TInt RemoveFileRecognizerType(const CApaFileRecognizerType* aFileRecognizerType);
   1.101 +	IMPORT_C void SetAppLocator(CApaAppLocator* aAppLocator); // should be called by child-classes eg during construction
   1.102 +	static inline void SetAppStarter(CApaFileRecognizerType* aRecognizer,MApaAppStarter* aAppStarter);
   1.103 +	IMPORT_C void DestroyRecognizerList();
   1.104 +protected:
   1.105 +	RFs& iFs;
   1.106 +	CApaAppLocator* iAppLocator;
   1.107 +private:
   1.108 +	CApaFileRecognizerType *iFileRecognizerList;
   1.109 +	};
   1.110 +
   1.111 +
   1.112 +
   1.113 +class MApaAppStarter
   1.114 +/** An interface used by the Application Architecture server to start applications.
   1.115 +
   1.116 +CEikonEnv is derived from this class.
   1.117 +
   1.118 +@publishedPartner
   1.119 +@released
   1.120 +@see CEikonEnv */
   1.121 +	{
   1.122 +public:
   1.123 +	virtual TThreadId StartAppL(const CApaCommandLine& aCommandLine)=0;
   1.124 +protected:
   1.125 +	IMPORT_C MApaAppStarter(); 
   1.126 +private:
   1.127 +	IMPORT_C virtual void MApaAppStarter_Reserved1();
   1.128 +	IMPORT_C virtual void MApaAppStarter_Reserved2();
   1.129 +private:
   1.130 +	TInt iMApaAppStarter_Reserved1;
   1.131 +	};
   1.132 +
   1.133 +
   1.134 +
   1.135 +class CApaFileRecognizerType : public CBase
   1.136 +/**
   1.137 +@publishedPartner
   1.138 +@deprecated
   1.139 +*/
   1.140 +	{
   1.141 +public:
   1.142 +	enum TRecognizedType {EProgram,EDoc,EOtherFile,ENotRecognized};
   1.143 +public:
   1.144 +	virtual TThreadId RunL(TApaCommand aCommand,const TDesC* aDocFileName,const TDesC8* aTailEnd) const=0;
   1.145 +	inline TThreadId RunL(TApaCommand aCommand, const TDesC* aDocFileName) const;
   1.146 +	inline TThreadId RunL(TApaCommand aCommand) const;
   1.147 +	inline TUid AppUid()const;
   1.148 +	inline TUid TypeUid()const;
   1.149 +	inline TRecognizedType Type()const;
   1.150 +	IMPORT_C void Capability(TDes8& aCapabilityBuf)const;
   1.151 +	IMPORT_C void Lock();
   1.152 +	IMPORT_C void Unlock();
   1.153 +protected:
   1.154 +	IMPORT_C CApaFileRecognizerType();
   1.155 +	IMPORT_C ~CApaFileRecognizerType();
   1.156 +	IMPORT_C TThreadId AppRunL(const CApaCommandLine& aCommandLine) const;
   1.157 +private:
   1.158 +	inline void SetAppStarter(MApaAppStarter* aAppStarter); // must be called before AppRunL()
   1.159 +	virtual TRecognizedType DoRecognizeFileL(RFs& aFs,TUidType aUidType)=0;
   1.160 +	TRecognizedType RecognizeFileL(RFs& aFs,const TDesC& aFullFileName,TUidType aUidType);
   1.161 +	TBool Locked()const;
   1.162 +	IMPORT_C virtual void Reserved_1();
   1.163 +public:
   1.164 +	IMPORT_C static CApaFileRecognizerType* CreateFileRecognizerL(TUid aImplUid);
   1.165 +protected:
   1.166 +	CApaFileRecognizer* iFileRecognizer;
   1.167 +	MApaAppStarter* iAppStarter;
   1.168 +	HBufC* iFullFileName;
   1.169 +	TUid iFileType; // type UID of the recognizer file (ie UID[1])
   1.170 +	TUid iAppUid; // UID of the associated app (ie UID[2])
   1.171 +	TRecognizedType iRecognizedType;
   1.172 +	TApaAppCapabilityBuf* iCapabilityBuf;
   1.173 +private:
   1.174 +	CApaFileRecognizerType* iNext;
   1.175 +	TInt iLock;
   1.176 +	CFileRecognizerExtension* iFileRecognizerExtn;
   1.177 +private:
   1.178 +	friend class CApaFileRecognizer;
   1.179 +	};
   1.180 +
   1.181 +
   1.182 +//
   1.183 +// inlines
   1.184 +//
   1.185 +
   1.186 +inline void CApaFileRecognizer::SetAppStarter(CApaFileRecognizerType* aRecognizer,MApaAppStarter* aAppStarter)
   1.187 +	{ aRecognizer->SetAppStarter(aAppStarter); }
   1.188 +
   1.189 +inline void CApaFileRecognizerType::SetAppStarter(MApaAppStarter* aAppStarter)
   1.190 +	{ iAppStarter = aAppStarter; }
   1.191 +
   1.192 +inline TUid CApaFileRecognizerType::AppUid() const
   1.193 +	{ return iAppUid; }
   1.194 +
   1.195 +inline TUid CApaFileRecognizerType::TypeUid() const
   1.196 +	{ return iFileType; }
   1.197 +
   1.198 +inline CApaFileRecognizerType::TRecognizedType CApaFileRecognizerType::Type()const
   1.199 +	{ return iRecognizedType; }
   1.200 +
   1.201 +inline TThreadId CApaFileRecognizerType::RunL(TApaCommand aCommand, const TDesC* aDocFileName) const
   1.202 +	/** Calls RunL(TApaCommand,const TDesC*,const TDesC8*) with NULL as third parameter.
   1.203 +	@see CApaFileRecognizerType::RunL(TApaCommand,const TDesC*,const TDesC8*) */
   1.204 +	{ return RunL(aCommand, aDocFileName, NULL); }
   1.205 +
   1.206 +inline TThreadId CApaFileRecognizerType::RunL(TApaCommand aCommand) const
   1.207 +	/** Calls RunL(TApaCommand,const TDesC*,const TDesC8*) with NULL as second and third parameter.
   1.208 +	@see CApaFileRecognizerType::RunL(TApaCommand,const TDesC*,const TDesC8*) */
   1.209 +	{ return RunL(aCommand, NULL, NULL); }	
   1.210 +
   1.211 +#endif