strstreambuf::strstreambuf
Crea un oggetto di tipo strstreambuf.
explicit strstreambuf(
streamsize _Count = 0
);
strstreambuf(
void ( *_Allocfunc )( size_t ),
void ( *_Freefunc )( void * )
);
strstreambuf(
char *_Getptr,
streamsize _Count,
char *_Putptr = 0
);
strstreambuf(
signed char *_Getptr,
streamsize _Count,
signed char *_Putptr = 0
);
strstreambuf(
unsigned char *_Getptr,
streamsize _Count,
unsigned char *_Putptr = 0
);
strstreambuf(
const char *_Getptr,
streamsize _Count
);
strstreambuf(
const signed char *_Getptr,
streamsize _Count
);
strstreambuf(
const unsigned char *_Getptr,
streamsize _Count
);
Parametri
_Allocfunc
La funzione utilizzata per allocare memoria di transito._Count
Determina la lunghezza del buffer puntato da _Getptr. Se _Getptr non è un argomento (primo form del costruttore, una dimensione suggerita di allocazione per i buffer._Freefunc
La funzione utilizzata per liberare memoria in transito._Getptr
Un buffer utilizzato per input._Putptr
Un buffer utilizzato per l'output.
Note
Il primo include un puntatore null in tutti i puntatori che controllano il buffer di input, il buffer di output e l'allocazione di strstreambuf. Imposta la modalità memorizzata di strstreambuf per rendere la sequenza selezionata modificabile e allungabile. Accetta anche _Count come una dimensione iniziale suggerita di allocazione.
Il secondo costruttore si comporta come primo, con la differenza che memorizza _Allocfunc quando il puntatore alla funzione da chiamare per allocare l'archiviazione e _Freefunc quando il puntatore alla funzione da chiamare per liberare l'archiviazione.
I tre costruttori:
strstreambuf(char *_Getptr, streamsize count,
char *putptr = 0);
strstreambuf(signed char *_Getptr, streamsize count,
signed char *putptr = 0);
strstreambuf(unsigned char *_Getptr, streamsize count,
unsigned char *putptr = 0);
si comporti come primo, con la differenza che _Getptr definisce l'oggetto array utilizzato per utilizzare la sequenza selezionata. (Pertanto, non deve essere un puntatore null.) Il numero di N elementi della matrice è determinato come segue:
Se_Count > (0), quindi N è count.
Se (_Count == 0), allora N è strlen( (const char *)_Getptr ).
Se_Count < (0), quindi N è INT_MAX.
Se _Putptr è un puntatore null, la funzione imposta un solo buffer di input esecuzione:
setg(_Getptr, _Getptr, _Getptr + N);
In caso contrario, stabilisce venga introdotta che buffer di output esecuzione:
setg(_Getptr, _Getptr, _Putptr);
setp(_Putptr, _Getptr + N);
In questo caso, _Putptr deve trovarsi nell'intervallo [_Getptr, _Getptr + N].
Infine, i tre costruttori:
strstreambuf(const char *_Getptr, streamsize _Count);
strstreambuf(const signed char *_Getptr, streamsize _Count);
strstreambuf(const unsigned char *_Getptr, streamsize _Count);
si comportino tutti allo stesso modo di:
streambuf( (char *)_Getptr, _Count );
con la differenza che la modalità memorizzata rende la sequenza selezionata né modificabile né allungabile.
Requisiti
strstream <diIntestazione: >
Spazio dei nomi: std