InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
CCommandLineArgs.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Michael Burbidge
6 //
7 // $Author$
8 //
9 // $DateTime$
10 //
11 // $Revision$
12 //
13 // $Change$
14 //
15 // Copyright 1997-2010 Adobe Systems Incorporated. All rights reserved.
16 //
17 // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
18 // with the terms of the Adobe license agreement accompanying it. If you have received
19 // this file from a source other than Adobe, then your use, modification, or
20 // distribution of it requires the prior written permission of Adobe.
21 //
22 //========================================================================================
23 
24 #ifndef __CCommandLineArgs_h__
25 #define __CCommandLineArgs_h__
26 
27 #include "IDFile.h"
28 
29 #include <string>
30 #include <vector>
31 
32 
38 {
39 public:
40  enum { kInvalidPort = -1 };
41 
42  enum { kInvalidTimeValue = -1 };
43 
44  enum SessionSupportTimeoutType
45  {
46  kTimeoutSessionIdle,
47  kTimeoutReceiveIdle,
48  kSSTimeoutUnknown
49  };
50 
54  virtual ~CCommandLineArgs();
55 
57  virtual void Terminate();
58 
62  virtual int32 GetArgCnt();
63 
68  virtual const PMString& GetNthArg(const int32& nth);
69 
73  virtual int GetPortNumber();
74 
78  virtual int GetAdminPortNumber();
79 
83  virtual bool ShouldCreateConsole();
84 
89 
93  virtual const PMString& GetExecutablePath();
94 
98  virtual int32 GetMaxErrors();
99 
104  virtual void SetMaxErrors(int32 newMaxErrors );
105 
109  virtual bool ShouldPostToErrorList();
110 
114  virtual void SetPostToErrorList(bool16 bShouldPost);
115 
119  virtual bool ShouldUseSEH();
120 
124  virtual bool ArePreviewsOn();
125 
129  virtual PMString GetHomeFolder();
130 
135  virtual PMString GetPluginPath();
136 
141  virtual PMString GetIORFile();
142 
146  virtual PMString GetHostName();
147 
151  virtual bool ShouldLogToSystemEventLog();
152 
156  virtual bool ShouldSendCrashLogs();
157 
161  virtual int GetSessionSupportTimeout(SessionSupportTimeoutType type);
162 
167  virtual int GetHeartbeatUpdateInterval();
168 
173  virtual bool ExecuteOnMainThreadOnly();
174 
179  virtual bool IsSessionSupportNonBlocking();
180 
185  virtual uint16 GetMaximumWaitForBeginSession();
186 
188  virtual bool ProcessArgs() { return (ProcessArgsEarly() && ProcessArgsLate()); };
189  virtual bool ProcessArgsEarly(); // may be called before initialization is complete
190  virtual bool ProcessArgsLate(); // may only be called after initialization (especially CoolType) is complete
191 
195  virtual void ShowUsage();
196 
201  virtual bool GetUseVersionCue();
202 
203 private:
204  virtual void Abort(const PMString& msg = "", bool bShowUsage = kTrue);
205 
206  virtual bool AcquireSingleInstance() = 0;
207  virtual void ReleaseSingleInstance() = 0;
208 
209  virtual bool AcquirePort(const int& portNumber) = 0;
210  virtual void ReleasePort() = 0;
211 
212  virtual bool AcquireConfiguration(const PMString& configurationName) = 0;
213  virtual void ReleaseConfiguration() = 0;
214 
215  virtual bool PortIsInUse(const int& portNumber) = 0;
216 
217 protected:
218  virtual IDFile MakeFileInSemaphoreFolder(const PMString& filename);
219 
220  std::vector<PMString> fArgs; // used by M/WCommandLineArgs
221 
222 private:
223  enum Status { kNotProcessed, kPartiallyProcessed, kProcessedSuccess, kProcessedFailure };
224 
225  PMString fConfigurationName;
226  PMString fExecutablePath;
227  PMString fHomeFolder;
228  PMString fPluginPath;
229  PMString fIORFile;
230  PMString fHostName;
231 
232  int fPortNumber;
233  int fAdminPortNumber;
234  int32 fMaxErrors;
235 
236  Status fStatus;
237  bool fShouldCreateConsole;
238  bool fShouldPostToErrorList;
239  bool fShouldUseSEH;
240  bool fPreviews;
241  bool fBShouldLogToSystemEventLog;
242  bool fBConfigurationAcquired;
243  bool fBSendCrashLogs;
244 
245  int fSessionSupportSessionIdleTimeout;
246  int fSessionSupportReceiveIdleTimeout;
247  int fHeartbeatUpdateTimeInterval;
248 
249  bool fExecuteOnMainThreadOnly;
250  bool fNonBlockingSessionSupport;
251  int16 fMaxWaitTimeForBeginSession;
252  bool fBShouldUseVersionCue;
253 };
254 
255 extern CCommandLineArgs* gCommandLineArgs;
256 
257 #endif