PageRenderTime 41ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/trunk/Lib/std/std_sstream.i

#
Swig | 195 lines | 143 code | 41 blank | 11 comment | 0 complexity | 15cccbf1bd8f1867afa9db6d37520644 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. /*
  2. For wchar support, you need to include the wchar.i file
  3. before this file, ie:
  4. %include <wchar.i>
  5. %include <std_sstream.i>
  6. or equivalently, just include
  7. %include <std_wsstream.i>
  8. */
  9. %include <std_alloc.i>
  10. %include <std_basic_string.i>
  11. %include <std_string.i>
  12. %include <std_ios.i>
  13. #if defined(SWIG_WCHAR)
  14. %include <std_wstring.i>
  15. #endif
  16. %include <std_streambuf.i>
  17. %include <std_iostream.i>
  18. %{
  19. #include <sstream>
  20. %}
  21. namespace std
  22. {
  23. template<typename _CharT, typename _Traits = char_traits<_CharT>,
  24. typename _Alloc = allocator<_CharT> >
  25. class basic_stringbuf : public basic_streambuf<_CharT, _Traits>
  26. {
  27. public:
  28. // Types:
  29. typedef _CharT char_type;
  30. typedef _Traits traits_type;
  31. // 251. basic_stringbuf missing allocator_type
  32. typedef _Alloc allocator_type;
  33. typedef typename traits_type::int_type int_type;
  34. typedef typename traits_type::pos_type pos_type;
  35. typedef typename traits_type::off_type off_type;
  36. public:
  37. // Constructors:
  38. explicit
  39. basic_stringbuf(ios_base::openmode __mode = ios_base::in | ios_base::out);
  40. explicit
  41. basic_stringbuf(const basic_string<_CharT, _Traits, _Alloc>& __str,
  42. ios_base::openmode __mode = ios_base::in | ios_base::out);
  43. // Get and set:
  44. basic_string<_CharT, _Traits, _Alloc>
  45. str() const;
  46. void
  47. str(const basic_string<_CharT, _Traits, _Alloc>& __s);
  48. };
  49. // 27.7.2 Template class basic_istringstream
  50. template<typename _CharT, typename _Traits = char_traits<_CharT>,
  51. typename _Alloc = allocator<_CharT> >
  52. class basic_istringstream : public basic_istream<_CharT, _Traits>
  53. {
  54. public:
  55. // Types:
  56. typedef _CharT char_type;
  57. typedef _Traits traits_type;
  58. // 251. basic_stringbuf missing allocator_type
  59. typedef _Alloc allocator_type;
  60. typedef typename traits_type::int_type int_type;
  61. typedef typename traits_type::pos_type pos_type;
  62. typedef typename traits_type::off_type off_type;
  63. public:
  64. // Constructors:
  65. explicit
  66. basic_istringstream(ios_base::openmode __mode = ios_base::in);
  67. explicit
  68. basic_istringstream(const basic_string<_CharT, _Traits, _Alloc>& __str,
  69. ios_base::openmode __mode = ios_base::in);
  70. ~basic_istringstream();
  71. // Members:
  72. basic_stringbuf<_CharT, _Traits, _Alloc>*
  73. rdbuf() const;
  74. basic_string<_CharT, _Traits, _Alloc>
  75. str() const;
  76. void
  77. str(const basic_string<_CharT, _Traits, _Alloc>& __s);
  78. };
  79. // 27.7.3 Template class basic_ostringstream
  80. template<typename _CharT, typename _Traits = char_traits<_CharT>,
  81. typename _Alloc = allocator<_CharT> >
  82. class basic_ostringstream : public basic_ostream<_CharT, _Traits>
  83. {
  84. public:
  85. // Types:
  86. typedef _CharT char_type;
  87. typedef _Traits traits_type;
  88. // 251. basic_stringbuf missing allocator_type
  89. typedef _Alloc allocator_type;
  90. typedef typename traits_type::int_type int_type;
  91. typedef typename traits_type::pos_type pos_type;
  92. typedef typename traits_type::off_type off_type;
  93. public:
  94. // Constructors/destructor:
  95. explicit
  96. basic_ostringstream(ios_base::openmode __mode = ios_base::out);
  97. explicit
  98. basic_ostringstream(const basic_string<_CharT, _Traits, _Alloc>& __str,
  99. ios_base::openmode __mode = ios_base::out);
  100. ~basic_ostringstream();
  101. // Members:
  102. basic_stringbuf<_CharT, _Traits, _Alloc>*
  103. rdbuf() const;
  104. basic_string<_CharT, _Traits, _Alloc>
  105. str() const;
  106. #if 0
  107. void
  108. str(const basic_string<_CharT, _Traits, _Alloc>& __s);
  109. #endif
  110. };
  111. // 27.7.4 Template class basic_stringstream
  112. template<typename _CharT, typename _Traits = char_traits<_CharT>,
  113. typename _Alloc = allocator<_CharT> >
  114. class basic_stringstream : public basic_iostream<_CharT, _Traits>
  115. {
  116. public:
  117. // Types:
  118. typedef _CharT char_type;
  119. typedef _Traits traits_type;
  120. // 251. basic_stringbuf missing allocator_type
  121. typedef _Alloc allocator_type;
  122. typedef typename traits_type::int_type int_type;
  123. typedef typename traits_type::pos_type pos_type;
  124. typedef typename traits_type::off_type off_type;
  125. public:
  126. // Constructors/destructors
  127. explicit
  128. basic_stringstream(ios_base::openmode __m = ios_base::out | ios_base::in);
  129. explicit
  130. basic_stringstream(const basic_string<_CharT, _Traits, _Alloc>& __str,
  131. ios_base::openmode __m = ios_base::out | ios_base::in);
  132. ~basic_stringstream();
  133. // Members:
  134. basic_stringbuf<_CharT, _Traits, _Alloc>*
  135. rdbuf() const;
  136. basic_string<_CharT, _Traits, _Alloc>
  137. str() const;
  138. void
  139. str(const basic_string<_CharT, _Traits, _Alloc>& __s);
  140. };
  141. } // namespace std
  142. namespace std {
  143. %template(istringstream) basic_istringstream<char>;
  144. %template(ostringstream) basic_ostringstream<char>;
  145. %template(stringstream) basic_stringstream<char>;
  146. #if defined(SWIG_WCHAR)
  147. %template(wistringstream) basic_istringstream<wchar_t>;
  148. %template(wostringstream) basic_ostringstream<wchar_t>;
  149. %template(wstringstream) basic_stringstream<wchar_t>;
  150. #endif
  151. }