Standard library header <ios>
From cppreference.net
Dieser Header ist Teil der Input/Output -Bibliothek.
Includes |
||
| Vorwärtsdeklarationen aller Klassen der Eingabe-/Ausgabebibliothek | ||
Klassen |
||
|
verwaltet Formatierungsflags und Eingabe-/Ausgabeausnahmen
(Klasse) |
||
|
verwaltet einen beliebigen Streampuffer
(Klassentemplate) |
||
| std::ios | std:: basic_ios < char > (Typedef) | |
| std::wios | std:: basic_ios < wchar_t > (Typedef) | |
|
repräsentiert eine absolute Position in einem Stream oder einer Datei
(Klassentemplate) |
||
|
(C++11)
|
die IO-Stream-Fehlercodes
(enum) |
|
|
erweitert den Typ-Trait
std::is_error_code_enum
zur Identifizierung von iostream-Fehlercodes
(Klassen-Template-Spezialisierung) |
||
|
repräsentiert relative Datei-/Stream-Position (Offset von fpos), ausreichend um jede Dateigröße darzustellen
(typedef) |
||
|
repräsentiert die Anzahl der übertragenen Zeichen in einem I/O-Vorgang oder die Größe eines I/O-Puffers
(typedef) |
||
Funktionen |
||
|
(C++11)
|
identifiziert die iostream-Fehlercategory
(Funktion) |
|
|
(C++11)
|
konstruiert einen iostream-Fehlercode
(Funktion) |
|
|
Konstruiert eine iostream-Fehlermeldung
(Funktion) |
||
|
schaltet zwischen textueller und numerischer Darstellung von Booleschen Werten um
(Funktion) |
||
|
steuert, ob Präfix zur Angabe der numerischen Basis verwendet wird
(Funktion) |
||
|
steuert, ob der Dezimalpunkt immer in der Gleitkommadarstellung enthalten ist
(Funktion) |
||
steuert, ob das
+
Zeichen bei nicht-negativen Zahlen verwendet wird
(Funktion) |
||
|
steuert, ob führende Leerzeichen bei der Eingabe übersprungen werden
(Funktion) |
||
|
steuert, ob Großbuchstaben bei einigen Ausgabeformaten verwendet werden
(Funktion) |
||
|
steuert, ob die Ausgabe nach jedem Vorgang geleert wird
(Funktion) |
||
|
legt die Position von Füllzeichen fest
(Funktion) |
||
|
ändert die Basis für Ganzzahl-Ein-/Ausgabe
(Funktion) |
||
|
(C++11)
(C++11)
|
ändert die Formatierung für Gleitkomma-Ein-/Ausgabe
(Funktion) |
|
Übersicht
#include <iosfwd> namespace std { using streamoff = /* implementierungsdefiniert */; using streamsize = /* implementierungsdefiniert */; template<class StateT> class fpos; class ios_base; template<class CharT, class Traits = char_traits<CharT>> class basic_ios; // Manipulatoren ios_base& boolalpha (ios_base& str); ios_base& noboolalpha(ios_base& str); ios_base& showbase (ios_base& str); ios_base& noshowbase (ios_base& str); ios_base& showpoint (ios_base& str); ios_base& noshowpoint(ios_base& str); ios_base& showpos (ios_base& str); ios_base& noshowpos (ios_base& str); ios_base& skipws (ios_base& str); ios_base& noskipws (ios_base& str); ios_base& uppercase (ios_base& str); ios_base& nouppercase(ios_base& str); ios_base& unitbuf (ios_base& str); ios_base& nounitbuf (ios_base& str); // Anpassungsfeld ios_base& internal (ios_base& str); ios_base& left (ios_base& str); ios_base& right (ios_base& str); // Basis-Feld ios_base& dec (ios_base& str); ios_base& hex (ios_base& str); ios_base& oct (ios_base& str); // Gleitkomma-Feld ios_base& fixed (ios_base& str); ios_base& scientific (ios_base& str); ios_base& hexfloat (ios_base& str); ios_base& defaultfloat(ios_base& str); // Fehlerberichterstattung enum class io_errc { stream = 1 }; template<> struct is_error_code_enum<io_errc> : public true_type { }; error_code make_error_code(io_errc e) noexcept; error_condition make_error_condition(io_errc e) noexcept; const error_category& iostream_category() noexcept; }
Klasse std::ios_base
namespace std { class ios_base { public: class failure; // siehe Beschreibung // fmtflags using fmtflags = /*Bitmask-Typ-1*/; static constexpr fmtflags boolalpha = /* nicht spezifiziert */; static constexpr fmtflags dec = /* nicht spezifiziert */; static constexpr fmtflags fixed = /* nicht spezifiziert */; static constexpr fmtflags hex = /* nicht spezifiziert */; static constexpr fmtflags internal = /* nicht spezifiziert */; static constexpr fmtflags left = /* nicht spezifiziert */; static constexpr fmtflags oct = /* nicht spezifiziert */; static constexpr fmtflags right = /* nicht spezifiziert */; static constexpr fmtflags scientific = /* nicht spezifiziert */; static constexpr fmtflags showbase = /* nicht spezifiziert */; static constexpr fmtflags showpoint = /* nicht spezifiziert */; static constexpr fmtflags showpos = /* nicht spezifiziert */; static constexpr fmtflags skipws = /* nicht spezifiziert */; static constexpr fmtflags unitbuf = /* nicht spezifiziert */; static constexpr fmtflags uppercase = /* nicht spezifiziert */; static constexpr fmtflags adjustfield = /* siehe Beschreibung */; static constexpr fmtflags basefield = /* siehe Beschreibung */; static constexpr fmtflags floatfield = /* siehe Beschreibung */; // iostate using iostate = /*Bitmask-Typ-2*/; static constexpr iostate badbit = /* nicht spezifiziert */; static constexpr iostate eofbit = /* nicht spezifiziert */; static constexpr iostate failbit = /* nicht spezifiziert */; static constexpr iostate goodbit = /* siehe Beschreibung */; // openmode using openmode = /*Bitmask-Typ-3*/; static constexpr openmode app = /* nicht spezifiziert */; static constexpr openmode ate = /* nicht spezifiziert */; static constexpr openmode binary = /* nicht spezifiziert */; static constexpr openmode in = /* nicht spezifiziert */; static constexpr openmode out = /* nicht spezifiziert */; static constexpr openmode trunc = /* nicht spezifiziert */; static constexpr openmode noreplace = /* nicht spezifiziert */ // seekdir using seekdir = /*Bitmask-Typ-4*/; static constexpr seekdir beg = /* nicht spezifiziert */; static constexpr seekdir cur = /* nicht spezifiziert */; static constexpr seekdir end = /* nicht spezifiziert */; class Init; // fmtflags Status fmtflags flags() const; fmtflags flags(fmtflags fmtfl); fmtflags setf(fmtflags fmtfl); fmtflags setf(fmtflags fmtfl, fmtflags mask); void unsetf(fmtflags mask); streamsize precision() const; streamsize precision(streamsize prec); streamsize width() const; streamsize width(streamsize wide); // Locales locale imbue(const locale& loc); locale getloc() const; // Speicher static int xalloc(); long& iword(int idx); void*& pword(int idx); // Destruktor virtual ~ios_base(); // Callbacks enum event { erase_event, imbue_event, copyfmt_event }; using event_callback = void (*)(event, ios_base&, int idx); void register_callback(event_callback fn, int idx); ios_base(const ios_base&) = delete; ios_base& operator=(const ios_base&) = delete; static bool sync_with_stdio(bool sync = true); protected: ios_base(); private: static int index; // exposition only long* iarray; // exposition only void** parray; // exposition only }; }
Klasse std::ios_base::failure
namespace std { class ios_base::failure : public system_error { public: explicit failure(const string& msg, const error_code& ec = io_errc::stream); explicit failure(const char* msg, const error_code& ec = io_errc::stream); }; }
Klasse std::ios_base::Init
namespace std { class ios_base::Init { public: Init(); Init(const Init&) = default; ~Init(); Init& operator=(const Init&) = default; private: static int init_cnt; // nur zur Darstellung }; }
Klassentemplate std::fpos
namespace std { template<class StateT> class fpos { public: // Mitglieder StateT state() const; void state(stateT); private; StateT st; // nur zur Darstellung }; }
Klassentemplate std::basic_ios
namespace std { template<class CharT, class Traits = char_traits<CharT>> class basic_ios : public ios_base { public: using char_type = CharT; using int_type = typename Traits::int_type; using pos_type = typename Traits::pos_type; using off_type = typename Traits::off_type; using traits_type = Traits; // Flag-Funktionen explicit operator bool() const; bool operator!() const; iostate rdstate() const; void clear(iostate state = goodbit); void setstate(iostate state); bool good() const; bool eof() const; bool fail() const; bool bad() const; iostate exceptions() const; void exceptions(iostate except); // Konstruktor/Destruktor explicit basic_ios(basic_streambuf<CharT, Traits>* sb); virtual ~basic_ios(); // Member basic_ostream<CharT, Traits>* tie() const; basic_ostream<CharT, Traits>* tie(basic_ostream<CharT, Traits>* tiestr); basic_streambuf<CharT, Traits>* rdbuf() const; basic_streambuf<CharT, Traits>* rdbuf(basic_streambuf<CharT, Traits>* sb); basic_ios& copyfmt(const basic_ios& rhs); char_type fill() const; char_type fill(char_type ch); locale imbue(const locale& loc); char narrow(char_type c, char dfault) const; char_type widen(char c) const; basic_ios(const basic_ios&) = delete; basic_ios& operator=(const basic_ios&) = delete; protected: basic_ios(); void init(basic_streambuf<CharT, Traits>* sb); void move(basic_ios& rhs); void move(basic_ios&& rhs); void swap(basic_ios& rhs) noexcept; void set_rdbuf(basic_streambuf<CharT, Traits>* sb); }; }
Fehlerberichte
Die folgenden verhaltensändernden Fehlerberichte wurden rückwirkend auf zuvor veröffentlichte C++-Standards angewendet.
| DR | Angewendet auf | Verhalten wie veröffentlicht | Korrektes Verhalten |
|---|---|---|---|
| LWG 35 | C++98 | die Prototypen von unitbuf und nounitbuf fehlten in der Synopse | hinzugefügt |
| LWG 78 | C++98 |
der Typ des Parameters
fn
von
ios_base::register_callback
in der Synopse war falsch angegeben als
event_call_back
|
korrigiert zu
event_callback
|