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