CString Class Reference

#include <String.h>

Public Member Functions

 CString ()
 
 CString (const CString &cstr)
 
 ~CString ()
 
CStringoperator= (const CString &cstr)
 
 operator const char * () const
 

Detailed Description

The CString class provides access to an 8-bit String representation.

Constructor & Destructor Documentation

◆ CString() [1/2]

CString::CString ( )

Constructs a CString object with a null string value.

◆ CString() [2/2]

CString::CString ( const CString cstr)

Constructs an independent copy of a CString object.

Parameters
cstrThe CString instance to copy.

◆ ~CString()

CString::~CString ( )

Destructs a CString object.

Member Function Documentation

◆ operator const char *()

CString::operator const char * ( ) const

Gets the CString's data as a C string pointer. IMPORTANT: The returned pointer refers to memory owned by the CString object. The caller must not free this memory. The returned pointer is valid only until the CString object is destructed or reassigned. Use of this operator on a temporary CString object may result in a memory error. For example, this usage is invalid:

const char* cstr = String("Hello").getCString();
printf(cstr);
Returns
Returns a const char pointer to the CString's data.

◆ operator=()

CString& CString::operator= ( const CString cstr)

Copies the value of another CString object.

Parameters
cstrThe CString object from which to copy the value.
Returns
A reference to the target CString object with its newly assigned value.

The documentation for this class was generated from the following file:
  • /home/loongson/rpmbuild/BUILD/pegasus/src/Pegasus/Common/String.h