Download Source Code

CVar Class Reference

This class manages a list of variables. More...

#include <Var.h>

Inheritance diagram for CVar:

Inheritance graph
[legend]
Collaboration diagram for CVar:

Collaboration graph
[legend]
List of all members.

Public Member Functions

DWORD Write (LPVOID dst, DWORD ptr, DWORD max, LPVOID src, DWORD size)
 Generic buffer writing function.
BOOL Replace (CPipe *out, LPDWORD op, LPCTSTR in, DWORD dwin, LPCTSTR pBegin, LPCTSTR pEnd, LPSTR pBreak, CVar *params, LPDWORD pdwBreak, char sep= '&')
 Used for replacing tags in a string.
BOOL Replace (LPSTR out, LPDWORD op, DWORD dwout, LPCTSTR in, DWORD dwin, LPCTSTR pBegin, LPCTSTR pEnd, LPSTR pBreak, CVar *params, LPDWORD pdwBreak, char sep= '&')
 Used for replacing tags in a string.
BOOL ReadInline (LPBYTE buf, DWORD size, char sep= '&', BOOL bDeCanonicalize=TRUE)
 Reads inline parameters such as that used in URL's.
BOOL ReadMIME (LPBYTE buf, DWORD size)
 Reads MIME encoded strings or HTML headers.
virtual void DeleteObject (void *node)
 Releases variable element data.
virtual DWORD GetObjSize ()
 Returns the size of a VAR structure.
BOOL RemoveVar (LPCTSTR pVar)
 Removes the named variable from the list.
LPVAR FindVar (LPCTSTR pVar)
 Finds a variable in the list by name.
LPVAR AddVar (LPCTSTR pVar, DWORD dwType, LPVOID pVal, DWORD dwSize)
 Adds a variable to the list.
 CVar ()
 Constructor.
virtual ~CVar ()
 Destructor.
LPCTSTR GetStr (LPCTSTR pVar, LPCTSTR pDef="")
 Returns string value of variable.
LPVAR AddVar (LPCTSTR pVar, LPCTSTR pVal)
 Adds string variable to the list.
BOOL GetVar (LPCTSTR pVar, LPSTR pVal, DWORD size)
 Reads variable string value into a buffer.
DWORD GetDword (LPCTSTR pVar, DWORD dwDef=0)
 Returns DWORD value of variable.
LPVAR AddVar (LPCTSTR pVar, DWORD dwVal)
 Adds a DWORD variable to the list.
BOOL GetVar (LPCTSTR pVar, LPDWORD pdwVal)
 Copies the DWORD value of a variable.
LONG GetLong (LPCTSTR pVar, LONG lDef=0)
 Returns the long value of a variable.
LPVAR AddVar (LPCTSTR pVar, LONG lVal)
 Adds a long variable to the list.
BOOL GetVar (LPCTSTR pVar, LPLONG plVal)
 Copies the long value of a variable.
double GetDouble (LPCTSTR pVar, double dDef=0)
 Returns the double value of a variable.
LPVAR AddVar (LPCTSTR pVar, double dVal)
 Adds a double variable to the list.
BOOL GetVar (LPCTSTR pVar, double *pdVal)
 Copies the double value of a variable.
LPVAR AddVar (LPCTSTR pVar, LPVOID pVal, DWORD dwSize)
 Adds a binary variable to the list.
BOOL GetVar (LPCTSTR pVar, LPVOID pVal, DWORD size)
 Copies binary data from variable.

Detailed Description

This class manages a list of variables.

This class manages a list of variables. This class is obsolete, new code should use CRKey or CReg instead.


Member Function Documentation

LPVAR CVar::AddVar LPCTSTR  pVar,
LPVOID  pVal,
DWORD  dwSize
[inline]
 

Adds a binary variable to the list.

Parameters:
[in] pVar - Name of variable
[in] pVal - Pointer to variable data
[in] dwSize - Number of bytes in pVal
Returns:
Pointer to variable structure if success otherwise NULL
See also:

