2 * Copyright 1995, 1996 Perforce Software. All rights reserved.
4 * This file is part of Perforce - the FAST SCM System.
8 * StrDict.h - a set/get dictionary interface
12 * StrDict - a GetVar/PutVar dictionary interface
20 class StrVarName
: public StrRef
{
23 StrVarName( const char *buf
, int length
)
25 memcpy( varName
, buf
, length
);
26 varName
[ length
] = 0;
27 Set( varName
, length
);
30 StrVarName( const StrPtr
&name
, int x
);
31 StrVarName( const StrPtr
&name
, int x
, int y
);
45 void SetVar( const char *var
);
46 void SetVar( const char *var
, int value
);
47 void SetVar( const char *var
, const char *value
);
48 void SetVar( const char *var
, const StrPtr
*value
);
49 void SetVar( const char *var
, const StrPtr
&value
);
50 void SetVar( const StrPtr
&var
, const StrPtr
&value
)
51 { VSetVar( var
, value
); }
53 void SetVarV( const char *arg
);
54 void SetArgv( int argc
, char *const *argv
);
55 void SetVar( const StrPtr
&var
, int x
, const StrPtr
&val
);
56 void SetVar( const char *var
, int x
, const StrPtr
&val
);
57 void SetVar( const char *var
, int x
, int y
, const StrPtr
&val
);
59 StrPtr
*GetVar( const char *var
);
60 StrPtr
*GetVar( const char *var
, Error
*e
);
61 StrPtr
*GetVar( const StrPtr
&var
, int x
);
62 StrPtr
*GetVar( const StrPtr
&var
, int x
, int y
);
63 StrPtr
*GetVar( const StrPtr
&var
)
64 { return VGetVar( var
); }
66 int GetVar( int x
, StrRef
&var
, StrRef
&val
)
67 { return VGetVarX( x
, var
, val
); }
69 void ReplaceVar( const char *var
, const char *value
);
70 void RemoveVar( const char *var
);
72 int Save( FILE * out
);
73 int Load( FILE * out
);
77 // Get/Set vars, provided by subclass
79 virtual StrPtr
*VGetVar( const StrPtr
&var
) = 0;
80 virtual void VSetVar( const StrPtr
&var
, const StrPtr
&val
);
81 virtual void VRemoveVar( const StrPtr
&var
);
82 virtual int VGetVarX( int x
, StrRef
&var
, StrRef
&val
);
83 virtual void VSetError( const StrPtr
&var
, Error
*e
);