summaryrefslogtreecommitdiff
path: root/contrib/libc++/include/streambuf
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/libc++/include/streambuf')
-rw-r--r--contrib/libc++/include/streambuf304
1 files changed, 103 insertions, 201 deletions
diff --git a/contrib/libc++/include/streambuf b/contrib/libc++/include/streambuf
index 7544aaf179bd0..86070659a4b4f 100644
--- a/contrib/libc++/include/streambuf
+++ b/contrib/libc++/include/streambuf
@@ -119,7 +119,7 @@ protected:
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _CharT, class _Traits>
-class _LIBCPP_TYPE_VIS_ONLY basic_streambuf
+class _LIBCPP_TEMPLATE_VIS basic_streambuf
{
public:
// types:
@@ -132,32 +132,96 @@ public:
virtual ~basic_streambuf();
// 27.6.2.2.1 locales:
- locale pubimbue(const locale& __loc);
- locale getloc() const;
+ inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
+ locale pubimbue(const locale& __loc) {
+ imbue(__loc);
+ locale __r = __loc_;
+ __loc_ = __loc;
+ return __r;
+ }
+
+ inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
+ locale getloc() const { return __loc_; }
// 27.6.2.2.2 buffer and positioning:
- basic_streambuf* pubsetbuf(char_type* __s, streamsize __n);
+ inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
+ basic_streambuf* pubsetbuf(char_type* __s, streamsize __n)
+ { return setbuf(__s, __n); }
+
+ inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
pos_type pubseekoff(off_type __off, ios_base::seekdir __way,
- ios_base::openmode __which = ios_base::in | ios_base::out);
+ ios_base::openmode __which = ios_base::in | ios_base::out)
+ { return seekoff(__off, __way, __which); }
+
+ inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
pos_type pubseekpos(pos_type __sp,
- ios_base::openmode __which = ios_base::in | ios_base::out);
- int pubsync();
+ ios_base::openmode __which = ios_base::in | ios_base::out)
+ { return seekpos(__sp, __which); }
+
+ inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
+ int pubsync() { return sync(); }
// Get and put areas:
// 27.6.2.2.3 Get area:
- streamsize in_avail();
- int_type snextc();
- int_type sbumpc();
- int_type sgetc();
- streamsize sgetn(char_type* __s, streamsize __n);
+ inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
+ streamsize in_avail() {
+ if (__ninp_ < __einp_)
+ return static_cast<streamsize>(__einp_ - __ninp_);
+ return showmanyc();
+ }
+
+ inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
+ int_type snextc() {
+ if (sbumpc() == traits_type::eof())
+ return traits_type::eof();
+ return sgetc();
+ }
+
+ inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
+ int_type sbumpc() {
+ if (__ninp_ == __einp_)
+ return uflow();
+ return traits_type::to_int_type(*__ninp_++);
+ }
+
+ inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
+ int_type sgetc() {
+ if (__ninp_ == __einp_)
+ return underflow();
+ return traits_type::to_int_type(*__ninp_);
+ }
+
+ inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
+ streamsize sgetn(char_type* __s, streamsize __n)
+ { return xsgetn(__s, __n); }
// 27.6.2.2.4 Putback:
- int_type sputbackc(char_type __c);
- int_type sungetc();
+ inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
+ int_type sputbackc(char_type __c) {
+ if (__binp_ == __ninp_ || !traits_type::eq(__c, __ninp_[-1]))
+ return pbackfail(traits_type::to_int_type(__c));
+ return traits_type::to_int_type(*--__ninp_);
+ }
+
+ inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
+ int_type sungetc() {
+ if (__binp_ == __ninp_)
+ return pbackfail();
+ return traits_type::to_int_type(*--__ninp_);
+ }
// 27.6.2.2.5 Put area:
- int_type sputc(char_type __c);
- streamsize sputn(const char_type* __s, streamsize __n);
+ inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
+ int_type sputc(char_type __c) {
+ if (__nout_ == __eout_)
+ return overflow(traits_type::to_int_type(__c));
+ *__nout_++ = __c;
+ return traits_type::to_int_type(__c);
+ }
+
+ inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
+ streamsize sputn(const char_type* __s, streamsize __n)
+ { return xsputn(__s, __n); }
protected:
basic_streambuf();
@@ -169,15 +233,30 @@ protected:
_LIBCPP_ALWAYS_INLINE char_type* eback() const {return __binp_;}
_LIBCPP_ALWAYS_INLINE char_type* gptr() const {return __ninp_;}
_LIBCPP_ALWAYS_INLINE char_type* egptr() const {return __einp_;}
- void gbump(int __n);
- void setg(char_type* __gbeg, char_type* __gnext, char_type* __gend);
+
+ inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
+ void gbump(int __n) { __ninp_ += __n; }
+
+ inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
+ void setg(char_type* __gbeg, char_type* __gnext, char_type* __gend) {
+ __binp_ = __gbeg;
+ __ninp_ = __gnext;
+ __einp_ = __gend;
+ }
// 27.6.2.3.3 Put area:
_LIBCPP_ALWAYS_INLINE char_type* pbase() const {return __bout_;}
_LIBCPP_ALWAYS_INLINE char_type* pptr() const {return __nout_;}
_LIBCPP_ALWAYS_INLINE char_type* epptr() const {return __eout_;}
- void pbump(int __n);
- void setp(char_type* __pbeg, char_type* __pend);
+
+ inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
+ void pbump(int __n) { __nout_ += __n; }
+
+ inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
+ void setp(char_type* __pbeg, char_type* __pend) {
+ __bout_ = __nout_ = __pbeg;
+ __eout_ = __pend;
+ }
// 27.6.2.4 virtual functions:
// 27.6.2.4.1 Locales:
@@ -220,147 +299,6 @@ basic_streambuf<_CharT, _Traits>::~basic_streambuf()
}
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
-locale
-basic_streambuf<_CharT, _Traits>::pubimbue(const locale& __loc)
-{
- imbue(__loc);
- locale __r = __loc_;
- __loc_ = __loc;
- return __r;
-}
-
-template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
-locale
-basic_streambuf<_CharT, _Traits>::getloc() const
-{
- return __loc_;
-}
-
-template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
-basic_streambuf<_CharT, _Traits>*
-basic_streambuf<_CharT, _Traits>::pubsetbuf(char_type* __s, streamsize __n)
-{
- return setbuf(__s, __n);
-}
-
-template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
-typename basic_streambuf<_CharT, _Traits>::pos_type
-basic_streambuf<_CharT, _Traits>::pubseekoff(off_type __off,
- ios_base::seekdir __way,
- ios_base::openmode __which)
-{
- return seekoff(__off, __way, __which);
-}
-
-template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
-typename basic_streambuf<_CharT, _Traits>::pos_type
-basic_streambuf<_CharT, _Traits>::pubseekpos(pos_type __sp,
- ios_base::openmode __which)
-{
- return seekpos(__sp, __which);
-}
-
-template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
-int
-basic_streambuf<_CharT, _Traits>::pubsync()
-{
- return sync();
-}
-
-template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
-streamsize
-basic_streambuf<_CharT, _Traits>::in_avail()
-{
- if (__ninp_ < __einp_)
- return static_cast<streamsize>(__einp_ - __ninp_);
- return showmanyc();
-}
-
-template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
-typename basic_streambuf<_CharT, _Traits>::int_type
-basic_streambuf<_CharT, _Traits>::snextc()
-{
- if (sbumpc() == traits_type::eof())
- return traits_type::eof();
- return sgetc();
-}
-
-template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
-typename basic_streambuf<_CharT, _Traits>::int_type
-basic_streambuf<_CharT, _Traits>::sbumpc()
-{
- if (__ninp_ == __einp_)
- return uflow();
- return traits_type::to_int_type(*__ninp_++);
-}
-
-template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
-typename basic_streambuf<_CharT, _Traits>::int_type
-basic_streambuf<_CharT, _Traits>::sgetc()
-{
- if (__ninp_ == __einp_)
- return underflow();
- return traits_type::to_int_type(*__ninp_);
-}
-
-template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
-streamsize
-basic_streambuf<_CharT, _Traits>::sgetn(char_type* __s, streamsize __n)
-{
- return xsgetn(__s, __n);
-}
-
-template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
-typename basic_streambuf<_CharT, _Traits>::int_type
-basic_streambuf<_CharT, _Traits>::sputbackc(char_type __c)
-{
- if (__binp_ == __ninp_ || !traits_type::eq(__c, __ninp_[-1]))
- return pbackfail(traits_type::to_int_type(__c));
- return traits_type::to_int_type(*--__ninp_);
-}
-
-template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
-typename basic_streambuf<_CharT, _Traits>::int_type
-basic_streambuf<_CharT, _Traits>::sungetc()
-{
- if (__binp_ == __ninp_)
- return pbackfail();
- return traits_type::to_int_type(*--__ninp_);
-}
-
-template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
-typename basic_streambuf<_CharT, _Traits>::int_type
-basic_streambuf<_CharT, _Traits>::sputc(char_type __c)
-{
- if (__nout_ == __eout_)
- return overflow(traits_type::to_int_type(__c));
- *__nout_++ = __c;
- return traits_type::to_int_type(__c);
-}
-
-template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
-streamsize
-basic_streambuf<_CharT, _Traits>::sputn(const char_type* __s, streamsize __n)
-{
- return xsputn(__s, __n);
-}
-
-template <class _CharT, class _Traits>
basic_streambuf<_CharT, _Traits>::basic_streambuf()
: __binp_(0),
__ninp_(0),
@@ -411,42 +349,6 @@ basic_streambuf<_CharT, _Traits>::swap(basic_streambuf& __sb)
}
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
-void
-basic_streambuf<_CharT, _Traits>::gbump(int __n)
-{
- __ninp_ += __n;
-}
-
-template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
-void
-basic_streambuf<_CharT, _Traits>::setg(char_type* __gbeg, char_type* __gnext,
- char_type* __gend)
-{
- __binp_ = __gbeg;
- __ninp_ = __gnext;
- __einp_ = __gend;
-}
-
-template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
-void
-basic_streambuf<_CharT, _Traits>::pbump(int __n)
-{
- __nout_ += __n;
-}
-
-template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
-void
-basic_streambuf<_CharT, _Traits>::setp(char_type* __pbeg, char_type* __pend)
-{
- __bout_ = __nout_ = __pbeg;
- __eout_ = __pend;
-}
-
-template <class _CharT, class _Traits>
void
basic_streambuf<_CharT, _Traits>::imbue(const locale&)
{
@@ -574,11 +476,11 @@ basic_streambuf<_CharT, _Traits>::overflow(int_type)
return traits_type::eof();
}
-_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_streambuf<char>)
-_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_streambuf<wchar_t>)
+_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_streambuf<char>)
+_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_streambuf<wchar_t>)
-_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_ios<char>)
-_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_ios<wchar_t>)
+_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ios<char>)
+_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ios<wchar_t>)
_LIBCPP_END_NAMESPACE_STD