core/src/script_command.h
changeset 0 7f656887cf89
equal deleted inserted replaced
-1:000000000000 0:7f656887cf89
       
     1 // script_command.h
       
     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 #include <fshell/ioutils.h>
       
    13 #include <fshell/stringhash.h>
       
    14 
       
    15 // Helper class for parsing the arguments passed to a script (via "fshell script" or "source script")
       
    16 class CScriptCommand : public IoUtils::CCommandBase
       
    17 	{
       
    18 public:
       
    19 	static CScriptCommand* NewLC(const TDesC& aScriptPath, TIoHandleSet& aIoHandles);
       
    20 	~CScriptCommand();
       
    21 	void ParseCommandLineArgsL(const TDesC& aArgs, IoUtils::CEnvironment& aEnv, RPointerArray<HBufC>* aAdditionalPrefixArguments=NULL);
       
    22 	void DisplayScriptHelpL();
       
    23 
       
    24 	TBool ShouldDisplayHelp() const { return iDisplayHelp; }
       
    25 
       
    26 protected: // From CCommandBase
       
    27 	const TDesC& Name() const;
       
    28 	void DoRunL();
       
    29 
       
    30 private:
       
    31 	CScriptCommand();
       
    32 	void ConstructL(const TDesC& aScriptPath, TIoHandleSet& aIoHandles);
       
    33 	void SetupArgumentL(const IoUtils::TValue& aValue);
       
    34 	void SetupOptionL(const IoUtils::TValue& aValue);
       
    35 	void SetEnvironmentVariableFromValueL(IoUtils::CEnvironment& aEnv, const IoUtils::TValue& aValue);
       
    36 
       
    37 private:
       
    38 	HBufC* iScriptPath;
       
    39 	TPtrC iName;
       
    40 	IoUtils::CCommandInfoFile* iOwnedCif; // We can't access the base class iCif or iFlags directly...
       
    41 
       
    42 	RPointerArray<HBufC> iNonCifScriptArguments;
       
    43 	TBool iDisplayHelp;
       
    44 	TBuf<256> iTempStr;
       
    45 	};