epoc32/include/mw/apacmdln.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // apacmdln.h
    15 //
    16 
    17 #ifndef __APACMDLN_H__
    18 #define __APACMDLN_H__
    19 
    20 #include <e32base.h>	// class CBase
    21 #include <apadef.h>		// enum TApaCommand
    22 #include <f32file.h>
    23 #include <s32strm.h>
    24 
    25 
    26 /** Information for launching an application.
    27 
    28 To start an application, passed a CApaCommandLine object to the RApaLsSession::StartApp() method.
    29 
    30 This class is often referred to as a command line and contains:
    31 the name of an application EXE to be launched, a document name,
    32 a command code that defines the way the application is launched
    33 trailing data; the structure of this depends on the application to be launched.
    34 
    35 To start an application, startup parameters are set on the CApaCommandLine object that is 
    36 then externalized into a stream and attached to a new RProcess object. These parameters 
    37 are then used to re-populate a new CApaCommandLine object inside the process by 
    38 EikStart::RunApplication() and used to bootstrap the launching application.
    39 
    40 @publishedAll
    41 @released */
    42 class CApaCommandLine : public CBase
    43 	{
    44 public:
    45 	// Creates an empty command line object
    46 	IMPORT_C static CApaCommandLine* NewL();
    47 	IMPORT_C static CApaCommandLine* NewLC();
    48 	// Specify how the application is to be started (see TApaCommand in apadef.h)
    49 	IMPORT_C void SetCommandL(TApaCommand aCommand);
    50 	IMPORT_C TApaCommand Command() const;
    51 	// Launch the application associated with the mime-type of the document file
    52 	IMPORT_C void SetDocumentNameL(const TDesC& aDocName);
    53 	IMPORT_C TPtrC DocumentName() const;
    54 	IMPORT_C void SetFileByHandleL(const RFile& aFile);
    55 	IMPORT_C void GetFileByHandleL(RFile& aFile) const;
    56 	// Launch the application explicitly named
    57 	IMPORT_C void SetExecutableNameL(const TDesC& aAppName);
    58 	IMPORT_C TPtrC ExecutableName() const;
    59 	// Additional application execution arguments (added to the tail if the command line)
    60 	IMPORT_C void SetTailEndL(const TDesC8& aTailEnd);
    61 	IMPORT_C TPtrC8 TailEnd() const;
    62 	// Set the process id of the application being the conceptual parent.
    63 	// The child process will be closed down automatically when the parent is.
    64 	IMPORT_C void SetParentProcessId(TProcessId aProcessId);
    65 	IMPORT_C TProcessId ParentProcessId() const;
    66 	// Starting the application on a specific screen
    67 	IMPORT_C void SetDefaultScreenL(TInt aDefaultScreenNumber);
    68 	IMPORT_C TInt DefaultScreen() const;
    69 	IMPORT_C TBool IsDefaultScreenSet() const;
    70 	// Managed order of applications' window groups.
    71 	// A child applicatoin's windows will always be kept in front of the parent's windows.
    72 	IMPORT_C void SetParentWindowGroupID(TInt aParentWindowGroupID);
    73 	IMPORT_C TInt ParentWindowGroupID() const;
    74 	// Process environment-slot for public use. These can be used for passing parameters 
    75 	// to the starting application. However, use of the EndTail should be prefered.
    76 	IMPORT_C static TInt NumberOfEnvironmentSlotsForPublicUse();
    77 	IMPORT_C static TInt EnvironmentSlotForPublicUse(TInt aIndex);
    78 public:	// Internal
    79 	IMPORT_C ~CApaCommandLine();
    80 	// Set opaque data sent to the application being started
    81 	IMPORT_C void SetOpaqueDataL(const TDesC8& aOpaqueData);
    82 	IMPORT_C TPtrC8 OpaqueData() const;
    83 	// Getting/setting the CApaCommandLine to/from a server IPC-message
    84 	IMPORT_C void GetIpcArgsLC(TIpcArgs& aIpcArgs) const;
    85 	IMPORT_C void ConstructCmdLineFromMessageL(const RMessage2& aMessage);
    86 	// Getting/setting the CApaCommandLine to/from process environment-slots
    87 	IMPORT_C void SetProcessEnvironmentL(RProcess& aProcess) const;
    88 	IMPORT_C static TInt GetCommandLineFromProcessEnvironment(CApaCommandLine*& aCommandLine);
    89 	// operations to support passing memory-allocation failure settings in to applications
    90 	IMPORT_C void SetDebugMemFailL(TInt aDebugMemFail);
    91 	IMPORT_C TInt DebugMemFail() const;
    92 	// operations to support the instrumentation (i.e. profiling) of application startup
    93 	IMPORT_C void SetAppStartupInstrumentationEventIdBaseL(TInt aEventIdBase);
    94 	IMPORT_C TInt AppStartupInstrumentationEventIdBase() const;
    95 	// operations on the server requirement/differentiator number - 0 means no server, non-zero sets the differentiator for the server name
    96 	IMPORT_C void SetServerNotRequiredL();
    97 	IMPORT_C void SetServerRequiredL(TUint aServerDifferentiator);
    98 	IMPORT_C TUint ServerRequired() const;
    99 private:
   100 	CApaCommandLine();
   101 	void ExternalizeL(RWriteStream& aStream) const;
   102 	void InternalizeL(RReadStream& aStream);
   103 	HBufC8* StreamableAttributesLC() const;
   104 	void DoGetCommandLineFromProcessEnvironmentL();
   105 	TInt DoGetParametersFromCommandLineString(const TDesC& aCmdLine);
   106 	static HBufC* NameOfExecutable(const TDesC& aCmdLine, TInt& aEndDocNameOffset);
   107 	static TPtrC StripQuotes(const TDesC& aDes);
   108 	void SetServerDifferentiatorL(TUint aServerDifferentiator);
   109 public:
   110 	enum	// for internal use only
   111 		{
   112 		EIpcFirstFreeSlot=3
   113 		};
   114 private:
   115 	RBuf iDocumentName;
   116 	RBuf iExecutableName;
   117 	RBuf8 iOpaqueData;
   118 	RBuf8 iTailEnd;
   119 	TApaCommand iCommand;
   120 	TUint iServerDifferentiator;
   121 	TInt iDefaultScreenNumber;
   122 	TInt iParentWindowGroupID;
   123 	TInt iDebugMemFail;
   124 	TInt iAppStartupInstrumentationEventIdBase;
   125 	RFile iFile;
   126 	TProcessId iParentProcessId;
   127 	};
   128 
   129 #endif // __APACMDLN_H__