mapchar.h #1

  • //
  • guest/
  • perforce_software/
  • p4/
  • dbsupp/
  • mapchar.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.
 */

/*
 * MapChar -- a MapHalf's character string
 *
 * Public Methods:
 *
 *	MapChar::Set() - initialize MapChar, given the string
 *	MapChar::Advance() - advance to the next lexical element
 *	MapChar::ParamNumber() - return wildcard slot of current element
 *			%x = x
 *			* = 10 + nStars
 *			... = 20 + nDots
 *	MapChar::MakeParam() - format a parameter element
 *	MapChar::Name() - dump out current element name for debugging
 *
 * Public attributes:
 *	p - pointer to current element
 *	cc - current element's type
 *	ccPre - previous element's type
 */

const int PARAM_BASE_PERCENT = 0;	// parameter slots for %x
const int PARAM_BASE_STARS = 10;	// parameter slots for *'s
const int PARAM_BASE_DOTS = 20;		// parameter slots for ...'s
const int PARAM_BASE_TOP = 23;		// last slot

enum MapCharClass {
	cEOS,		// \0
	cCHAR,		// any char
	cSLASH,		// /
	cPERC,		// %x
	cSTAR,		// *
	cDOTS		// ...
} ;

class MapChar {

    public:
	int 		Set( char *&p, int &nStars, int &nDots );

	void		MakeParam( StrBuf &buf, MapChar *mc2, int &wildSlot );

	const char 	*Name();		// debugging only

	int		IsWild() { return cc >= cPERC; }

	int	operator -( MapChar &mc ) 
		{ return StrPtr::SCompare( c, mc.c ); }

	int 	operator -( char oc ) 
		{ return StrPtr::SCompare( c, oc ); }

	int	operator ==( MapChar &mc ) 
		{ return StrPtr::SEqual( c, mc.c ); }

	int 	operator ==( char oc ) 
		{ return StrPtr::SEqual( c, oc ); }

    public:
	char		c;			// current character
	char		paramNumber;		// current ParamNumber
	MapCharClass	cc;			// current char's type
} ;

# Change User Description Committed
#2 12188 Matt Attaway Move 'main' p4 into a release specific directory in prep for new releases
#1 9129 Matt Attaway Initial commit of the 2014.1 p4/p4api source code