LPVAR CVar::AddVar LPCTSTR  pVar,
double  dVal
[inline]
 

Adds a double variable to the list.

Parameters:
[in] pVar - Name of variable to add
[in] dVal - Initial value of variable
Returns:
Pointer to variable information or NULL if error
See also:

LPVAR CVar::AddVar LPCTSTR  pVar,
LONG  lVal
[inline]
 

Adds a long variable to the list.

Parameters:
[in] pVar - Name of variable
[in] lVal - Initial long value
Returns:
Pointer to variable information or NULL if error
See also:

LPVAR CVar::AddVar LPCTSTR  pVar,
DWORD  dwVal
[inline]
 

Adds a DWORD variable to the list.

Parameters:
[in] pVar - Name of variable
[in] dwVal - Initial value of variable
Returns:
Pointer to variable info or NULL if error.
See also:

LPVAR CVar::AddVar LPCTSTR  pVar,
LPCTSTR  pVal
[inline]
 

Adds string variable to the list.

Parameters:
[in] pVar - Variable name
[in] pVal - String value of variable
Returns:
Pointer to variable information or NULL if error
See also:

LPVAR CVar::AddVar LPCTSTR  pVar,
DWORD  dwType,
LPVOID  pVal,
DWORD  dwSize
 

Adds a variable to the list.

Parameters:
[in] pVar - Variable name
[in] dwType - Variable type
[in] pVal - Variable value
[in] dwSize - Number of bytes in pVal
Returns:
Pointer to new variable information
See also:

void CVar::DeleteObject void *  node  )  [virtual]
 

Releases variable element data.

Parameters:
[in] node - Pointer to VAR structure

Reimplemented from CLList.

LPVAR CVar::FindVar LPCTSTR  pVar  ) 
 

Finds a variable in the list by name.

Parameters:
[in] pVar - Variable name
Returns:
Pointer to variable info or NULL if not found
See also:

double CVar::GetDouble LPCTSTR  pVar,
double  dDef = 0
[inline]
 

Returns the double value of a variable.

Parameters:
[in] pVar - Name of variable
[in] dDef - Default double value for variable
Returns:
double value of variable or dDef if not found
See also:

DWORD CVar::GetDword LPCTSTR  pVar,
DWORD  dwDef = 0
[inline]
 

Returns DWORD value of variable.

Parameters:
[in] pVar - Variable name
[in] dwDef - Default value, returned if not found
Returns:
DWORD value of variable or dwDef if not found
See also:

LONG CVar::GetLong LPCTSTR  pVar,
LONG  lDef = 0
[inline]
 

Returns the long value of a variable.

Parameters:
[in] pVar - Name of variable
[in] lDef - Default long value, returned if not found
Returns:
long value of variable or lDef if not found.
See also:

LPCTSTR CVar::GetStr LPCTSTR  pVar,
LPCTSTR  pDef = ""
[inline]
 

Returns string value of variable.

Parameters:
[in] pVar - Variable name
[in] pDef - Default value, returned if not found
Returns:
Returns string value or pDef if not found
See also:

BOOL CVar::GetVar LPCTSTR  pVar,
LPVOID  pVal,
DWORD  size
[inline]
 

Copies binary data from variable.

Parameters:
[in] pVar - Variable name
[in] pVal - Receives the binary data
[in] size - Size of buffer in pVal
Returns:
Non-zero if success
See also:

BOOL CVar::GetVar LPCTSTR  pVar,
double *  pdVal
[inline]
 

Copies the double value of a variable.

Parameters:
[in] pVar - Variable name
[in] pdVal - Receives the double value of variable
Returns:
Non-zero if success
See also:

BOOL CVar::GetVar LPCTSTR  pVar,
LPLONG  plVal
[inline]
 

Copies the long value of a variable.

Parameters:
[in] pVar - Name of variable
[in] plVal - Receives the long value of the variable
Returns:
Non-zero if success
See also:

