Changeset 42ed4855 in mainline
- Timestamp:
- 2018-07-05T21:41:19Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- eb69df4
- Parents:
- ccf7a7e
- git-author:
- Dzejrou <dzejrou@…> (2017-12-04 15:55:43)
- git-committer:
- Dzejrou <dzejrou@…> (2018-07-05 21:41:19)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/cpp/include/impl/string.hpp
rccf7a7e r42ed4855 679 679 size_type max_size() const noexcept 680 680 { 681 return allocator_traits<allocator_type>::max_size(allocator_); 681 return 0x7FFF; // TODO: just temporary 682 /* return allocator_traits<allocator_type>::max_size(allocator_); */ 682 683 } 683 684 … … 1859 1860 */ 1860 1861 1861 // TODO: implement 1862 template<class Char, class Traits, class Allocator> 1863 basic_istream<Char, Traits>& operator>>(basic_istream<Char, Traits>& is, 1864 basic_string<Char, Traits, Allocator>& str) 1865 { 1866 using sentry = typename basic_istream<Char, Traits>::sentry; 1867 sentry sen{is, true}; 1868 1869 if (sen) 1870 { 1871 str.erase(); 1872 1873 auto max_size = is.width(); 1874 if (max_size == 0) 1875 max_size = static_cast<decltype(max_size)>(str.max_size()); 1876 1877 decltype(is.width()) i{}; 1878 for(; i < max_size; ++i) 1879 { 1880 auto ic = is.rdbuf()->sgetc(); 1881 if (Traits::eq_int_type(ic, Traits::eof())) 1882 break; 1883 1884 auto c = Traits::to_char_type(ic); 1885 if(isspace(c, is.getloc())) 1886 break; 1887 1888 str.append(1, c); 1889 is.rdbuf()->sbumpc(); 1890 } 1891 } 1892 1893 return is; 1894 } 1895 1896 template<class Char, class Traits, class Allocator> 1897 basic_ostream<Char, Traits>& operator<<(basic_ostream<Char, Traits>& os, 1898 basic_string<Char, Traits, Allocator>& str) 1899 { 1900 // TODO: determine padding as described in 27.7.3.6.1 1901 using sentry = typename basic_ostream<Char, Traits>::sentry; 1902 sentry sen{os}; 1903 1904 if (sen) 1905 { 1906 auto size = str.size(); 1907 if (size < static_cast<decltype(size)>(os.width())) 1908 size = os.width(); 1909 1910 os.rdbuf()->sputn(str.data(), size); 1911 os.width(0); 1912 } 1913 1914 return os; 1915 } 1862 1916 1863 1917 /**
Note:
See TracChangeset
for help on using the changeset viewer.