PageRenderTime 72ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 1ms

/tags/rel-1.3.35/Lib/std/std_ios.i

#
Swig | 260 lines | 195 code | 65 blank | 0 comment | 0 complexity | dde669581bf15b6062bc610102ab377b MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  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. namespace std {
  12. template<typename _CharT, typename _Traits = char_traits<_CharT> >
  13. class basic_streambuf;
  14. template<typename _CharT, typename _Traits = char_traits<_CharT> >
  15. class basic_istream;
  16. template<typename _CharT, typename _Traits = char_traits<_CharT> >
  17. class basic_ostream;
  18. // 27.4.2 Class ios_base
  19. typedef size_t streamsize;
  20. class locale;
  21. class ios_base
  22. {
  23. public:
  24. #ifdef SWIG_NESTED_CLASSES
  25. // 27.4.2.1.1 Class ios_base::failure
  26. class failure : public exception
  27. {
  28. public:
  29. explicit failure(const string& __str) throw();
  30. };
  31. #endif
  32. // 27.4.2.1.2 Type ios_base::fmtflags
  33. typedef int fmtflags;
  34. // 27.4.2.1.2 Type fmtflags
  35. static const fmtflags boolalpha ;
  36. static const fmtflags dec ;
  37. static const fmtflags fixed ;
  38. static const fmtflags hex ;
  39. static const fmtflags internal ;
  40. static const fmtflags left ;
  41. static const fmtflags oct ;
  42. static const fmtflags right ;
  43. static const fmtflags scientific ;
  44. static const fmtflags showbase ;
  45. static const fmtflags showpoint ;
  46. static const fmtflags showpos ;
  47. static const fmtflags skipws ;
  48. static const fmtflags unitbuf ;
  49. static const fmtflags uppercase ;
  50. static const fmtflags adjustfield ;
  51. static const fmtflags basefield ;
  52. static const fmtflags floatfield ;
  53. // 27.4.2.1.3 Type ios_base::iostate
  54. typedef int iostate;
  55. static const iostate badbit ;
  56. static const iostate eofbit ;
  57. static const iostate failbit ;
  58. static const iostate goodbit ;
  59. // 27.4.2.1.4 Type openmode
  60. typedef int openmode;
  61. static const openmode app ;
  62. static const openmode ate ;
  63. static const openmode binary ;
  64. static const openmode in ;
  65. static const openmode out ;
  66. static const openmode trunc ;
  67. // 27.4.2.1.5 Type seekdir
  68. typedef int seekdir;
  69. static const seekdir beg ;
  70. static const seekdir cur ;
  71. static const seekdir end ;
  72. // Callbacks;
  73. enum event
  74. {
  75. erase_event,
  76. imbue_event,
  77. copyfmt_event
  78. };
  79. typedef void (*event_callback) (event, ios_base&, int);
  80. void
  81. register_callback(event_callback __fn, int __index);
  82. // Fmtflags state:
  83. inline fmtflags
  84. flags() const ;
  85. inline fmtflags
  86. flags(fmtflags __fmtfl);
  87. inline fmtflags
  88. setf(fmtflags __fmtfl);
  89. inline fmtflags
  90. setf(fmtflags __fmtfl, fmtflags __mask);
  91. inline void
  92. unsetf(fmtflags __mask) ;
  93. inline streamsize
  94. precision() const ;
  95. inline streamsize
  96. precision(streamsize __prec);
  97. inline streamsize
  98. width() const ;
  99. inline streamsize
  100. width(streamsize __wide);
  101. static bool
  102. sync_with_stdio(bool __sync = true);
  103. // Locales:
  104. locale
  105. imbue(const locale& __loc);
  106. inline locale
  107. getloc() const { return _M_ios_locale; }
  108. // Storage:
  109. static int
  110. xalloc() throw();
  111. inline long&
  112. iword(int __ix);
  113. inline void*&
  114. pword(int __ix);
  115. // Destructor
  116. ~ios_base();
  117. protected:
  118. ios_base();
  119. //50. Copy constructor and assignment operator of ios_base
  120. private:
  121. ios_base(const ios_base&);
  122. ios_base&
  123. operator=(const ios_base&);
  124. };
  125. template<typename _CharT, typename _Traits = char_traits<_CharT> >
  126. class basic_ios : public ios_base
  127. {
  128. public:
  129. // Types:
  130. typedef _CharT char_type;
  131. typedef typename _Traits::int_type int_type;
  132. typedef typename _Traits::pos_type pos_type;
  133. typedef typename _Traits::off_type off_type;
  134. typedef _Traits traits_type;
  135. public:
  136. iostate
  137. rdstate() const;
  138. void
  139. clear(iostate __state = goodbit);
  140. void
  141. setstate(iostate __state);
  142. bool
  143. good() const;
  144. bool
  145. eof() const;
  146. bool
  147. fail() const;
  148. bool
  149. bad() const;
  150. iostate
  151. exceptions() const;
  152. void
  153. exceptions(iostate __except);
  154. // Constructor/destructor:
  155. explicit
  156. basic_ios(basic_streambuf<_CharT, _Traits>* __sb) : ios_base();
  157. virtual
  158. ~basic_ios() ;
  159. // Members:
  160. basic_ostream<_CharT, _Traits>*
  161. tie() const;
  162. basic_ostream<_CharT, _Traits>*
  163. tie(basic_ostream<_CharT, _Traits>* __tiestr);
  164. basic_streambuf<_CharT, _Traits>*
  165. rdbuf() const;
  166. basic_streambuf<_CharT, _Traits>*
  167. rdbuf(basic_streambuf<_CharT, _Traits>* __sb);
  168. basic_ios&
  169. copyfmt(const basic_ios& __rhs);
  170. char_type
  171. fill() const;
  172. char_type
  173. fill(char_type __ch);
  174. // Locales:
  175. locale
  176. imbue(const locale& __loc);
  177. char
  178. narrow(char_type __c, char __dfault) const;
  179. char_type
  180. widen(char __c) const;
  181. protected:
  182. // 27.4.5.1 basic_ios constructors
  183. basic_ios();
  184. private:
  185. ios_base(const ios_base&);
  186. ios_base&
  187. operator=(const ios_base&);
  188. };
  189. }
  190. namespace std {
  191. %template(ios) basic_ios<char>;
  192. #if defined(SWIG_WCHAR)
  193. %template(wios) basic_ios<wchar_t>;
  194. #endif
  195. }