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