Standardbibliothek-Header <ios>
Von cppreference.com
Dieser Header ist Teil der Input/Output-Bibliothek.
Includes | ||
| Vorwärtsdeklarationen aller Klassen in der Ein-/Ausgabe-Bibliothek | ||
Klassen | ||
| verwaltet Formatierungsflags und Ein-/Ausgabe-Ausnahmen (Klasse) | ||
| verwaltet einen beliebigen Stream-Puffer (Klassen-Template) | ||
| std::ios | std::basic_ios<char> (typedef) | |
| std::wios | std::basic_ios<wchar_t> (typedef) | |
| repräsentiert die absolute Position in einem Stream oder einer Datei (Klassen-Template) | ||
| (C++11) |
die IO-Stream-Fehlercodes (Aufzählung) | |
| erweitert den Typ-Trait std::is_error_code_enum, um I/O-Fehlercodes zu identifizieren (Klassen-Template-Spezialisierung) | ||
| repräsentiert die relative Dateiposition (Offset von fpos), ausreichend zur Darstellung jeder Dateigröße (Typdeklaration) | ||
| repräsentiert die Anzahl der Zeichen, die bei einer E/A-Operation übertragen wurden, oder die Größe eines E/A-Puffers (typedef) | ||
Funktionen | ||
| (C++11) |
identifiziert die iostream-Fehlerkategorie (Funktion) | |
| erzeugt einen I/O-Fehlercode (Funktion) | ||
| erzeugt eine I/O-Fehlerbedingung (Funktion) | ||
| Schaltet zwischen textueller und numerischer Darstellung von Booleans um (Funktion) | ||
| Steuert, ob ein Präfix zur Anzeige der numerischen Basis verwendet wird (Funktion) | ||
| Steuert, ob der Dezimalpunkt in der Gleitkommadarstellung immer 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 jeder Operation geflusht wird (Funktion) | ||
| Legt die Platzierung von Füllzeichen fest (Funktion) | ||
| Ändert die Basis, die für die Ganzzahl-I/O verwendet wird (Funktion) | ||
| (C++11)(C++11) |
Ändert die für Gleitkomma-I/O verwendete Formatierung (Funktion) | |
[bearbeiten] Synopsis
#include <iosfwd> namespace std { using streamoff = /* implementation-defined */; using streamsize = /* implementation-defined */; template<class StateT> class fpos; class ios_base; template<class CharT, class Traits = char_traits<CharT>> class basic_ios; // manipulators 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); // adjustfield ios_base& internal (ios_base& str); ios_base& left (ios_base& str); ios_base& right (ios_base& str); // basefield ios_base& dec (ios_base& str); ios_base& hex (ios_base& str); ios_base& oct (ios_base& str); // floatfield ios_base& fixed (ios_base& str); ios_base& scientific (ios_base& str); ios_base& hexfloat (ios_base& str); ios_base& defaultfloat(ios_base& str); // error reporting 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; }
[bearbeiten] Klasse std::ios_base
namespace std { class ios_base { public: class failure; // see description // fmtflags using fmtflags = /*bitmask-type-1*/; static constexpr fmtflags boolalpha = /* unspecified */; static constexpr fmtflags dec = /* unspecified */; static constexpr fmtflags fixed = /* unspecified */; static constexpr fmtflags hex = /* unspecified */; static constexpr fmtflags internal = /* unspecified */; static constexpr fmtflags left = /* unspecified */; static constexpr fmtflags oct = /* unspecified */; static constexpr fmtflags right = /* unspecified */; static constexpr fmtflags scientific = /* unspecified */; static constexpr fmtflags showbase = /* unspecified */; static constexpr fmtflags showpoint = /* unspecified */; static constexpr fmtflags showpos = /* unspecified */; static constexpr fmtflags skipws = /* unspecified */; static constexpr fmtflags unitbuf = /* unspecified */; static constexpr fmtflags uppercase = /* unspecified */; static constexpr fmtflags adjustfield = /* see description */; static constexpr fmtflags basefield = /* see description */; static constexpr fmtflags floatfield = /* see description */; // iostate using iostate = /*bitmask-type-2*/; static constexpr iostate badbit = /* unspecified */; static constexpr iostate eofbit = /* unspecified */; static constexpr iostate failbit = /* unspecified */; static constexpr iostate goodbit = /* see description */; // openmode using openmode = /*bitmask-type-3*/; static constexpr openmode app = /* unspecified */; static constexpr openmode ate = /* unspecified */; static constexpr openmode binary = /* unspecified */; static constexpr openmode in = /* unspecified */; static constexpr openmode out = /* unspecified */; static constexpr openmode trunc = /* unspecified */; static constexpr openmode noreplace = /* unspecified */ // seekdir using seekdir = /*bitmask-type-4*/; static constexpr seekdir beg = /* unspecified */; static constexpr seekdir cur = /* unspecified */; static constexpr seekdir end = /* unspecified */; class Init; // fmtflags state 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; // storage static int xalloc(); long& iword(int idx); void*& pword(int idx); // destructor 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 }; }
[bearbeiten] 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); }; }
[bearbeiten] 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; // exposition only }; }
[bearbeiten] Klassentemplate std::fpos
namespace std { template<class StateT> class fpos { public: // members StateT state() const; void state(stateT); private; StateT st; // exposition only }; }
[bearbeiten] 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; // flags functions 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); // constructor/destructor explicit basic_ios(basic_streambuf<CharT, Traits>* sb); virtual ~basic_ios(); // members 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); }; }
[bearbeiten] Defect reports
Die folgenden Verhaltensändernden Fehlerberichte wurden rückwirkend auf zuvor veröffentlichte C++-Standards angewendet.
| DR | angewendet auf | Verhalten wie veröffentlicht | Korrigiertes Verhalten |
|---|---|---|---|
| LWG 35 | C++98 | die Prototypen von unitbuf und nounitbuf fehlten in der Synopsis | hinzugefügt |
| LWG 78 | C++98 | der Typ des Parameters fn von ios_base::register_callback in der Synopsis war falsch spezifiziert als event_call_back |
korrigiert zuevent_callback
|