1 /* |
|
2 * Copyright (c) 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 "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 #include "bacline.h" |
|
19 |
|
20 // --------------------------------------------------------------------------- |
|
21 // |
|
22 // --------------------------------------------------------------------------- |
|
23 // |
|
24 CCommandLineArguments* CCommandLineArguments::NewL() |
|
25 { |
|
26 CCommandLineArguments* self = |
|
27 CCommandLineArguments::NewLC(); |
|
28 CleanupStack::Pop( self ); |
|
29 return self; |
|
30 } |
|
31 |
|
32 // --------------------------------------------------------------------------- |
|
33 // |
|
34 // --------------------------------------------------------------------------- |
|
35 // |
|
36 CCommandLineArguments* CCommandLineArguments::NewLC() |
|
37 { |
|
38 CCommandLineArguments* self = |
|
39 new( ELeave )CCommandLineArguments(); |
|
40 CleanupStack::PushL( self ); |
|
41 self->ConstructL(); |
|
42 return self; |
|
43 } |
|
44 |
|
45 // --------------------------------------------------------------------------- |
|
46 // |
|
47 // --------------------------------------------------------------------------- |
|
48 // |
|
49 CCommandLineArguments::CCommandLineArguments() |
|
50 { |
|
51 } |
|
52 |
|
53 // --------------------------------------------------------------------------- |
|
54 // |
|
55 // --------------------------------------------------------------------------- |
|
56 // |
|
57 void CCommandLineArguments::ConstructL() |
|
58 { |
|
59 iArgs = new( ELeave )CDesCArrayFlat( 1 ); |
|
60 } |
|
61 |
|
62 // --------------------------------------------------------------------------- |
|
63 // |
|
64 // --------------------------------------------------------------------------- |
|
65 // |
|
66 CCommandLineArguments::~CCommandLineArguments() |
|
67 { |
|
68 delete iArgs; |
|
69 } |
|
70 |
|
71 // --------------------------------------------------------------------------- |
|
72 // |
|
73 // --------------------------------------------------------------------------- |
|
74 // |
|
75 TPtrC CCommandLineArguments::Arg( TInt aArg ) const |
|
76 { |
|
77 TPtrC arg; |
|
78 if ( aArg < iArgs->Count() ) |
|
79 { |
|
80 arg.Set( iArgs->MdcaPoint( aArg ) ); |
|
81 } |
|
82 return arg; |
|
83 } |
|
84 |
|
85 // --------------------------------------------------------------------------- |
|
86 // |
|
87 // --------------------------------------------------------------------------- |
|
88 // |
|
89 TInt CCommandLineArguments::Count() const |
|
90 { |
|
91 return iArgs->Count(); |
|
92 } |
|
93 |
|
94 // --------------------------------------------------------------------------- |
|
95 // |
|
96 // --------------------------------------------------------------------------- |
|
97 // |
|
98 CDesCArray& CCommandLineArguments::Args() |
|
99 { |
|
100 return *iArgs; |
|
101 } |
|