ReactOS  0.4.14-dev-604-gcfdd483
_bitset.c File Reference
#include <stl/_bitset.h>
#include <stl/_string_io.h>
Include dependency graph for _bitset.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define _STLP_BITSET_C
 
#define __BITS_PER_WORD   (CHAR_BIT * sizeof(unsigned long))
 

Functions

template<class _CharT , class _Traits , size_t _Nb>
_STLP_MOVE_TO_STD_NAMESPACE _STLP_END_NAMESPACE _STLP_BEGIN_NAMESPACE basic_istream< _CharT, _Traits > &_STLP_CALL operator>> (basic_istream< _CharT, _Traits > &__is, bitset< _Nb > &__x)
 
template<class _CharT , class _Traits , size_t _Nb>
basic_ostream< _CharT, _Traits > &_STLP_CALL operator<< (basic_ostream< _CharT, _Traits > &__os, const bitset< _Nb > &__x)
 

Macro Definition Documentation

◆ __BITS_PER_WORD

#define __BITS_PER_WORD   (CHAR_BIT * sizeof(unsigned long))

Definition at line 26 of file _bitset.c.

◆ _STLP_BITSET_C

#define _STLP_BITSET_C

Definition at line 20 of file _bitset.c.

Function Documentation

◆ operator<<()

template<class _CharT , class _Traits , size_t _Nb>
basic_ostream<_CharT, _Traits>& _STLP_CALL operator<< ( basic_ostream< _CharT, _Traits > &  __os,
const bitset< _Nb > &  __x 
)

Definition at line 219 of file _bitset.c.

220  {
222  __x._M_copy_to_string(__tmp);
223  return __os << __tmp;
224 }
void _M_copy_to_string(string &__s) const
Definition: _bitset.h:656

◆ operator>>()

template<class _CharT , class _Traits , size_t _Nb>
_STLP_MOVE_TO_STD_NAMESPACE _STLP_END_NAMESPACE _STLP_BEGIN_NAMESPACE basic_istream<_CharT, _Traits>& _STLP_CALL operator>> ( basic_istream< _CharT, _Traits > &  __is,
bitset< _Nb > &  __x 
)

Definition at line 179 of file _bitset.c.

179  {
181  __tmp.reserve(_Nb);
182 
183  // Skip whitespace
184  typename basic_istream<_CharT, _Traits>::sentry __sentry(__is);
185  if (__sentry) {
186  basic_streambuf<_CharT, _Traits>* __buf = __is.rdbuf();
187  for (size_t __i = 0; __i < _Nb; ++__i) {
188  static typename _Traits::int_type __eof = _Traits::eof();
189 
190  typename _Traits::int_type __c1 = __buf->sbumpc();
191  if (_Traits::eq_int_type(__c1, __eof)) {
192  __is.setstate(ios_base::eofbit);
193  break;
194  }
195  else {
196  typename _Traits::char_type __c2 = _Traits::to_char_type(__c1);
197  char __c = __is.narrow(__c2, '*');
198 
199  if (__c == '0' || __c == '1')
200  __tmp.push_back(__c);
201  else if (_Traits::eq_int_type(__buf->sputbackc(__c2), __eof)) {
202  __is.setstate(ios_base::failbit);
203  break;
204  }
205  }
206  }
207 
208  if (__tmp.empty())
209  __is.setstate(ios_base::failbit);
210  else
211  __x._M_copy_from_string(__tmp, __STATIC_CAST(size_t,0), _Nb);
212  }
213 
214  return __is;
215 }
basic_streambuf< _CharT, _Traits > * rdbuf() const
Definition: _ios.h:72
#define __STATIC_CAST(__x, __y)
Definition: features.h:585
#define __c
Definition: schilyio.h:209
char narrow(_CharT, char) const
Definition: _ios.h:145
int_type sbumpc()
Definition: _streambuf.h:227
bool empty() const
Definition: _string.h:428
void push_back(_CharT __c)
Definition: _string.h:534
void setstate(iostate __state)
Definition: _ios.h:95
_Check_return_ _CRTIMP int __cdecl __cdecl eof(_In_ int _FileHandle)
void _M_copy_from_string(const string &__s, size_t __pos, size_t __n)
Definition: _bitset.h:635
int_type sputbackc(char_type __c)
Definition: _streambuf.h:241
void reserve(size_type=0)
Definition: _string.c:158