diff options
Diffstat (limited to 'include/fstream')
-rw-r--r-- | include/fstream | 94 |
1 files changed, 63 insertions, 31 deletions
diff --git a/include/fstream b/include/fstream index 1f289eddc56f..3cb3b13bd10f 100644 --- a/include/fstream +++ b/include/fstream @@ -200,14 +200,17 @@ public: // 27.9.1.3 Assign/swap: #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY basic_filebuf& operator=(basic_filebuf&& __rhs); #endif void swap(basic_filebuf& __rhs); // 27.9.1.4 Members: + _LIBCPP_INLINE_VISIBILITY bool is_open() const; #ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE basic_filebuf* open(const char* __s, ios_base::openmode __mode); + _LIBCPP_INLINE_VISIBILITY basic_filebuf* open(const string& __s, ios_base::openmode __mode); #endif basic_filebuf* close(); @@ -340,7 +343,7 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf(basic_filebuf&& __rhs) } template <class _CharT, class _Traits> -inline _LIBCPP_INLINE_VISIBILITY +inline basic_filebuf<_CharT, _Traits>& basic_filebuf<_CharT, _Traits>::operator=(basic_filebuf&& __rhs) { @@ -458,7 +461,7 @@ swap(basic_filebuf<_CharT, _Traits>& __x, basic_filebuf<_CharT, _Traits>& __y) } template <class _CharT, class _Traits> -inline _LIBCPP_INLINE_VISIBILITY +inline bool basic_filebuf<_CharT, _Traits>::is_open() const { @@ -547,7 +550,7 @@ basic_filebuf<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode) } template <class _CharT, class _Traits> -inline _LIBCPP_INLINE_VISIBILITY +inline basic_filebuf<_CharT, _Traits>* basic_filebuf<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mode) { @@ -603,7 +606,9 @@ basic_filebuf<_CharT, _Traits>::underflow() } else { - memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_); + _LIBCPP_ASSERT ( !(__extbufnext_ == NULL && (__extbufend_ != __extbufnext_)), "underflow moving from NULL" ); + if (__extbufend_ != __extbufnext_) + memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_); __extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_); __extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_); size_t __nmemb = _VSTD::min(static_cast<size_t>(__ibs_ - __unget_sz), @@ -1008,26 +1013,35 @@ public: typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; + _LIBCPP_INLINE_VISIBILITY basic_ifstream(); #ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE + _LIBCPP_INLINE_VISIBILITY explicit basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in); + _LIBCPP_INLINE_VISIBILITY explicit basic_ifstream(const string& __s, ios_base::openmode __mode = ios_base::in); #endif #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY basic_ifstream(basic_ifstream&& __rhs); #endif #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY basic_ifstream& operator=(basic_ifstream&& __rhs); #endif + _LIBCPP_INLINE_VISIBILITY void swap(basic_ifstream& __rhs); + _LIBCPP_INLINE_VISIBILITY basic_filebuf<char_type, traits_type>* rdbuf() const; + _LIBCPP_INLINE_VISIBILITY bool is_open() const; #ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE void open(const char* __s, ios_base::openmode __mode = ios_base::in); void open(const string& __s, ios_base::openmode __mode = ios_base::in); #endif + _LIBCPP_INLINE_VISIBILITY void close(); private: @@ -1035,7 +1049,7 @@ private: }; template <class _CharT, class _Traits> -inline _LIBCPP_INLINE_VISIBILITY +inline basic_ifstream<_CharT, _Traits>::basic_ifstream() : basic_istream<char_type, traits_type>(&__sb_) { @@ -1043,7 +1057,7 @@ basic_ifstream<_CharT, _Traits>::basic_ifstream() #ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE template <class _CharT, class _Traits> -inline _LIBCPP_INLINE_VISIBILITY +inline basic_ifstream<_CharT, _Traits>::basic_ifstream(const char* __s, ios_base::openmode __mode) : basic_istream<char_type, traits_type>(&__sb_) { @@ -1052,7 +1066,7 @@ basic_ifstream<_CharT, _Traits>::basic_ifstream(const char* __s, ios_base::openm } template <class _CharT, class _Traits> -inline _LIBCPP_INLINE_VISIBILITY +inline basic_ifstream<_CharT, _Traits>::basic_ifstream(const string& __s, ios_base::openmode __mode) : basic_istream<char_type, traits_type>(&__sb_) { @@ -1064,7 +1078,7 @@ basic_ifstream<_CharT, _Traits>::basic_ifstream(const string& __s, ios_base::ope #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template <class _CharT, class _Traits> -inline _LIBCPP_INLINE_VISIBILITY +inline basic_ifstream<_CharT, _Traits>::basic_ifstream(basic_ifstream&& __rhs) : basic_istream<char_type, traits_type>(_VSTD::move(__rhs)), __sb_(_VSTD::move(__rhs.__sb_)) @@ -1073,7 +1087,7 @@ basic_ifstream<_CharT, _Traits>::basic_ifstream(basic_ifstream&& __rhs) } template <class _CharT, class _Traits> -inline _LIBCPP_INLINE_VISIBILITY +inline basic_ifstream<_CharT, _Traits>& basic_ifstream<_CharT, _Traits>::operator=(basic_ifstream&& __rhs) { @@ -1085,7 +1099,7 @@ basic_ifstream<_CharT, _Traits>::operator=(basic_ifstream&& __rhs) #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template <class _CharT, class _Traits> -inline _LIBCPP_INLINE_VISIBILITY +inline void basic_ifstream<_CharT, _Traits>::swap(basic_ifstream& __rhs) { @@ -1102,7 +1116,7 @@ swap(basic_ifstream<_CharT, _Traits>& __x, basic_ifstream<_CharT, _Traits>& __y) } template <class _CharT, class _Traits> -inline _LIBCPP_INLINE_VISIBILITY +inline basic_filebuf<_CharT, _Traits>* basic_ifstream<_CharT, _Traits>::rdbuf() const { @@ -1110,7 +1124,7 @@ basic_ifstream<_CharT, _Traits>::rdbuf() const } template <class _CharT, class _Traits> -inline _LIBCPP_INLINE_VISIBILITY +inline bool basic_ifstream<_CharT, _Traits>::is_open() const { @@ -1140,7 +1154,7 @@ basic_ifstream<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mo #endif template <class _CharT, class _Traits> -inline _LIBCPP_INLINE_VISIBILITY +inline void basic_ifstream<_CharT, _Traits>::close() { @@ -1161,24 +1175,33 @@ public: typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; + _LIBCPP_INLINE_VISIBILITY basic_ofstream(); + _LIBCPP_INLINE_VISIBILITY explicit basic_ofstream(const char* __s, ios_base::openmode __mode = ios_base::out); + _LIBCPP_INLINE_VISIBILITY explicit basic_ofstream(const string& __s, ios_base::openmode __mode = ios_base::out); #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY basic_ofstream(basic_ofstream&& __rhs); #endif #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY basic_ofstream& operator=(basic_ofstream&& __rhs); #endif + _LIBCPP_INLINE_VISIBILITY void swap(basic_ofstream& __rhs); + _LIBCPP_INLINE_VISIBILITY basic_filebuf<char_type, traits_type>* rdbuf() const; + _LIBCPP_INLINE_VISIBILITY bool is_open() const; #ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE void open(const char* __s, ios_base::openmode __mode = ios_base::out); void open(const string& __s, ios_base::openmode __mode = ios_base::out); #endif + _LIBCPP_INLINE_VISIBILITY void close(); private: @@ -1186,7 +1209,7 @@ private: }; template <class _CharT, class _Traits> -inline _LIBCPP_INLINE_VISIBILITY +inline basic_ofstream<_CharT, _Traits>::basic_ofstream() : basic_ostream<char_type, traits_type>(&__sb_) { @@ -1194,7 +1217,7 @@ basic_ofstream<_CharT, _Traits>::basic_ofstream() #ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE template <class _CharT, class _Traits> -inline _LIBCPP_INLINE_VISIBILITY +inline basic_ofstream<_CharT, _Traits>::basic_ofstream(const char* __s, ios_base::openmode __mode) : basic_ostream<char_type, traits_type>(&__sb_) { @@ -1203,7 +1226,7 @@ basic_ofstream<_CharT, _Traits>::basic_ofstream(const char* __s, ios_base::openm } template <class _CharT, class _Traits> -inline _LIBCPP_INLINE_VISIBILITY +inline basic_ofstream<_CharT, _Traits>::basic_ofstream(const string& __s, ios_base::openmode __mode) : basic_ostream<char_type, traits_type>(&__sb_) { @@ -1215,7 +1238,7 @@ basic_ofstream<_CharT, _Traits>::basic_ofstream(const string& __s, ios_base::ope #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template <class _CharT, class _Traits> -inline _LIBCPP_INLINE_VISIBILITY +inline basic_ofstream<_CharT, _Traits>::basic_ofstream(basic_ofstream&& __rhs) : basic_ostream<char_type, traits_type>(_VSTD::move(__rhs)), __sb_(_VSTD::move(__rhs.__sb_)) @@ -1224,7 +1247,7 @@ basic_ofstream<_CharT, _Traits>::basic_ofstream(basic_ofstream&& __rhs) } template <class _CharT, class _Traits> -inline _LIBCPP_INLINE_VISIBILITY +inline basic_ofstream<_CharT, _Traits>& basic_ofstream<_CharT, _Traits>::operator=(basic_ofstream&& __rhs) { @@ -1236,7 +1259,7 @@ basic_ofstream<_CharT, _Traits>::operator=(basic_ofstream&& __rhs) #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template <class _CharT, class _Traits> -inline _LIBCPP_INLINE_VISIBILITY +inline void basic_ofstream<_CharT, _Traits>::swap(basic_ofstream& __rhs) { @@ -1253,7 +1276,7 @@ swap(basic_ofstream<_CharT, _Traits>& __x, basic_ofstream<_CharT, _Traits>& __y) } template <class _CharT, class _Traits> -inline _LIBCPP_INLINE_VISIBILITY +inline basic_filebuf<_CharT, _Traits>* basic_ofstream<_CharT, _Traits>::rdbuf() const { @@ -1261,7 +1284,7 @@ basic_ofstream<_CharT, _Traits>::rdbuf() const } template <class _CharT, class _Traits> -inline _LIBCPP_INLINE_VISIBILITY +inline bool basic_ofstream<_CharT, _Traits>::is_open() const { @@ -1291,7 +1314,7 @@ basic_ofstream<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mo #endif template <class _CharT, class _Traits> -inline _LIBCPP_INLINE_VISIBILITY +inline void basic_ofstream<_CharT, _Traits>::close() { @@ -1312,26 +1335,35 @@ public: typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; + _LIBCPP_INLINE_VISIBILITY basic_fstream(); #ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE + _LIBCPP_INLINE_VISIBILITY explicit basic_fstream(const char* __s, ios_base::openmode __mode = ios_base::in | ios_base::out); + _LIBCPP_INLINE_VISIBILITY explicit basic_fstream(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out); #endif #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY basic_fstream(basic_fstream&& __rhs); #endif #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY basic_fstream& operator=(basic_fstream&& __rhs); #endif + _LIBCPP_INLINE_VISIBILITY void swap(basic_fstream& __rhs); + _LIBCPP_INLINE_VISIBILITY basic_filebuf<char_type, traits_type>* rdbuf() const; + _LIBCPP_INLINE_VISIBILITY bool is_open() const; #ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE void open(const char* __s, ios_base::openmode __mode = ios_base::in | ios_base::out); void open(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out); #endif + _LIBCPP_INLINE_VISIBILITY void close(); private: @@ -1339,7 +1371,7 @@ private: }; template <class _CharT, class _Traits> -inline _LIBCPP_INLINE_VISIBILITY +inline basic_fstream<_CharT, _Traits>::basic_fstream() : basic_iostream<char_type, traits_type>(&__sb_) { @@ -1347,7 +1379,7 @@ basic_fstream<_CharT, _Traits>::basic_fstream() #ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE template <class _CharT, class _Traits> -inline _LIBCPP_INLINE_VISIBILITY +inline basic_fstream<_CharT, _Traits>::basic_fstream(const char* __s, ios_base::openmode __mode) : basic_iostream<char_type, traits_type>(&__sb_) { @@ -1356,7 +1388,7 @@ basic_fstream<_CharT, _Traits>::basic_fstream(const char* __s, ios_base::openmod } template <class _CharT, class _Traits> -inline _LIBCPP_INLINE_VISIBILITY +inline basic_fstream<_CharT, _Traits>::basic_fstream(const string& __s, ios_base::openmode __mode) : basic_iostream<char_type, traits_type>(&__sb_) { @@ -1368,7 +1400,7 @@ basic_fstream<_CharT, _Traits>::basic_fstream(const string& __s, ios_base::openm #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template <class _CharT, class _Traits> -inline _LIBCPP_INLINE_VISIBILITY +inline basic_fstream<_CharT, _Traits>::basic_fstream(basic_fstream&& __rhs) : basic_iostream<char_type, traits_type>(_VSTD::move(__rhs)), __sb_(_VSTD::move(__rhs.__sb_)) @@ -1377,7 +1409,7 @@ basic_fstream<_CharT, _Traits>::basic_fstream(basic_fstream&& __rhs) } template <class _CharT, class _Traits> -inline _LIBCPP_INLINE_VISIBILITY +inline basic_fstream<_CharT, _Traits>& basic_fstream<_CharT, _Traits>::operator=(basic_fstream&& __rhs) { @@ -1389,7 +1421,7 @@ basic_fstream<_CharT, _Traits>::operator=(basic_fstream&& __rhs) #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template <class _CharT, class _Traits> -inline _LIBCPP_INLINE_VISIBILITY +inline void basic_fstream<_CharT, _Traits>::swap(basic_fstream& __rhs) { @@ -1406,7 +1438,7 @@ swap(basic_fstream<_CharT, _Traits>& __x, basic_fstream<_CharT, _Traits>& __y) } template <class _CharT, class _Traits> -inline _LIBCPP_INLINE_VISIBILITY +inline basic_filebuf<_CharT, _Traits>* basic_fstream<_CharT, _Traits>::rdbuf() const { @@ -1414,7 +1446,7 @@ basic_fstream<_CharT, _Traits>::rdbuf() const } template <class _CharT, class _Traits> -inline _LIBCPP_INLINE_VISIBILITY +inline bool basic_fstream<_CharT, _Traits>::is_open() const { @@ -1444,7 +1476,7 @@ basic_fstream<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mod #endif template <class _CharT, class _Traits> -inline _LIBCPP_INLINE_VISIBILITY +inline void basic_fstream<_CharT, _Traits>::close() { |