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