Home | History | Annotate | Download | only in std
      1 %include <std_char_traits.i>
      2 %include <std_basic_string.i>
      3 %include <std_except.i>
      4 %{
      5 #ifndef SWIG_STD_NOMODERN_STL
      6 # include <ios>
      7 #else
      8 # include <streambuf.h>
      9 #endif
     10 %}
     11 
     12 namespace std {
     13 
     14   template<typename _CharT, typename _Traits = char_traits<_CharT> >
     15   class basic_streambuf;
     16 
     17   template<typename _CharT, typename _Traits = char_traits<_CharT> >
     18   class basic_istream;
     19 
     20   template<typename _CharT, typename _Traits = char_traits<_CharT> >
     21   class basic_ostream;
     22 
     23   // 27.4.2  Class ios_base
     24   typedef size_t streamsize;
     25 
     26   class locale;
     27 
     28 
     29   class ios_base
     30   {
     31   public:
     32 
     33 #ifdef SWIG_NESTED_CLASSES
     34     // 27.4.2.1.1  Class ios_base::failure
     35     class failure : public exception
     36     {
     37     public:
     38       explicit failure(const string& __str) throw();
     39     };
     40 #endif
     41 
     42     // 27.4.2.1.2  Type ios_base::fmtflags
     43     typedef int fmtflags;
     44     // 27.4.2.1.2  Type fmtflags
     45     static const fmtflags boolalpha ;
     46     static const fmtflags dec ;
     47     static const fmtflags fixed ;
     48     static const fmtflags hex ;
     49     static const fmtflags internal ;
     50     static const fmtflags left ;
     51     static const fmtflags oct ;
     52     static const fmtflags right ;
     53     static const fmtflags scientific ;
     54     static const fmtflags showbase ;
     55     static const fmtflags showpoint ;
     56     static const fmtflags showpos ;
     57     static const fmtflags skipws ;
     58     static const fmtflags unitbuf ;
     59     static const fmtflags uppercase ;
     60     static const fmtflags adjustfield ;
     61     static const fmtflags basefield ;
     62     static const fmtflags floatfield ;
     63 
     64     // 27.4.2.1.3  Type ios_base::iostate
     65     typedef int iostate;
     66     static const iostate badbit ;
     67     static const iostate eofbit ;
     68     static const iostate failbit ;
     69     static const iostate goodbit ;
     70 
     71     // 27.4.2.1.4  Type openmode
     72     typedef int openmode;
     73     static const openmode app ;
     74     static const openmode ate ;
     75     static const openmode binary ;
     76     static const openmode in ;
     77     static const openmode out ;
     78     static const openmode trunc ;
     79 
     80     // 27.4.2.1.5  Type seekdir
     81     typedef int seekdir;
     82     static const seekdir beg ;
     83     static const seekdir cur ;
     84     static const seekdir end ;
     85 
     86 
     87     // Callbacks;
     88     enum event
     89       {
     90 	erase_event,
     91 	imbue_event,
     92 	copyfmt_event
     93       };
     94 
     95     typedef void (*event_callback) (event, ios_base&, int);
     96 
     97     void
     98     register_callback(event_callback __fn, int __index);
     99 
    100     // Fmtflags state:
    101     inline fmtflags
    102     flags() const ;
    103 
    104     inline fmtflags
    105     flags(fmtflags __fmtfl);
    106 
    107     inline fmtflags
    108     setf(fmtflags __fmtfl);
    109 
    110     inline fmtflags
    111     setf(fmtflags __fmtfl, fmtflags __mask);
    112 
    113     inline void
    114     unsetf(fmtflags __mask) ;
    115 
    116     inline streamsize
    117     precision() const ;
    118 
    119     inline streamsize
    120     precision(streamsize __prec);
    121 
    122     inline streamsize
    123     width() const ;
    124 
    125     inline streamsize
    126     width(streamsize __wide);
    127 
    128     static bool
    129     sync_with_stdio(bool __sync = true);
    130 
    131     // Locales:
    132     locale
    133     imbue(const locale& __loc);
    134 
    135     inline locale
    136     getloc() const { return _M_ios_locale; }
    137 
    138     // Storage:
    139     static int
    140     xalloc() throw();
    141 
    142     inline long&
    143     iword(int __ix);
    144 
    145     inline void*&
    146     pword(int __ix);
    147 
    148     // Destructor
    149     ~ios_base();
    150 
    151   protected:
    152     ios_base();
    153 
    154   //50.  Copy constructor and assignment operator of ios_base
    155   private:
    156     ios_base(const ios_base&);
    157 
    158     ios_base&
    159     operator=(const ios_base&);
    160   };
    161 
    162   template<typename _CharT, typename _Traits = char_traits<_CharT> >
    163   class basic_ios : public ios_base
    164   {
    165   public:
    166     // Types:
    167     typedef _CharT 				char_type;
    168     typedef typename _Traits::int_type 	int_type;
    169     typedef typename _Traits::pos_type 	pos_type;
    170     typedef typename _Traits::off_type 	off_type;
    171     typedef _Traits 				traits_type;
    172 
    173   public:
    174 
    175     iostate
    176     rdstate() const;
    177 
    178     void
    179     clear(iostate __state = goodbit);
    180 
    181     void
    182     setstate(iostate __state);
    183 
    184     bool
    185     good() const;
    186 
    187     bool
    188     eof() const;
    189 
    190     bool
    191     fail() const;
    192 
    193     bool
    194     bad() const;
    195 
    196     iostate
    197     exceptions() const;
    198 
    199     void
    200     exceptions(iostate __except);
    201 
    202     // Constructor/destructor:
    203     explicit
    204     basic_ios(basic_streambuf<_CharT, _Traits>* __sb) : ios_base();
    205 
    206     virtual
    207     ~basic_ios() ;
    208 
    209     // Members:
    210     basic_ostream<_CharT, _Traits>*
    211     tie() const;
    212 
    213     basic_ostream<_CharT, _Traits>*
    214     tie(basic_ostream<_CharT, _Traits>* __tiestr);
    215 
    216     basic_streambuf<_CharT, _Traits>*
    217     rdbuf() const;
    218 
    219     basic_streambuf<_CharT, _Traits>*
    220     rdbuf(basic_streambuf<_CharT, _Traits>* __sb);
    221 
    222     basic_ios&
    223     copyfmt(const basic_ios& __rhs);
    224 
    225     char_type
    226     fill() const;
    227 
    228     char_type
    229     fill(char_type __ch);
    230 
    231     // Locales:
    232     locale
    233     imbue(const locale& __loc);
    234 
    235     char
    236     narrow(char_type __c, char __dfault) const;
    237 
    238     char_type
    239     widen(char __c) const;
    240 
    241   protected:
    242     // 27.4.5.1  basic_ios constructors
    243     basic_ios();
    244   private:
    245     ios_base(const ios_base&);
    246 
    247     ios_base&
    248     operator=(const ios_base&);
    249   };
    250 
    251 }
    252 
    253 namespace std {
    254   %template(ios) basic_ios<char>;
    255 #if defined(SWIG_WCHAR)
    256   %template(wios) basic_ios<wchar_t>;
    257 #endif
    258 }
    259 
    260 
    261