|
1 // Copyright (c) 2004-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 // CCommandLineArguments class |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef __CN_CMDPARSE_H__ |
|
19 #define __CN_CMDPARSE_H__ |
|
20 |
|
21 #include <e32base.h> |
|
22 |
|
23 /* Parses command line arguments. |
|
24 |
|
25 The class provides functions to access the arguments that are supplied when |
|
26 a program is launched as a new process. |
|
27 |
|
28 The program name is returned as argument 0. Other arguments are returned as |
|
29 arguments 1, 2 etc. |
|
30 |
|
31 The Count() function indicates how many arguments there are, including the |
|
32 program name. Arguments may be quoted to contain blanks and quotes. |
|
33 |
|
34 The command line arguments and process name occupy 256 characters each. In |
|
35 order to minimise the space used throughout the lifetime of a program, it |
|
36 is recommended that the program parse the arguments shortly after initialisation, |
|
37 save the argument values appropriately, and then destroy the CCommandLineArguments |
|
38 object. |
|
39 |
|
40 The main use of this class is in parsing the arguments of command-line |
|
41 utilities. |
|
42 @internalComponent |
|
43 */ |
|
44 class CCommandLineArguments : public CBase |
|
45 { |
|
46 public: |
|
47 static CCommandLineArguments* NewLC(); |
|
48 static CCommandLineArguments* NewL(); |
|
49 virtual ~CCommandLineArguments(); |
|
50 TPtrC Arg(TInt aArg) const; |
|
51 TInt Count() const; |
|
52 |
|
53 private: |
|
54 inline CCommandLineArguments(); |
|
55 void ConstructL(); |
|
56 |
|
57 private: |
|
58 CArrayFixFlat<TPtrC>* iArgs; |
|
59 HBufC* iCommandLine; |
|
60 TFileName iFileName; |
|
61 |
|
62 }; |
|
63 |
|
64 #endif//__CN_CMDPARSE_H__ |