isolate language independent STD/STL/C++ code + more documentation + cleaning
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6382 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
0f6ae6977d
commit
dc4409a1f1
50 changed files with 3502 additions and 3408 deletions
|
|
@ -1,334 +1,8 @@
|
|||
%include <std_ios.i>
|
||||
%include <std_string.i>
|
||||
%include <std_wstring.i>
|
||||
|
||||
%{
|
||||
#include <iostream>
|
||||
%}
|
||||
|
||||
namespace std
|
||||
{
|
||||
// 27.6.2.1 Template class basic_ostream
|
||||
template<typename _CharT, typename _Traits>
|
||||
class basic_ostream : virtual public basic_ios<_CharT, _Traits>
|
||||
{
|
||||
public:
|
||||
// Types (inherited from basic_ios (27.4.4)):
|
||||
typedef _CharT char_type;
|
||||
typedef typename _Traits::int_type int_type;
|
||||
typedef typename _Traits::pos_type pos_type;
|
||||
typedef typename _Traits::off_type off_type;
|
||||
typedef _Traits traits_type;
|
||||
|
||||
// 27.6.2.2 Constructor/destructor:
|
||||
explicit
|
||||
basic_ostream(basic_streambuf<_CharT, _Traits>* __sb);
|
||||
|
||||
virtual
|
||||
~basic_ostream();
|
||||
|
||||
|
||||
|
||||
// 27.6.2.5 Formatted output:
|
||||
// 27.6.2.5.3 basic_ostream::operator<<
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& (*__pf)(basic_ostream<_CharT, _Traits>&));
|
||||
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ios<_CharT, _Traits>& (*__pf)(basic_ios<_CharT, _Traits>&));
|
||||
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(ios_base& (*__pf) (ios_base&));
|
||||
|
||||
// 27.6.2.5.2 Arithmetic Inserters
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(long __n);
|
||||
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(unsigned long __n);
|
||||
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(bool __n);
|
||||
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(short __n);
|
||||
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(unsigned short __n);
|
||||
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(int __n);
|
||||
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(unsigned int __n);
|
||||
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(long long __n);
|
||||
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(unsigned long long __n);
|
||||
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(double __f);
|
||||
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(float __f);
|
||||
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(long double __f);
|
||||
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(const void* __p);
|
||||
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_streambuf<_CharT, _Traits>* __sb);
|
||||
|
||||
// Unformatted output:
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
put(char_type __c);
|
||||
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
write(const char_type* __s, streamsize __n);
|
||||
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
flush();
|
||||
|
||||
// Seeks:
|
||||
pos_type
|
||||
tellp();
|
||||
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
seekp(pos_type);
|
||||
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
seekp(off_type, ios_base::seekdir);
|
||||
|
||||
%extend {
|
||||
std::basic_ostream<_CharT, _Traits>&
|
||||
operator<<(const std::basic_string<_CharT>& s)
|
||||
{
|
||||
*self << s;
|
||||
return *self;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// 27.6.1.1 Template class basic_istream
|
||||
template<typename _CharT, typename _Traits>
|
||||
class basic_istream : virtual public basic_ios<_CharT, _Traits>
|
||||
{
|
||||
public:
|
||||
// Types (inherited from basic_ios (27.4.4)):
|
||||
typedef _CharT char_type;
|
||||
typedef typename _Traits::int_type int_type;
|
||||
typedef typename _Traits::pos_type pos_type;
|
||||
typedef typename _Traits::off_type off_type;
|
||||
typedef _Traits traits_type;
|
||||
|
||||
|
||||
public:
|
||||
// 27.6.1.1.1 Constructor/destructor:
|
||||
explicit
|
||||
basic_istream(basic_streambuf<_CharT, _Traits>* __sb);
|
||||
|
||||
virtual
|
||||
~basic_istream();
|
||||
|
||||
// 27.6.1.2.2 Arithmetic Extractors
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(bool& __n);
|
||||
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(short& __n);
|
||||
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(unsigned short& __n);
|
||||
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(int& __n);
|
||||
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(unsigned int& __n);
|
||||
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(long& __n);
|
||||
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(unsigned long& __n);
|
||||
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(long long& __n);
|
||||
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(unsigned long long& __n);
|
||||
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(float& __f);
|
||||
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(double& __f);
|
||||
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(long double& __f);
|
||||
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(void*& __p);
|
||||
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(basic_streambuf<_CharT, _Traits>* __sb);
|
||||
|
||||
// 27.6.1.3 Unformatted input:
|
||||
inline streamsize
|
||||
gcount(void) const;
|
||||
|
||||
int_type
|
||||
get(void);
|
||||
|
||||
basic_istream<_CharT, _Traits>&
|
||||
get(char_type& __c);
|
||||
|
||||
basic_istream<_CharT, _Traits>&
|
||||
get(char_type* __s, streamsize __n, char_type __delim);
|
||||
|
||||
inline basic_istream<_CharT, _Traits>&
|
||||
get(char_type* __s, streamsize __n);
|
||||
|
||||
basic_istream<_CharT, _Traits>&
|
||||
get(basic_streambuf<_CharT, _Traits>& __sb, char_type __delim);
|
||||
|
||||
inline basic_istream<_CharT, _Traits>&
|
||||
get(basic_streambuf<_CharT, _Traits>& __sb);
|
||||
|
||||
basic_istream<_CharT, _Traits>&
|
||||
getline(char_type* __s, streamsize __n, char_type __delim);
|
||||
|
||||
inline basic_istream<_CharT, _Traits>&
|
||||
getline(char_type* __s, streamsize __n);
|
||||
|
||||
basic_istream<_CharT, _Traits>&
|
||||
ignore(streamsize __n = 1, int_type __delim = _Traits::eof());
|
||||
|
||||
int_type
|
||||
peek(void);
|
||||
|
||||
basic_istream<_CharT, _Traits>&
|
||||
read(char_type* __s, streamsize __n);
|
||||
|
||||
streamsize
|
||||
readsome(char_type* __s, streamsize __n);
|
||||
|
||||
basic_istream<_CharT, _Traits>&
|
||||
putback(char_type __c);
|
||||
|
||||
basic_istream<_CharT, _Traits>&
|
||||
unget(void);
|
||||
|
||||
int
|
||||
sync(void);
|
||||
|
||||
pos_type
|
||||
tellg(void);
|
||||
|
||||
basic_istream<_CharT, _Traits>&
|
||||
seekg(pos_type);
|
||||
|
||||
basic_istream<_CharT, _Traits>&
|
||||
seekg(off_type, ios_base::seekdir);
|
||||
};
|
||||
|
||||
// 27.6.1.5 Template class basic_iostream
|
||||
template<typename _CharT, typename _Traits>
|
||||
class basic_iostream
|
||||
: public basic_istream<_CharT, _Traits>,
|
||||
public basic_ostream<_CharT, _Traits>
|
||||
{
|
||||
public:
|
||||
typedef _CharT char_type;
|
||||
typedef typename _Traits::int_type int_type;
|
||||
typedef typename _Traits::pos_type pos_type;
|
||||
typedef typename _Traits::off_type off_type;
|
||||
typedef _Traits traits_type;
|
||||
|
||||
explicit
|
||||
basic_iostream(basic_streambuf<_CharT, _Traits>* __sb);
|
||||
|
||||
virtual
|
||||
~basic_iostream();
|
||||
};
|
||||
|
||||
%pythoncallback(1) endl;
|
||||
%pythoncallback(1) ends;
|
||||
%pythoncallback(1) flush;
|
||||
}
|
||||
|
||||
namespace std {
|
||||
|
||||
typedef basic_ostream<char, std::char_traits<char> > ostream ;
|
||||
typedef basic_istream<char, std::char_traits<char> > istream;
|
||||
typedef basic_iostream<char, std::char_traits<char> > iostream;
|
||||
|
||||
typedef basic_ostream<wchar_t, std::char_traits<wchar_t> > wostream;
|
||||
typedef basic_istream<wchar_t, std::char_traits<wchar_t> > wistream;
|
||||
typedef basic_iostream<wchar_t, std::char_traits<wchar_t> > wiostream;
|
||||
}
|
||||
|
||||
|
||||
namespace std {
|
||||
%template(ostream) basic_ostream<char, std::char_traits<char> >;
|
||||
%template(istream) basic_istream<char, std::char_traits<char> >;
|
||||
%template(iostream) basic_iostream<char, std::char_traits<char> >;
|
||||
|
||||
%template(wostream) basic_ostream<wchar_t, std::char_traits<wchar_t> >;
|
||||
%template(wistream) basic_istream<wchar_t, std::char_traits<wchar_t> >;
|
||||
%template(wiostream) basic_iostream<wchar_t, std::char_traits<wchar_t> >;
|
||||
}
|
||||
|
||||
namespace std
|
||||
{
|
||||
%feature("immutable") cin;
|
||||
%feature("immutable") cout;
|
||||
%feature("immutable") cerr;
|
||||
%feature("immutable") clog;
|
||||
|
||||
%feature("immutable") wcin;
|
||||
%feature("immutable") wcout;
|
||||
%feature("immutable") wcerr;
|
||||
%feature("immutable") wclog;
|
||||
}
|
||||
|
||||
namespace std
|
||||
{
|
||||
extern std::istream cin;
|
||||
extern std::ostream cout;
|
||||
extern std::ostream cerr;
|
||||
extern std::ostream clog;
|
||||
|
||||
extern std::wistream wcin;
|
||||
extern std::wostream wcout;
|
||||
extern std::wostream wcerr;
|
||||
extern std::wostream wclog;
|
||||
|
||||
template<typename _CharT, typename _Traits>
|
||||
std::basic_ostream<_CharT, _Traits>&
|
||||
endl(std::basic_ostream<_CharT, _Traits>&);
|
||||
|
||||
template<typename _CharT, typename _Traits>
|
||||
std::basic_ostream<_CharT, _Traits>&
|
||||
ends(std::basic_ostream<_CharT, _Traits>&);
|
||||
|
||||
template<typename _CharT, typename _Traits>
|
||||
std::basic_ostream<_CharT, _Traits>&
|
||||
flush(std::basic_ostream<_CharT, _Traits>&);
|
||||
|
||||
%pythoncallback(1);
|
||||
|
||||
|
||||
%template(endl) endl<char, std::char_traits<char> >;
|
||||
%template(ends) ends<char, std::char_traits<char> >;
|
||||
%template(flush) flush<char, std::char_traits<char> >;
|
||||
|
||||
%template(wendl) endl<wchar_t, std::char_traits<wchar_t> >;
|
||||
%template(wends) ends<wchar_t, std::char_traits<wchar_t> >;
|
||||
%template(wflush) flush<wchar_t, std::char_traits<wchar_t> >;
|
||||
|
||||
%pythoncallback(0);
|
||||
|
||||
|
||||
}
|
||||
%include <std/std_iostream.i>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue