localisation/apparchitecture/inc/APACMDLN.H
branchSymbian3
changeset 57 b8d18c84f71c
parent 6 c108117318cb
--- a/localisation/apparchitecture/inc/APACMDLN.H	Wed Jul 28 16:03:37 2010 +0100
+++ b/localisation/apparchitecture/inc/APACMDLN.H	Tue Aug 03 10:20:34 2010 +0100
@@ -1,7 +1,7 @@
 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
-// under the terms of the License "Eclipse Public License v1.0"
+// under the terms of "Eclipse Public License v1.0"
 // which accompanies this distribution, and is available
 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
 //
@@ -11,160 +11,111 @@
 // Contributors:
 //
 // Description:
+// apacmdln.h
 //
 
-#if !defined(__APACMDLN_H__)
+#ifndef __APACMDLN_H__
 #define __APACMDLN_H__
 
-#if !defined(__E32BASE_H__)
-#include <e32base.h>
-#endif
-
-#if !defined(__APADEF_H__)
-#include <apadef.h>
-#endif
-
-#if !defined(__F32FILE_H__)
+#include <e32base.h>	// class CBase
+#include <apadef.h>		// enum TApaCommand
 #include <f32file.h>
-#endif
-
-#if !defined(__S32STRM_H__)
 #include <s32strm.h>
-#endif
 
 
-class CApaCommandLine : public CBase
 /** Information for launching an application.
 
-This is often referred to as a command line and contains:
-
-the name of an application EXE to be launched,
+To start an application, passed a CApaCommandLine object to the RApaLsSession::StartApp() method.
 
-a document name,
-
+This class is often referred to as a command line and contains:
+the name of an application EXE to be launched, a document name,
 a command code that defines the way the application is launched
-
 trailing data; the structure of this depends on the application to be launched.
 
-The information is held in a buffer implemented by a heap descriptor. 
+To start an application, startup parameters are set on the CApaCommandLine object that is 
+then externalized into a stream and attached to a new RProcess object. These parameters 
+are then used to re-populate a new CApaCommandLine object inside the process by 
+EikStart::RunApplication() and used to bootstrap the launching application.
 
 @publishedAll
 @released */
