Condividi tramite


CHString::operator+

[La classe CHString fa parte di WMI Provider Framework che è ora considerata nello stato finale e non saranno disponibili ulteriori aggiornamenti, miglioramenti o aggiornamenti per problemi non correlati alla sicurezza che interessano queste librerie. Le API MI devono essere usate per tutti i nuovi sviluppi.

L'operatore + concatenazione aggiunge due stringhe e restituisce un oggetto CHString .

friend CHString operator +(
  const CHString& str1,
  const CHString& str2 )
throw( CHeap_Exception );

friend CHString operator +(
  const CHString& str,
  WCHAR ch )
throw( CHeap_Exception );

friend CHString operator +(
  WCHAR ch,
  const CHString& str )
throw( CHeap_Exception );

friend CHString operator +(
  const CHString& str,
  LPCWSTR lpsz )
throw( CHeap_Exception );

friend CHString operator +(
  LPCWSTR lpsz,
  const CHString& str )
throw( CHeap_Exception );

friend CHString operator +(
  const CHString& str,
  char ch )
throw( CHeap_Exception );

friend CHString operator +(
  char ch,
  const CHString& str )
throw( CHeap_Exception );

Parametri

str, str1, str2

Stringhe CHString concatenate.

Ch

Carattere concatenato a una stringa o a una stringa concatenata a un carattere.

lpsz

Puntatore a una stringa di caratteri con terminazione NULL.

Valori restituiti

Questo operatore di concatenazione restituisce un oggetto CHString che rappresenta il risultato temporaneo della concatenazione. Questo valore restituito consente di combinare diverse concatenazioni nella stessa espressione.

Commenti

Una delle due stringhe di argomenti deve essere un oggetto CHString ; l'altro può essere un puntatore a caratteri o un carattere. Tenere presente che le eccezioni di memoria possono verificarsi ogni volta che si usa l'operatore di concatenazione perché la nuova risorsa di archiviazione può essere allocata per contenere dati temporanei.

Esempio

Nell'esempio di codice seguente viene illustrato l'uso di CHString::operator +:

CHString s1( L"abc" );
CHString s2( L"def" );
assert( (s1 + s2 ) == L"abcdef" );

CHString s3;
s3 = CHString( L"abc" ) + "def" ; // Correct
s3 = "abc" + "def"; // Wrong. The first argument must be a CHString.

Requisiti

Requisito Valore
Client minimo supportato
Windows Vista
Server minimo supportato
Windows Server 2008
Intestazione
ChString.h (include FwCommon.h)
Libreria
FrameDyn.lib
DLL
FrameDynOS.dll;
FrameDyn.dll

Vedi anche

CHString