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