localisation/apparchitecture/inc/APACMDLN.H
branchSymbian2
changeset 1 8758140453c0
child 6 c108117318cb
equal deleted inserted replaced
0:e8c1ea2c6496 1:8758140453c0
       
     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 the License "Symbian Foundation License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #if !defined(__APACMDLN_H__)
       
    17 #define __APACMDLN_H__
       
    18 
       
    19 #if !defined(__E32BASE_H__)
       
    20 #include <e32base.h>
       
    21 #endif
       
    22 
       
    23 #if !defined(__APADEF_H__)
       
    24 #include <apadef.h>
       
    25 #endif
       
    26 
       
    27 #if !defined(__F32FILE_H__)
       
    28 #include <f32file.h>
       
    29 #endif
       
    30 
       
    31 #if !defined(__S32STRM_H__)
       
    32 #include <s32strm.h>
       
    33 #endif
       
    34 
       
    35 
       
    36 class CApaCommandLine : public CBase
       
    37 /** Information for launching an application.
       
    38 
       
    39 This is often referred to as a command line and contains:
       
    40 
       
    41 the name of an application EXE to be launched,
       
    42 
       
    43 a document name,
       
    44 
       
    45 a command code that defines the way the application is launched
       
    46 
       
    47 trailing data; the structure of this depends on the application to be launched.
       
    48 
       
    49 The information is held in a buffer implemented by a heap descriptor. 
       
    50 
       
    51 @publishedAll
       
    52 @released */
       
    53 	{
       
    54 public:
       
    55 	// construction/destruction
       
    56 	IMPORT_C static CApaCommandLine* NewL();
       
    57 	IMPORT_C static CApaCommandLine* NewLC();
       
    58 	IMPORT_C ~CApaCommandLine();
       
    59 
       
    60 	// Getting/setting the CApaCommandLine to/from process environment-slots
       
    61 	IMPORT_C void SetProcessEnvironmentL(RProcess& aProcess) const;
       
    62 	IMPORT_C static TInt GetCommandLineFromProcessEnvironment(CApaCommandLine*& aCommandLine);
       
    63 
       
    64 	// Getting/setting the CApaCommandLine to/from a server IPC-message
       
    65 	IMPORT_C void GetIpcArgsLC(TIpcArgs& aIpcArgs) const;
       
    66 	IMPORT_C void ConstructCmdLineFromMessageL(const RMessage2& aMessage);
       
    67 
       
    68 	// operations on the document name
       
    69 	IMPORT_C void SetDocumentNameL(const TDesC& aDocName);
       
    70 	IMPORT_C TPtrC DocumentName() const;
       
    71 
       
    72 	// operations on the executable name
       
    73 	IMPORT_C void SetExecutableNameL(const TDesC& aAppName);
       
    74 	IMPORT_C TPtrC ExecutableName() const;
       
    75 	
       
    76 	IMPORT_C void SetOpaqueDataL(const TDesC8& aOpaqueData);
       
    77 	IMPORT_C TPtrC8 OpaqueData() const;
       
    78 
       
    79 	// operations on the tail end
       
    80 	IMPORT_C void SetTailEndL(const TDesC8& aTailEnd);
       
    81 	IMPORT_C TPtrC8 TailEnd() const;
       
    82 
       
    83 	// operations on the command
       
    84 	IMPORT_C void SetCommandL(TApaCommand aCommand);
       
    85 	IMPORT_C TApaCommand Command() const;
       
    86 
       
    87 	// operations on the parent process id
       
    88 	IMPORT_C void SetParentProcessId(TProcessId aProcessId);
       
    89 	IMPORT_C TProcessId ParentProcessId() const;
       
    90 
       
    91 	// operations on the file passed by handle
       
    92 	IMPORT_C void SetFileByHandleL(const RFile& aFile);
       
    93 	IMPORT_C void GetFileByHandleL(RFile& aFile) const;
       
    94 public:
       
    95 
       
    96 	// operations on the server requirement/differentiator number - 0 means no server, non-zero sets the differentiator for the server name
       
    97 	IMPORT_C void SetServerNotRequiredL();
       
    98 	IMPORT_C void SetServerRequiredL(TUint aServerDifferentiator);
       
    99 	IMPORT_C TUint ServerRequired() const;
       
   100 
       
   101 	// operations to support starting an application with a specific screen number
       
   102 	IMPORT_C void SetDefaultScreenL(TInt aDefaultScreenNumber);
       
   103 	IMPORT_C TInt DefaultScreen() const;
       
   104 	IMPORT_C TBool IsDefaultScreenSet() const;
       
   105 
       
   106 	// Operations to support window chaining
       
   107 	IMPORT_C void SetParentWindowGroupID(TInt aParentWindowGroupID);
       
   108 	IMPORT_C TInt ParentWindowGroupID() const;
       
   109 
       
   110 	// operations to support passing memory-allocation failure settings in to applications
       
   111 	IMPORT_C void SetDebugMemFailL(TInt aDebugMemFail);
       
   112 	IMPORT_C TInt DebugMemFail() const;
       
   113 
       
   114 	// operations to support the instrumentation (i.e. profiling) of application startup
       
   115 	IMPORT_C void SetAppStartupInstrumentationEventIdBaseL(TInt aEventIdBase);
       
   116 	IMPORT_C TInt AppStartupInstrumentationEventIdBase() const;
       
   117 
       
   118 	IMPORT_C static TInt EnvironmentSlotForPublicUse(TInt aIndex);
       
   119 
       
   120 private:
       
   121 	struct SOption
       
   122 		{
       
   123 		const TDesC* iToken;
       
   124 		TInt* iResult;
       
   125 		TRadix iRadix;
       
   126 		HBufC8* iHBufC8Result;
       
   127 		};
       
   128 
       
   129 private:
       
   130 	CApaCommandLine();
       
   131 	void SetServerDifferentiatorL(TUint aServerDifferentiator);
       
   132 	void ExternalizeL(RWriteStream& aStream) const;
       
   133 	void InternalizeL(RReadStream& aStream);
       
   134 	HBufC8* StreamableAttributesLC() const;
       
   135 	void GetCommandLineFromProcessEnvironmentL();
       
   136 	TInt Parse(const TDesC& aCmdLine);
       
   137 	TPtrC StripQuotes(const TDesC& aDes) const;
       
   138 
       
   139 private:
       
   140 	enum
       
   141 		{
       
   142 		EEnvironmentSlotUnused=0,
       
   143 
       
   144 		EEnvironmentSlotMain=1,
       
   145 		EEnvironmentSlotFsSession=2,
       
   146 		EEnvironmentSlotFile=3,
       
   147 
       
   148 		EFirstEnvironmentSlotForPublicUse=8,
       
   149 		ENumberOfEnvironmentSlotsForPublicUse=4
       
   150 		};
       
   151 
       
   152 	enum
       
   153 		{
       
   154 		EIpcSlotMain=0,
       
   155 		EIpcSlotFsSession=1,
       
   156 		EIpcSlotFile=2
       
   157 		};
       
   158 public:
       
   159 	enum
       
   160 		{
       
   161 		EIpcFirstFreeSlot=3
       
   162 		};
       
   163 private:
       
   164 	HBufC* iDocumentName;
       
   165 	HBufC* iExecutableName;
       
   166 	HBufC8* iOpaqueData;
       
   167 	HBufC8* iTailEnd;
       
   168 	TApaCommand iCommand;
       
   169 	TUint iServerDifferentiator;
       
   170 	TInt iDefaultScreenNumber;
       
   171 	TInt iParentWindowGroupID;
       
   172 	TInt iDebugMemFail;
       
   173 	TInt iAppStartupInstrumentationEventIdBase;
       
   174 	RFile iFile;
       
   175 	TProcessId iParentProcessId;
       
   176 	};
       
   177 
       
   178 #endif