◐ Shell
clean mode source ↗

std::basic_streambuf::underflow — cppreference.com

De cppreference.com

<metanoindex/>

<tbody> </tbody>

En sorte que au moins un caractère est disponible dans la zone de saisie en mettant à jour les pointeurs à la zone d'entrée (si nécessaire). Retourne la valeur de ce caractère sur le succès ou l'échec traits::eof() sur .

Original:

Ensures that at least one character is available in the input area by updating the pointers to the input area (if needed). Returns the value of that character on success or traits::eof() on failure.

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

La fonction peut mettre à jour gptr, egptr et eback pointeurs pour définir l'emplacement des données nouvellement chargées (le cas échéant). En cas d'échec, la fonction veille à ce que soit gptr() == nullptr ou gptr() == egptr .

Original:

The function may update gptr, egptr and eback pointers to define the location of newly loaded data (if any). On failure, the function ensures that either gptr() == nullptr or gptr() == egptr.

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

La version classe de base de la fonction ne fait rien. Les classes dérivées peuvent substituer cette fonction pour permettre aux mises à jour de la zone get dans le cas de l'épuisement .

Original:

The base class version of the function does nothing. The derived classes may override this function to allow updates to the get area in the case of exhaustion.

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Paramètres

(Aucun)

Original:

(none)

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Retourne la valeur

La valeur du caractère pointé par le pointeur' obtenir après l'appel en cas de succès, ou traits::eof() autrement .

Original:

The value of the character pointed to by the get pointer after the call on success, or traits::eof() otherwise.

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

La version classe de base de la fonction appelle traits::eof() .

Original:

The base class version of the function calls traits::eof().

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Note

Les fonctions publiques de std::streambuf appeler cette fonction que si gptr() == nullptr ou gptr() >= egptr() .

Original:

The public functions of std::streambuf call this function only if gptr() == nullptr or gptr() >= egptr().

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Exemple

[edit]

#include <iostream>
#include <sstream>

class null_filter_buf : public std::streambuf {
    std::streambuf* src;
    char ch; // single-byte buffer
protected:
    int underflow() {
        while( (ch= src->sbumpc()) == '\0') ; // skip zeroes
        setg(&ch, &ch, &ch+1); // make one read position available
        return ch; // may return EOF
    }
public:
    null_filter_buf(std::streambuf* buf) : src(buf) {
        setg(&ch, &ch+1, &ch+1); // buffer is initially full
    }
};

void filtered_read(std::istream& in)
{
    std::streambuf* orig = in.rdbuf();
    null_filter_buf buf(orig);
    in.rdbuf(&buf);
    for(char c; in.get(c); )
            std::cout << c;
    in.rdbuf(orig);
}

int main()
{
    char a[] = "This i\0s \0an e\0\0\0xample";
    std::istringstream in(std::string(std::begin(a), std::end(a)));
    filtered_read(in);
}

Résultat :

Voir aussi

[

virtuel

Original:

virtual

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

]

lit les caractères à partir de la séquence d'entrée associée à la zone get et avance le pointeur suivant

Original:

reads characters from the associated input sequence to the get area and advances the next pointer

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(fonction membre virtuelle protégée) [edit]

[

virtuel

Original:

virtual

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

]

écrit des caractères de la séquence de sortie associé à partir de la zone de vente

Original:

writes characters to the associated output sequence from the put area

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(fonction membre virtuelle protégée) [edit]