예제 #1
1
void
printstate(const std::ios &ios)
{
    if (ios.good()) {
        std::cout << "ios.good" << std::endl;
    } else if (ios.eof()){
        std::cout << "ios.eof" << std::endl;
    } else if (ios.fail()){
        std::cout << "ios.fail" << std::endl;
    } else if (ios.bad()){
        std::cout << "ios.bad" << std::endl;
    }

}
예제 #2
1
void throwIfNotGood(const std::ios& stream, const std::string& file) {
    if (!stream.good()) {
        std::stringstream ss;
        ss << "Cannot open file " << file;
        throw std::runtime_error(ss.str());
    }
}
예제 #3
1
파일: main.cpp 프로젝트: CCJY/coliru
void show_results( std::ios& stm )
{
    std::cout << std::boolalpha << "bad: " << stm.bad() << "   fail: " << stm.fail()
               << "   eof: " << stm.eof() << "   good: " << stm.good()
               << "   bool(stm): " << bool(stm) << "   !stm: " << !stm << '\n' ;
}
예제 #4
1
파일: main.cpp 프로젝트: evilbinary/lisp-
void print_state (const std::ios& stream) {
    std::cout << " good()=" << stream.good();
    std::cout << " eof()=" << stream.eof();
    std::cout << " fail()=" << stream.fail();
    std::cout << " bad()=" << stream.bad();
}
예제 #5
0
int main(int, char**)
{
    const std::ios ios(0);
    assert(ios.fill() == ' ');

  return 0;
}
void DenseLinAlgPack::LinAlgPackIO::ios_format_memento::set_format(std::ios& s) const {

  s.flags(flags_);
  s.precision(prec_);
  s.width(wdt_);
  s.fill(fill_);

}
DenseLinAlgPack::LinAlgPackIO::ios_format_memento
DenseLinAlgPack::LinAlgPackIO::ios_format_memento::save_format(const std::ios& s) {

  ios_format_memento m;

  m.flags_	= s.flags();
  m.prec_		= s.precision();
  m.wdt_		= s.width();
  m.fill_		= s.fill();

  return m;
}
예제 #8
0
파일: io.cpp 프로젝트: gitrider/wxsj2
IO::Mode
set_ascii_mode(std::ios& i)
{
    IO::Mode m = get_mode(i);
    i.iword(IO::mode) = IO::ASCII;
    return m;
}
예제 #9
0
	explicit StreamStateSaver(std::ios &stream)
		: stream(stream)
		, state(nullptr)
	{
		// Save the stream's state.
		state.copyfmt(stream);
	}
예제 #10
0
파일: io.cpp 프로젝트: FMX/CGAL
IO::Mode
set_mode(std::ios& i, IO::Mode m)
{
    IO::Mode old = get_mode(i);
    i.iword(IO::mode) = m;
    return old;
}
예제 #11
0
파일: io.cpp 프로젝트: FMX/CGAL
IO::Mode
set_pretty_mode(std::ios& i)
{
    IO::Mode m = get_mode(i);
    i.iword(IO::mode) = IO::PRETTY;
    return m;
}
예제 #12
0
파일: io.cpp 프로젝트: FMX/CGAL
IO::Mode
set_binary_mode(std::ios& i)
{
    IO::Mode m = get_mode(i);
    i.iword(IO::mode) = IO::BINARY;
    return m;
}
void FragmentedFileWriter::turnExceptionsOn(std::ios& stream)
{
	stream.exceptions( std::ios_base::badbit|std::ios_base::failbit);
}
예제 #14
0
//prints the error flags when an attempt to open a file fails
void util::print_state (const std::ios& stream) {
    cerr << " good()=" << stream.good();
    cerr << " eof()=" << stream.eof();
    cerr << " fail()=" << stream.fail();
    cerr << " bad()=" << stream.bad();
}
예제 #15
0
 explicit StreamRedirector(std::ios& stream, std::streambuf* newBuf) : savedBuf_(stream.rdbuf()), stream_(stream)
 {
     stream_.rdbuf(newBuf);
 }
예제 #16
0
 ios_guard(std::ios& x) : guarded(x), old(0) { old.copyfmt(guarded); }
예제 #17
0
	RedirectStreamBuffer(std::ios &stream, std::streambuf * new_sb) : stream(stream) {
		orig_sb = stream.rdbuf( new_sb );
	}
예제 #18
0
파일: io.cpp 프로젝트: FMX/CGAL
bool
is_binary(std::ios& i)
{
    return i.iword(IO::mode) == IO::BINARY;
}
예제 #19
0
파일: io.cpp 프로젝트: FMX/CGAL
bool
is_ascii(std::ios& i)
{
    return i.iword(IO::mode) == IO::ASCII;
}
예제 #20
0
파일: io.cpp 프로젝트: FMX/CGAL
bool
is_pretty(std::ios& i)
{
    return i.iword(IO::mode) == IO::PRETTY;
}
예제 #21
0
파일: io.cpp 프로젝트: gitrider/wxsj2
IO::Mode
get_mode(std::ios& i)
{
    return static_cast<IO::Mode>(i.iword(IO::mode));
}
void DenseLinAlgPack::LinAlgPackIO::format::set_format(std::ios& s) const {
  s.flags(ios_base_flags().flags());
  s.precision(precision());
  s.width(width());
  s.fill(fill());
}
void DenseLinAlgPack::LinAlgPackIO::format::copy_format(const std::ios& s) {
  ios_base_flags().flags(s.flags());
  precision(s.precision());
  width(s.width());
  fill(s.fill());
}