Namespaces
Variants

Standard library header <ios>

From cppreference.net
Standard library headers

이 헤더는 Input/Output 라이브러리의 일부입니다.

목차

Includes

입출력 라이브러리의 모든 클래스에 대한 전방 선언

클래스

서식 플래그와 입출력 예외를 관리합니다
(클래스)
임의의 스트림 버퍼를 관리합니다
(클래스 템플릿)
std::ios std:: basic_ios < char > (typedef)
std::wios std:: basic_ios < wchar_t > (typedef)
스트림 또는 파일 내의 절대적 위치를 나타냄
(클래스 템플릿)
(C++11)
IO 스트림 오류 코드
(열거형)
타입 특성 std::is_error_code_enum 을 확장하여 입출력 스트림 오류 코드를 식별합니다
(클래스 템플릿 특수화)
파일/스트림의 상대적 위치(fpos로부터의 오프셋)를 나타내며, 모든 파일 크기를 표현하기에 충분함
(typedef)
I/O 작업에서 전송된 문자 수 또는 I/O 버퍼의 크기를 나타냅니다
(typedef)

함수

iostream 오류 카테고리를 식별합니다
(함수)
iostream 에러 코드를 생성합니다
(함수)
iostream 오류 조건을 생성합니다
(함수)
부울 값의 텍스트 표현과 숫자 표현 간 전환
(함수)
숫자 진법을 나타내기 위한 접두사 사용 여부를 제어합니다
(function)
부동소수점 표현에서 소수점을 항상 포함할지 여부를 제어합니다
(function)
음수가 아닌 숫자와 함께 사용되는 + 부호 표시 여부를 제어합니다
(function)
입력 시 선행 공백 문자를 건너뛸지 여부를 제어합니다
(function)
일부 출력 형식에서 대문자 사용 여부를 제어합니다
(function)
각 작업 후 출력이 플러시되는지 여부를 제어합니다
(함수)
채움 문자 배치를 설정합니다
(함수)
정수 입출력에 사용되는 진법을 변경합니다
(함수)
부동 소수점 입출력에 사용되는 서식을 변경합니다
(함수)

시놉시스

#include <iosfwd>
namespace std {
  using streamoff  = /* 구현 정의 */;
  using streamsize = /* 구현 정의 */;
  template<class StateT> class fpos;
  class ios_base;
  template<class CharT, class Traits = char_traits<CharT>>
    class basic_ios;
  // 조작자
  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);
  // 조정 필드
  ios_base& internal   (ios_base& str);
  ios_base& left       (ios_base& str);
  ios_base& right      (ios_base& str);
  // 진법 필드
  ios_base& dec        (ios_base& str);
  ios_base& hex        (ios_base& str);
  ios_base& oct        (ios_base& str);
  // 부동소수점 필드
  ios_base& fixed      (ios_base& str);
  ios_base& scientific (ios_base& str);
  ios_base& hexfloat   (ios_base& str);
  ios_base& defaultfloat(ios_base& str);
  // 오류 보고
  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;
}

클래스 std::ios_base

namespace std {
  class ios_base {
  public:
    class failure;              // 설명 참조
    // fmtflags
    using fmtflags = /*비트마스크-타입-1*/;
    static constexpr fmtflags boolalpha = /* 미지정 */;
    static constexpr fmtflags dec = /* 미지정 */;
    static constexpr fmtflags fixed = /* 미지정 */;
    static constexpr fmtflags hex = /* 미지정 */;
    static constexpr fmtflags internal = /* 미지정 */;
    static constexpr fmtflags left = /* 미지정 */;
    static constexpr fmtflags oct = /* 미지정 */;
    static constexpr fmtflags right = /* 미지정 */;
    static constexpr fmtflags scientific = /* 미지정 */;
    static constexpr fmtflags showbase = /* 지정되지 않음 */;
    static constexpr fmtflags showpoint = /* 미지정 */;
    static constexpr fmtflags showpos = /* 미지정 */;
    static constexpr fmtflags skipws = /* 미지정 */;
    static constexpr fmtflags unitbuf = /* 미지정 */;
    static constexpr fmtflags uppercase = /* 지정되지 않음 */;
    static constexpr fmtflags adjustfield = /* 설명 참조 */;
    static constexpr fmtflags basefield = /* 설명 참조 */;
    static constexpr fmtflags floatfield = /* 설명 참조 */;
    // iostate
    using iostate = /*비트마스크 타입 2*/;
    static constexpr iostate badbit = /* 미지정 */;
    static constexpr iostate eofbit = /* 미지정 */;
    static constexpr iostate failbit = /* 미지정 */;
    static constexpr iostate goodbit = /* 설명 참조 */;
    // openmode
    using openmode = /*비트마스크 타입 3*/;
    static constexpr openmode app = /* 미지정 */;
    static constexpr openmode ate = /* 지정되지 않음 */;
    static constexpr openmode binary = /* 미지정 */;
    static constexpr openmode in = /* 미지정 */;
    static constexpr openmode out = /* 미지정 */;
    static constexpr openmode trunc = /* 미지정 */;
    static constexpr openmode noreplace = /* 미지정 */
    // seekdir
    using seekdir = /*비트마스크-타입-4*/;
    static constexpr seekdir beg = /* 미지정 */;
    static constexpr seekdir cur = /* 미지정 */;
    static constexpr seekdir end = /* 미지정 */;
    class Init;
    // fmtflags 상태
    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;
    // 저장소
    static int xalloc();
    long&  iword(int idx);
    void*& pword(int idx);
    // 소멸자
    virtual ~ios_base();
    // 콜백
    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;           // 설명 전용
    long*  iarray;              // 설명 전용
    void** parray;              // 설명 전용
  };
}

클래스 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);
  };
}

클래스 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;        // 설명용으로만 사용
  };
}

클래스 템플릿 std::fpos

namespace std {
  template<class StateT> class fpos {
  public:
    // 멤버들
    StateT state() const;
    void state(stateT);
  private;
    StateT st;                  // 설명 전용
  };
}

클래스 템플릿 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;
    // 플래그 함수들
    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);
    // 생성자/소멸자
    explicit basic_ios(basic_streambuf<CharT, Traits>* sb);
    virtual ~basic_ios();
    // 멤버 함수들
    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);
  };
}

결함 보고서

다음의 동작 변경 결함 보고서들은 이전에 발표된 C++ 표준에 소급 적용되었습니다.

DR 적용 대상 게시된 동작 올바른 동작
LWG 35 C++98 unitbuf nounitbuf 의 프로토타입이 개요에서 누락됨 추가됨
LWG 78 C++98 ios_base::register_callback fn 매개변수 타입이 개요에서 event_call_back 으로 잘못 지정됨 event_callback (으)로 수정됨