Download Source Code

CStr Class Reference

String class. More...

#include <Str.h>

Inheritance diagram for CStr:

Inheritance graph
[legend]
Collaboration diagram for CStr:

Collaboration graph
[legend]
List of all members.

Public Member Functions

LPCTSTR Set (double n, LPCTSTR pTemplate="%f0.2")
 Sets a double value into the string.
 CStr ()
 Constructor.
virtual ~CStr ()
 Destructor.
 CStr (LPCTSTR pStr)
 Constructs a string and initializes.
 CStr (unsigned long dw)
 Constructs a string initialized with a DWORD value.
 CStr (long l)
 Constructs a string and initializes to a long value.
 CStr (double d)
 Constructs a string and initializes to a double value.
 operator LPCTSTR ()
 Returns a pointer to the encapsulated string.
char * str (unsigned long offset=0)
 Returns a pointer to the encapsulated string ofset.
bool copy (const char *ptr)
 Copies NULL terminated string.
bool copy (const char *ptr, unsigned long len)
 Copies unterminated string.
CStroperator= (unsigned long n)
 Assigns string value of unsigned long.
CStroperator= (long n)
 Assigns string value of long.
CStroperator= (LPCTSTR str)
 Assigns value of NULL terminated string.
CStroperator= (double n)
 Assigns string value of double.
CStroperator+= (unsigned long n)
 Appends string value of unsigned long.
CStroperator+= (long n)
 Appends string value of long.
CStroperator+= (LPCTSTR str)
 Appends value of NULL terminated string.
CStroperator+= (double n)
 Appends string value of double.
DWORD strlen ()
 Returns the length of the encapsulated string.

Detailed Description

String class.

Old class encapsulating a string. Originally did not use TMem, but I updated it a little. Your much better off using ATL7 or MFC string class in new code.


Constructor & Destructor Documentation

CStr::CStr LPCTSTR  pStr  )  [inline]
 

Constructs a string and initializes.

Parameters:
[in] pStr - Initial value for string

CStr::CStr unsigned long  dw  )  [inline]
 

Constructs a string initialized with a DWORD value.

Parameters:
[in] dw - DWORD value that is converted to string

CStr::CStr long  l  )  [inline]
 

Constructs a string and initializes to a long value.

Parameters:
[in] l - long value that is converted to a string

CStr::CStr double  d  )  [inline]
 

Constructs a string and initializes to a double value.

Parameters:
[in] d - double value that is converted to string


Member Function Documentation

bool CStr::copy const char *  ptr,
unsigned long  len
[inline]
 

Copies unterminated string.

Parameters:
[in] ptr - Pointer to string
[in] len - Number of bytes to copy
Returns:
Non-zero if success
See also:

Reimplemented from TMem< char >.

bool CStr::copy const char *  ptr  )  [inline]
 

Copies NULL terminated string.

Parameters:
[in] ptr - Pointer to string buffer to copy
Returns:
Non-zero if success
See also:

LPCTSTR CStr::Set double  n,
LPCTSTR  pTemplate = "%f0.2"
 

Sets a double value into the string.

Parameters:
[in] n - double value
[in] pTemplate - conversion template for sprintf
Returns:
Pointer to converted string
See also:

char* CStr::str unsigned long  offset = 0  )  [inline]
 

Returns a pointer to the encapsulated string ofset.

Parameters:
[in] offset - Offset from start of string
Returns:
Pointer to specified byte in string
See also:

Reimplemented from TMem< char >.


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