/******************************************************************************
 JUNIXEnvironmentInfo.h

	Interface for the JUNIXEnvironmentInfo class

	Copyright © 1997 by Glenn W. Bach. All rights reserved.

 ******************************************************************************/

#ifndef _H_JUNIXEnvironmentInfo
#define _H_JUNIXEnvironmentInfo

#include <JPtrArray.h>
#include <jTypes.h>
#include <JString.h>

class JUNIXEnvironmentEntry;

class JUNIXEnvironmentInfo : public JPtrArray<JUNIXEnvironmentEntry>
{
public:

	static JBoolean Create(JUNIXEnvironmentInfo** list);
	virtual ~JUNIXEnvironmentInfo();
	
	void	Apply();
	void	Revert();
	void	MarkEntryAsDeleted(const JIndex index);
	void	AddEntry(const JCharacter* pattern, const JCharacter* action, 
					const JCharacter* alternate, const JBoolean system);
	
	JBoolean	ChangeVariable(const JIndex index, const JCharacter* variable, JIndex* newindex);
	JBoolean	ChangeValue(const JIndex index, const JCharacter* value);

protected:

	JUNIXEnvironmentInfo(const JCharacter* bindingsfile);

private:

	JString								itsBindingsFile;
	JPtrArray<JUNIXEnvironmentEntry>*	itsDeletedEntries;

private:

	void	LoadBindings(const JCharacter* bindingsfile, const JBoolean system);

	// not allowed

	JUNIXEnvironmentInfo(const JUNIXEnvironmentInfo& source);
	const JUNIXEnvironmentInfo& operator=(const JUNIXEnvironmentInfo& source);
};

#endif