williamr@2: // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@2: // 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 williamr@2: // which accompanies this distribution, and is available williamr@2: // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // williamr@2: williamr@2: #if !defined(__APACMDLN_H__) williamr@2: #define __APACMDLN_H__ williamr@2: williamr@2: #if !defined(__E32BASE_H__) williamr@2: #include williamr@2: #endif williamr@2: williamr@2: #if !defined(__APADEF_H__) williamr@2: #include williamr@2: #endif williamr@2: williamr@2: #if !defined(__F32FILE_H__) williamr@2: #include williamr@2: #endif williamr@2: williamr@2: #if !defined(__S32STRM_H__) williamr@2: #include williamr@2: #endif williamr@2: williamr@2: williamr@2: class CApaCommandLine : public CBase williamr@2: /** Information for launching an application. williamr@2: williamr@2: This is often referred to as a command line and contains: williamr@2: williamr@2: the name of an application EXE to be launched, williamr@2: williamr@2: a document name, williamr@2: williamr@2: a command code that defines the way the application is launched williamr@2: williamr@2: trailing data; the structure of this depends on the application to be launched. williamr@2: williamr@2: The information is held in a buffer implemented by a heap descriptor. williamr@2: williamr@2: @publishedAll williamr@2: @released */ williamr@2: { williamr@2: public: williamr@2: // construction/destruction williamr@2: IMPORT_C static CApaCommandLine* NewL(); williamr@2: IMPORT_C static CApaCommandLine* NewLC(); williamr@2: IMPORT_C ~CApaCommandLine(); williamr@2: williamr@2: // Getting/setting the CApaCommandLine to/from process environment-slots williamr@2: IMPORT_C void SetProcessEnvironmentL(RProcess& aProcess) const; williamr@2: IMPORT_C static TInt GetCommandLineFromProcessEnvironment(CApaCommandLine*& aCommandLine); williamr@2: williamr@2: // Getting/setting the CApaCommandLine to/from a server IPC-message williamr@2: IMPORT_C void GetIpcArgsLC(TIpcArgs& aIpcArgs) const; williamr@2: IMPORT_C void ConstructCmdLineFromMessageL(const RMessage2& aMessage); williamr@2: williamr@2: // operations on the document name williamr@2: IMPORT_C void SetDocumentNameL(const TDesC& aDocName); williamr@2: IMPORT_C TPtrC DocumentName() const; williamr@2: williamr@2: // operations on the executable name williamr@2: IMPORT_C void SetExecutableNameL(const TDesC& aAppName); williamr@2: IMPORT_C TPtrC ExecutableName() const; williamr@2: williamr@2: IMPORT_C void SetOpaqueDataL(const TDesC8& aOpaqueData); williamr@2: IMPORT_C TPtrC8 OpaqueData() const; williamr@2: williamr@2: // operations on the tail end williamr@2: IMPORT_C void SetTailEndL(const TDesC8& aTailEnd); williamr@2: IMPORT_C TPtrC8 TailEnd() const; williamr@2: williamr@2: // operations on the command williamr@2: IMPORT_C void SetCommandL(TApaCommand aCommand); williamr@2: IMPORT_C TApaCommand Command() const; williamr@2: williamr@2: // operations on the parent process id williamr@2: IMPORT_C void SetParentProcessId(TProcessId aProcessId); williamr@2: IMPORT_C TProcessId ParentProcessId() const; williamr@2: williamr@2: // operations on the file passed by handle williamr@2: IMPORT_C void SetFileByHandleL(const RFile& aFile); williamr@2: IMPORT_C void GetFileByHandleL(RFile& aFile) const; williamr@2: public: williamr@2: williamr@2: // operations on the server requirement/differentiator number - 0 means no server, non-zero sets the differentiator for the server name williamr@2: IMPORT_C void SetServerNotRequiredL(); williamr@2: IMPORT_C void SetServerRequiredL(TUint aServerDifferentiator); williamr@2: IMPORT_C TUint ServerRequired() const; williamr@2: williamr@2: // operations to support starting an application with a specific screen number williamr@2: IMPORT_C void SetDefaultScreenL(TInt aDefaultScreenNumber); williamr@2: IMPORT_C TInt DefaultScreen() const; williamr@2: IMPORT_C TBool IsDefaultScreenSet() const; williamr@2: williamr@2: // Operations to support window chaining williamr@2: IMPORT_C void SetParentWindowGroupID(TInt aParentWindowGroupID); williamr@2: IMPORT_C TInt ParentWindowGroupID() const; williamr@2: williamr@2: // operations to support passing memory-allocation failure settings in to applications williamr@2: IMPORT_C void SetDebugMemFailL(TInt aDebugMemFail); williamr@2: IMPORT_C TInt DebugMemFail() const; williamr@2: williamr@2: // operations to support the instrumentation (i.e. profiling) of application startup williamr@2: IMPORT_C void SetAppStartupInstrumentationEventIdBaseL(TInt aEventIdBase); williamr@2: IMPORT_C TInt AppStartupInstrumentationEventIdBase() const; williamr@2: williamr@2: IMPORT_C static TInt EnvironmentSlotForPublicUse(TInt aIndex); williamr@2: williamr@2: private: williamr@2: struct SOption williamr@2: { williamr@2: const TDesC* iToken; williamr@2: TInt* iResult; williamr@2: TRadix iRadix; williamr@2: HBufC8* iHBufC8Result; williamr@2: }; williamr@2: williamr@2: private: williamr@2: CApaCommandLine(); williamr@2: void SetServerDifferentiatorL(TUint aServerDifferentiator); williamr@2: void ExternalizeL(RWriteStream& aStream) const; williamr@2: void InternalizeL(RReadStream& aStream); williamr@2: HBufC8* StreamableAttributesLC() const; williamr@2: void GetCommandLineFromProcessEnvironmentL(); williamr@2: TInt Parse(const TDesC& aCmdLine); williamr@2: TPtrC StripQuotes(const TDesC& aDes) const; williamr@2: williamr@2: private: williamr@2: enum williamr@2: { williamr@2: EEnvironmentSlotUnused=0, williamr@2: williamr@2: EEnvironmentSlotMain=1, williamr@2: EEnvironmentSlotFsSession=2, williamr@2: EEnvironmentSlotFile=3, williamr@2: williamr@2: EFirstEnvironmentSlotForPublicUse=8, williamr@2: ENumberOfEnvironmentSlotsForPublicUse=4 williamr@2: }; williamr@2: williamr@2: enum williamr@2: { williamr@2: EIpcSlotMain=0, williamr@2: EIpcSlotFsSession=1, williamr@2: EIpcSlotFile=2 williamr@2: }; williamr@2: public: williamr@2: enum williamr@2: { williamr@2: EIpcFirstFreeSlot=3 williamr@2: }; williamr@2: private: williamr@2: HBufC* iDocumentName; williamr@2: HBufC* iExecutableName; williamr@2: HBufC8* iOpaqueData; williamr@2: HBufC8* iTailEnd; williamr@2: TApaCommand iCommand; williamr@2: TUint iServerDifferentiator; williamr@2: TInt iDefaultScreenNumber; williamr@2: TInt iParentWindowGroupID; williamr@2: TInt iDebugMemFail; williamr@2: TInt iAppStartupInstrumentationEventIdBase; williamr@2: RFile iFile; williamr@2: TProcessId iParentProcessId; williamr@2: }; williamr@2: williamr@2: #endif