strtable.h #1

  • //
  • guest/
  • andrew_mcdonald/
  • p4hl/
  • src/
  • dlls/
  • strtable.h
  • View
  • Commits
  • Open Download .zip Download (2 KB)
/*
 * Copyright 1995, 1996 Perforce Software.  All rights reserved.
 *
 * This file is part of Perforce - the FAST SCM System.
 */

/*
 * strtable.h - a string table, using StrDict interface
 *
 * Classes defined:
 *
 *	StrPtrDict - a dictionary whose values we don't own
 *	StrBufDict - a dictionary whose values we do own
 *
 * Public methods:
 *
 *	Clear() - reset table, making all variables unset
 *	GetVar() - look up variable, return value (or 0 if not set)
 *	SetVar() - set variable/value pair
 *
 * XXX Total dumb duplication of StrPtrDict into StrBufDict. 
 */

#ifndef _strtable_h_
#define _strtable_h_

class StrPtrTable {

    public:
			StrPtrTable();
			~StrPtrTable();

	void		Clear()
			{
			    tabLength = 0;
			}

	int		GetCount()
			{
			    return tabLength;
			}

	StrPtr *	GetTable()
			{
			    return tabVal;
			}

	void		SetVar( const StrPtr &val );

    private:
	
	StrRef		*tabVal;	
	int		tabSize;
	int		tabLength;

} ;

struct StrPtrEntry;

class StrPtrDict : public StrDict {

    public:
			StrPtrDict();
			~StrPtrDict();

	void		Clear()
			{
			    tabLength = 0;
			}

	// virtuals of StrDict

	StrPtr *	VGetVar( const StrPtr &var );
	void		VSetVar( const StrPtr &var, const StrPtr &val );
	void		VRemoveVar( const StrPtr &var );
	int		VGetVarX( int x, StrRef &var, StrRef &val );

    private:
	
	StrPtrEntry	*elems;
	int		tabSize;
	int		tabLength;

} ;

struct StrBufEntry;

class StrBufDict : public StrDict {

    public:
			StrBufDict();
			StrBufDict( StrDict & dict );
			StrBufDict & operator =( StrDict & dict );
			~StrBufDict();

	void		Clear()
			{
			    tabLength = 0;
			}

	int		GetCount()
			{
			    return tabLength;
			}

	// virtuals of StrDict

	StrPtr *	VGetVar( const StrPtr &var );
	void		VSetVar( const StrPtr &var, const StrPtr &val );
	void		VRemoveVar( const StrPtr &var );
	int		VGetVarX( int x, StrRef &var, StrRef &val );

    private:
	
	void Set( StrDict & dict );
	
	StrBufEntry	*elems;
	int		tabSize;
	int		tabLength;

} ;

#endif /* _strtable_h_ */
# Change User Description Committed
#1 7292 Andrew McDonald initial submittal
//guest/sam_stafford/p4hl/src/dlls/strtable.h
#1 1689 Sam Stafford Integrate 02.1 API and code cleanup to P4HL.
 Lots of work.  Phew.
//guest/sam_stafford/p4hltest/strtable.h
#1 1687 Sam Stafford Add files that didn't get added.