+class CApaCommandLine : public CBase
 	{
 public:
-	// construction/destruction
+	// Creates an empty command line object
 	IMPORT_C static CApaCommandLine* NewL();
 	IMPORT_C static CApaCommandLine* NewLC();
+	// Specify how the application is to be started (see TApaCommand in apadef.h)
+	IMPORT_C void SetCommandL(TApaCommand aCommand);
+	IMPORT_C TApaCommand Command() const;
+	// Launch the application associated with the mime-type of the document file
+	IMPORT_C void SetDocumentNameL(const TDesC& aDocName);
+	IMPORT_C TPtrC DocumentName() const;
+	IMPORT_C void SetFileByHandleL(const RFile& aFile);
+	IMPORT_C void GetFileByHandleL(RFile& aFile) const;
+	// Launch the application explicitly named
+	IMPORT_C void SetExecutableNameL(const TDesC& aAppName);
+	IMPORT_C TPtrC ExecutableName() const;
+	// Additional application execution arguments (added to the tail if the command line)
+	IMPORT_C void SetTailEndL(const TDesC8& aTailEnd);
+	IMPORT_C TPtrC8 TailEnd() const;
+	// Set the process id of the application being the conceptual parent.
+	// The child process will be closed down automatically when the parent is.
+	IMPORT_C void SetParentProcessId(TProcessId aProcessId);
+	IMPORT_C TProcessId ParentProcessId() const;
+	// Starting the application on a specific screen
+	IMPORT_C void SetDefaultScreenL(TInt aDefaultScreenNumber);
+	IMPORT_C TInt DefaultScreen() const;
+	IMPORT_C TBool IsDefaultScreenSet() const;
+	// Managed order of applications' window groups.
+	// A child applicatoin's windows will always be kept in front of the parent's windows.
+	IMPORT_C void SetParentWindowGroupID(TInt aParentWindowGroupID);
+	IMPORT_C TInt ParentWindowGroupID() const;
+	// Process environment-slot for public use. These can be used for passing parameters 
+	// to the starting application. However, use of the EndTail should be prefered.
+	IMPORT_C static TInt NumberOfEnvironmentSlotsForPublicUse();
+	IMPORT_C static TInt EnvironmentSlotForPublicUse(TInt aIndex);
+public:	// Internal
 	IMPORT_C ~CApaCommandLine();
-
-	// Getting/setting the CApaCommandLine to/from process environment-slots
-	IMPORT_C void SetProcessEnvironmentL(RProcess& aProcess) const;
-	IMPORT_C static TInt GetCommandLineFromProcessEnvironment(CApaCommandLine*& aCommandLine);
-
+	// Set opaque data sent to the application being started
+	IMPORT_C void SetOpaqueDataL(const TDesC8& aOpaqueData);
+	IMPORT_C TPtrC8 OpaqueData() const;
 	// Getting/setting the CApaCommandLine to/from a server IPC-message
 	IMPORT_C void GetIpcArgsLC(TIpcArgs& aIpcArgs) const;
 	IMPORT_C void ConstructCmdLineFromMessageL(const RMessage2& aMessage);
-
-	// operations on the document name
-	IMPORT_C void SetDocumentNameL(const TDesC& aDocName);
-	IMPORT_C TPtrC DocumentName() const;
-
-	// operations on the executable name
-	IMPORT_C void SetExecutableNameL(const TDesC& aAppName);
-	IMPORT_C TPtrC ExecutableName() const;
-	
-	IMPORT_C void SetOpaqueDataL(const TDesC8& aOpaqueData);
-	IMPORT_C TPtrC8 OpaqueData() const;
-
-	// operations on the tail end
-	IMPORT_C void SetTailEndL(const TDesC8& aTailEnd);
-	IMPORT_C TPtrC8 TailEnd() const;
-
-	// operations on the command
-	IMPORT_C void SetCommandL(TApaCommand aCommand);
-	IMPORT_C TApaCommand Command() const;
-
-	// operations on the parent process id
-	IMPORT_C void SetParentProcessId(TProcessId aProcessId);
-	IMPORT_C TProcessId ParentProcessId() const;
-
-	// operations on the file passed by handle
-	IMPORT_C void SetFileByHandleL(const RFile& aFile);
-	IMPORT_C void GetFileByHandleL(RFile& aFile) const;
-public:
-
+	// Getting/setting the CApaCommandLine to/from process environment-slots
+	IMPORT_C void SetProcessEnvironmentL(RProcess& aProcess) const;
+	IMPORT_C static TInt GetCommandLineFromProcessEnvironment(CApaCommandLine*& aCommandLine);
+	// operations to support passing memory-allocation failure settings in to applications
+	IMPORT_C void SetDebugMemFailL(TInt aDebugMemFail);
+	IMPORT_C TInt DebugMemFail() const;
+	// operations to support the instrumentation (i.e. profiling) of application startup
+	IMPORT_C void SetAppStartupInstrumentationEventIdBaseL(TInt aEventIdBase);
+	IMPORT_C TInt AppStartupInstrumentationEventIdBase() const;
 	// operations on the server requirement/differentiator number - 0 means no server, non-zero sets the differentiator for the server name
 	IMPORT_C void SetServerNotRequiredL();
 	IMPORT_C void SetServerRequiredL(TUint aServerDifferentiator);
 	IMPORT_C TUint ServerRequired() const;
-
-	// operations to support starting an application with a specific screen number
-	IMPORT_C void SetDefaultScreenL(TInt aDefaultScreenNumber);
-	IMPORT_C TInt DefaultScreen() const;
-	IMPORT_C TBool IsDefaultScreenSet() const;
-
-	// Operations to support window chaining
-	IMPORT_C void SetParentWindowGroupID(TInt aParentWindowGroupID);
-	IMPORT_C TInt ParentWindowGroupID() const;
-
-	// operations to support passing memory-allocation failure settings in to applications
-	IMPORT_C void SetDebugMemFailL(TInt aDebugMemFail);
-	IMPORT_C TInt DebugMemFail() const;
-
-	// operations to support the instrumentation (i.e. profiling) of application startup
-	IMPORT_C void SetAppStartupInstrumentationEventIdBaseL(TInt aEventIdBase);
-	IMPORT_C TInt AppStartupInstrumentationEventIdBase() const;
-
-	IMPORT_C static TInt EnvironmentSlotForPublicUse(TInt aIndex);
-
-private:
-	struct SOption
-		{
-		const TDesC* iToken;
-		TInt* iResult;
-		TRadix iRadix;
-		HBufC8* iHBufC8Result;
-		};
-
 private:
 	CApaCommandLine();
-	void SetServerDifferentiatorL(TUint aServerDifferentiator);
 	void ExternalizeL(RWriteStream& aStream) const;
 	void InternalizeL(RReadStream& aStream);
 	HBufC8* StreamableAttributesLC() const;
-	void GetCommandLineFromProcessEnvironmentL();
-	TInt Parse(const TDesC& aCmdLine);
-	TPtrC StripQuotes(const TDesC& aDes) const;
-
-private:
-	enum
-		{
-		EEnvironmentSlotUnused=0,
-
-		EEnvironmentSlotMain=1,
-		EEnvironmentSlotFsSession=2,
-		EEnvironmentSlotFile=3,
-
-		EFirstEnvironmentSlotForPublicUse=8,
-		ENumberOfEnvironmentSlotsForPublicUse=4
-		};
-
-	enum
-		{
-		EIpcSlotMain=0,
-		EIpcSlotFsSession=1,
-		EIpcSlotFile=2
-		};
+	void DoGetCommandLineFromProcessEnvironmentL();
+	TInt DoGetParametersFromCommandLineString(const TDesC& aCmdLine);
+	static HBufC* NameOfExecutable(const TDesC& aCmdLine, TInt& aEndDocNameOffset);
+	static TPtrC StripQuotes(const TDesC& aDes);
+	void SetServerDifferentiatorL(TUint aServerDifferentiator);
 public:
-	enum
+	enum	// for internal use only
 		{
 		EIpcFirstFreeSlot=3
 		};
 private:
-	HBufC* iDocumentName;
-	HBufC* iExecutableName;
-	HBufC8* iOpaqueData;
-	HBufC8* iTailEnd;
+	RBuf iDocumentName;
+	RBuf iExecutableName;
+	RBuf8 iOpaqueData;
+	RBuf8 iTailEnd;
 	TApaCommand iCommand;
 	TUint iServerDifferentiator;
 	TInt iDefaultScreenNumber;
@@ -175,4 +126,4 @@
 	TProcessId iParentProcessId;
 	};
 
-#endif
+#endif // __APACMDLN_H__