BOOL CVar::GetVar LPCTSTR  pVar,
LPDWORD  pdwVal
[inline]
 

Copies the DWORD value of a variable.

Parameters:
[in] pVar - Name of variable
[in] pdwVal - Receives the DWORD value of the variable
Returns:
Non-zero if success
See also:

BOOL CVar::GetVar LPCTSTR  pVar,
LPSTR  pVal,
DWORD  size
[inline]
 

Reads variable string value into a buffer.

Parameters:
[in] pVar - Variable name
[out] pVal - Receives the string value of the variable
[in] size - Size of the buffer in pVal
Returns:
Non-zero if success, otherwise zero
See also:

BOOL CVar::ReadInline LPBYTE  buf,
DWORD  size,
char  sep = '&',
BOOL  bDeCanonicalize = TRUE
 

Reads inline parameters such as that used in URL's.

Parameters:
[in] buf - Input buffer
[in] size - Number of bytes in buf
[in] sep - Data separator
[in] bDeCanonicalize - Set to non-zero to decode escape sequences.
Example strings:

search=computer

search=computer&max_price=1000

location=Jacksonville20Florida&name=Bob20Smith&age=27

Returns:
See also:

BOOL CVar::ReadMIME LPBYTE  buf,
DWORD  size
 

Reads MIME encoded strings or HTML headers.

Parameters:
[in] buf - MIME encoded data
[in] size - Number of bytes in buf
Example:

Cache-Control: private Content-Type: text/html Server: GWS/2.1 Transfer-Encoding: chunked

Returns:
Non-zero if success
See also:

BOOL CVar::RemoveVar LPCTSTR  pVar  ) 
 

Removes the named variable from the list.

Parameters:
[in] pVar - Variable name
Returns:
Non-zero if removed
See also:

BOOL CVar::Replace LPSTR  out,
LPDWORD  op,
DWORD  dwout,
LPCTSTR  in,
DWORD  dwin,
LPCTSTR  pBegin,
LPCTSTR  pEnd,
LPSTR  pBreak,
CVar params,
LPDWORD  pdwBreak,
char  sep = '&'
 

Used for replacing tags in a string.

Parameters:
[out] out - Output buffer
[in] op - Start of output buffer
[in] dwout - Size of buffer in out
[in] in - Input buffer
[in] dwin - size of input buffer
[in] pBegin - Pointer to tag start string
[in] pEnd - Pointer to tag end string
[in] pBreak - Break strings
[in] params - Parameters
[in] pdwBreak - Break offset
[in] sep - Parameter separator
Returns:
Non-zero if success
See also:

BOOL CVar::Replace CPipe out,
LPDWORD  op,
LPCTSTR  in,
DWORD  dwin,
LPCTSTR  pBegin,
LPCTSTR  pEnd,
LPSTR  pBreak,
CVar params,
LPDWORD  pdwBreak,
char  sep = '&'
 

Used for replacing tags in a string.

Parameters:
[out] out - Output buffer
[in] op - Start of output buffer
[in] in - Input buffer
[in] dwin - size of input buffer
[in] pBegin - Pointer to tag start string
[in] pEnd - Pointer to tag end string
[in] pBreak - Break strings
[in] params - Parameters
[in] pdwBreak - Break offset
[in] sep - Parameter separator
Returns:
Non-zero if success
See also:

DWORD CVar::Write LPVOID  dst,
DWORD  ptr,
DWORD  max,
LPVOID  src,
DWORD  size
 

Generic buffer writing function.

Parameters:
[in] dst - Destination buffer
[in] ptr - Starting offset in buffer
[in] max - Size of buffer in dst
[in] src - Data to copy
[in] size - Size of data in src
I have a few functions like this floating around. Need to consolidate my string processing functions one day.

Returns:
ptr + number of bytes written to dst
See also:


The documentation for this class was generated from the following files:
  • inc/Var.h
  • Var.cpp
Copyright Robert Umbehant
This documentation is covered by the LGPL