示例#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());
}