core/src/script_command.h
author Tom Sutcliffe <thomas.sutcliffe@accenture.com>
Wed, 20 Oct 2010 10:11:55 +0100
changeset 89 ce94bcf3f672
parent 0 7f656887cf89
permissions -rw-r--r--
Re-enabled bytepair compression support in chkdeps. Seems it was a bug in the loader code, producing an incorrect error, that led me to disabole it originally. Commented out the apparently-incorrect check, which means theoretically some corrupt binaries won't get picked up during decompression. Which probably doesn't matter much.

// script_command.h
// 
// Copyright (c) 2010 Accenture. All rights reserved.
// This component and the accompanying materials are made available
// under the terms of the "Eclipse Public License v1.0"
// which accompanies this distribution, and is available
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
// 
// Initial Contributors:
// Accenture - Initial contribution
//
#include <fshell/ioutils.h>
#include <fshell/stringhash.h>

// Helper class for parsing the arguments passed to a script (via "fshell script" or "source script")
class CScriptCommand : public IoUtils::CCommandBase
	{
public:
	static CScriptCommand* NewLC(const TDesC& aScriptPath, TIoHandleSet& aIoHandles);
	~CScriptCommand();
	void ParseCommandLineArgsL(const TDesC& aArgs, IoUtils::CEnvironment& aEnv, RPointerArray<HBufC>* aAdditionalPrefixArguments=NULL);
	void DisplayScriptHelpL();

	TBool ShouldDisplayHelp() const { return iDisplayHelp; }

protected: // From CCommandBase
	const TDesC& Name() const;
	void DoRunL();

private:
	CScriptCommand();
	void ConstructL(const TDesC& aScriptPath, TIoHandleSet& aIoHandles);
	void SetupArgumentL(const IoUtils::TValue& aValue);
	void SetupOptionL(const IoUtils::TValue& aValue);
	void SetEnvironmentVariableFromValueL(IoUtils::CEnvironment& aEnv, const IoUtils::TValue& aValue);

private:
	HBufC* iScriptPath;
	TPtrC iName;
	IoUtils::CCommandInfoFile* iOwnedCif; // We can't access the base class iCif or iFlags directly...

	RPointerArray<HBufC> iNonCifScriptArguments;
	TBool iDisplayHelp;
	TBuf<256> iTempStr;
	};