|
1 // tfshellarguments.cpp |
|
2 // |
|
3 // Copyright (c) 2010 Accenture. All rights reserved. |
|
4 // This component and the accompanying materials are made available |
|
5 // under the terms of the "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 // Accenture - Initial contribution |
|
11 // |
|
12 |
|
13 #include <fshell/ioutils.h> |
|
14 #include <fshell/common.mmh> |
|
15 |
|
16 using namespace IoUtils; |
|
17 |
|
18 class CCmdTfshellArguments : public CCommandBase |
|
19 { |
|
20 public: |
|
21 static CCommandBase* NewLC(); |
|
22 ~CCmdTfshellArguments(); |
|
23 private: |
|
24 CCmdTfshellArguments(); |
|
25 private: // From CCommandBase. |
|
26 virtual const TDesC& Name() const; |
|
27 virtual const TDesC& Description() const; |
|
28 virtual void DoRunL(); |
|
29 virtual void ArgumentsL(RCommandArgumentList& aArguments); |
|
30 virtual void OptionsL(RCommandOptionList& aOptions); |
|
31 private: |
|
32 TUint64 iBigInt; |
|
33 TReal iReal; |
|
34 }; |
|
35 |
|
36 EXE_BOILER_PLATE(CCmdTfshellArguments) |
|
37 |
|
38 CCommandBase* CCmdTfshellArguments::NewLC() |
|
39 { |
|
40 CCmdTfshellArguments* self = new(ELeave) CCmdTfshellArguments(); |
|
41 CleanupStack::PushL(self); |
|
42 self->BaseConstructL(); |
|
43 return self; |
|
44 } |
|
45 |
|
46 CCmdTfshellArguments::~CCmdTfshellArguments() |
|
47 { |
|
48 } |
|
49 |
|
50 CCmdTfshellArguments::CCmdTfshellArguments() |
|
51 { |
|
52 } |
|
53 |
|
54 const TDesC& CCmdTfshellArguments::Name() const |
|
55 { |
|
56 _LIT(KName, "tfshellarguments"); |
|
57 return KName; |
|
58 } |
|
59 |
|
60 const TDesC& CCmdTfshellArguments::Description() const |
|
61 { |
|
62 _LIT(KDescription, "Test different fshell argument types"); |
|
63 return KDescription; |
|
64 } |
|
65 |
|
66 void CCmdTfshellArguments::ArgumentsL(RCommandArgumentList& aArguments) |
|
67 { |
|
68 aArguments.AppendUintL(iBigInt, _L("bigint"), _L("64-bit int type. Must be set to 2^40 (ie 1099511627776 or 0x10000000000).")); |
|
69 aArguments.AppendRealL(iReal, _L("real"), _L("double-precision floating point type. Must be set to 3.1415927 or equivalent")); |
|
70 } |
|
71 |
|
72 void CCmdTfshellArguments::OptionsL(RCommandOptionList& /*aOptions*/) |
|
73 { |
|
74 } |
|
75 |
|
76 void CCmdTfshellArguments::DoRunL() |
|
77 { |
|
78 const TUint64 KInt = 1099511627776ULL; |
|
79 const TReal KReal = 3.1415927; |
|
80 |
|
81 if (iBigInt != KInt) |
|
82 { |
|
83 LeaveIfErr(KErrArgument, _L("bigint %Ld doesn't equal %Ld"), iBigInt, KInt); |
|
84 } |
|
85 if (iReal < 3.14159265 || iReal > 3.14159275) |
|
86 { |
|
87 // Specify a range because it's floating point |
|
88 LeaveIfErr(KErrArgument, _L("real %f doesn't equal %f"), iReal, KReal); |
|
89 } |
|
90 } |