当前位置: 首页>>代码示例>>C++>>正文


C++ ostream::fill方法代码示例

本文整理汇总了C++中std::ostream::fill方法的典型用法代码示例。如果您正苦于以下问题:C++ ostream::fill方法的具体用法?C++ ostream::fill怎么用?C++ ostream::fill使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在std::ostream的用法示例。


在下文中一共展示了ostream::fill方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

/**
 * \brief Print RTL to a stream.
 *
 * Prints this object to a stream in text form.
 *
 * \param os  Stream to output to (often cout or cerr).
 */
void
RTL::print(std::ostream &os /*= cout*/, bool html /*=false*/) const
{
	if (html)
		os << "<tr><td>";
	// print out the instruction address of this RTL
	auto fill = os.fill('0');
	os << std::hex << std::setw(8) << nativeAddr << std::dec;
	os.fill(fill);
	if (html)
		os << "</td>";

	// Print the statements
	// First line has 8 extra chars as above
	bool bFirst = true;
	for (const auto &stmt : stmtList) {
		if (html) {
			if (!bFirst) os << "<tr><td></td>";
		} else {
			if (bFirst) os << " ";
			else        os << std::setw(9) << " ";
		}
		if (stmt) stmt->print(os, html);
		// Note: we only put newlines where needed. So none at the end of
		// Statement::print; one here to separate from other statements
		if (html)
			os << "</tr>";
		os << "\n";
		bFirst = false;
	}
	if (stmtList.empty()) os << std::endl;  // New line for NOP
}
开发者ID:turboencabulator,项目名称:boomerang,代码行数:39,代码来源:rtl.cpp

示例2: formatGdbmiChar

static inline void formatGdbmiChar(std::ostream &str, wchar_t c)
{
    switch (c) {
    case L'\n':
        str << "\\n";
        break;
    case L'\t':
        str << "\\t";
        break;
    case L'\r':
        str << "\\r";
        break;
    case L'\\':
    case L'"':
        str << '\\' << char(c);
        break;
    default:
        if (c < 128) {
            str << char(c);
        } else {
            // Always pad up to 3 digits in case a digit follows
            const char oldFill = str.fill('0');
            str << '\\' << std::oct;
            str.width(3);
            str << unsigned(c) << std::dec;
            str.fill(oldFill);
        }
        break;
    }
}
开发者ID:Herysutrisno,项目名称:qt-creator,代码行数:30,代码来源:stringutils.cpp

示例3: print

void Date::print(std::ostream& out) const {
    auto ch = out.fill('0');
    out << std::setw(2) << day << '.';
    out << std::setw(2) << month << '.';
    out << std::setw(4) << year;
    out.fill(ch);
}
开发者ID:aerobless,项目名称:HSR_Prog3,代码行数:7,代码来源:Date.cpp

示例4: exportStream

BOOL LLPermissions::exportStream(std::ostream& output_stream) const
{
	if (!output_stream.good()) return FALSE;
	output_stream <<  "\tpermissions 0\n";
	output_stream <<  "\t{\n";

	char prev_fill = output_stream.fill('0');
	output_stream << std::hex;
	output_stream << "\t\tbase_mask\t" << std::setw(8) << mMaskBase << "\n";
	output_stream << "\t\towner_mask\t" << std::setw(8) << mMaskOwner << "\n";
	output_stream << "\t\tgroup_mask\t" << std::setw(8) << mMaskGroup << "\n";
	output_stream << "\t\teveryone_mask\t" << std::setw(8) << mMaskEveryone << "\n";
	output_stream << "\t\tnext_owner_mask\t" << std::setw(8) << mMaskNextOwner << "\n";
	output_stream << std::dec;
	output_stream.fill(prev_fill);

	output_stream <<  "\t\tcreator_id\t" << mCreator << "\n";
	output_stream <<  "\t\towner_id\t" << mOwner << "\n";
	output_stream <<  "\t\tlast_owner_id\t" << mLastOwner << "\n";
	output_stream <<  "\t\tgroup_id\t" << mGroup << "\n";

	if(mIsGroupOwned)
	{
		output_stream <<  "\t\tgroup_owned\t1\n";
	}
	output_stream << "\t}\n";
	return TRUE;
}
开发者ID:aragornarda,项目名称:SingularityViewer,代码行数:28,代码来源:llpermissions.cpp

示例5: print128

void print128(std::ostream& out, uint8* data)
{
	out.fill('0');
	out << std::hex;
	for(int i = 15; i >= 0; --i) {
		out.width(2);
		out << int(data[i]);
	}
	out.fill(' ');
	out << std::dec;
}
开发者ID:Recmo,项目名称:Codecup-2013-Symple,代码行数:11,代码来源:main.cpp

示例6: formatVectorRegister

// Format a 128bit vector register by adding digits in reverse order
void formatVectorRegister(std::ostream &str, const unsigned char *array, int size)
{
    const char oldFill = str.fill('0');

    str << "0x" << std::hex;
    for (int i = size - 1; i >= 0; i--) {
        str.width(2);
        str << unsigned(array[i]);
    }
    str << std::dec;

    str.fill(oldFill);
}
开发者ID:CNOT,项目名称:julia-studio,代码行数:14,代码来源:gdbmihelpers.cpp

示例7: WriteTag

  void ILogger::WriteTag(std::ostream& theOstream, SeverityType theSeverity,
      const char* theSourceFile, int theSourceLine)
  {
    const struct std::tm* anTm; // Pointer to Time structure
    std::time_t anNow;

    // Get current time in seconds since Jan 1, 1970
    anNow = std::time(NULL);

    // Convert current time value into local time (with help from OS)
    anTm = std::localtime(&anNow);

    // Output time in timestamp format
    theOstream << anTm->tm_year + 1900 << "-";
    theOstream.fill('0');
    theOstream.width(2);
    theOstream << anTm->tm_mon + 1 << "-";
    theOstream.fill('0');
    theOstream.width(2);
    theOstream << anTm->tm_mday << " ";
    theOstream.fill('0');
    theOstream.width(2);
    theOstream << anTm->tm_hour + 1 << ":";
    theOstream.fill('0');
    theOstream.width(2);
    theOstream << anTm->tm_min << ":";
    theOstream.fill('0');
    theOstream.width(2);
    theOstream << anTm->tm_sec << " ";

    // Now print the log level as a single character
    switch(theSeverity)
    {
      case SeverityInfo:
        theOstream << "I";
        break;
      case SeverityWarning:
        theOstream << "W";
        break;
      case SeverityError:
        theOstream << "E";
        break;
      case SeverityFatal:
        theOstream << "F";
        break;
      default:
        theOstream << "U";
        break;
    }
    theOstream << " " << theSourceFile << ":" << theSourceLine << " ";
  }
开发者ID:Moltov,项目名称:Time-Voyager,代码行数:51,代码来源:ILogger.cpp

示例8: PrintRealDateTime

void PrintRealDateTime(std::ostream& os, int64_t tm,
                       bool ignore_microseconds) {
    char buf[32];
    const time_t tm_s = tm / 1000000L;
    struct tm lt;
    strftime(buf, sizeof(buf), "%Y/%m/%d-%H:%M:%S", localtime_r(&tm_s, &lt));
    if (ignore_microseconds) {
        os << buf;
    } else {
        const char old_fill = os.fill('0');
        os << buf << '.' << std::setw(6) << tm % 1000000L;
        os.fill(old_fill);
    }
}
开发者ID:abners,项目名称:brpc,代码行数:14,代码来源:common.cpp

示例9:

void
FormattedTable::printNoDataRow(char intersect_char, char fill_char,
                               std::ostream & out, std::map<std::string, unsigned short> & col_widths,
                               std::set<std::string>::iterator & col_begin, std::set<std::string>::iterator & col_end) const
{
  out.fill(fill_char);
  out << std::right << intersect_char << std::setw(_column_width+2) << intersect_char;
  for (std::set<std::string>::iterator header = col_begin; header != col_end; ++header)
    out << std::setw(col_widths[*header]+2) << intersect_char;
  out << "\n";

  // Clear the fill character
  out.fill(' ');
}
开发者ID:JasonTurner56,项目名称:ARL,代码行数:14,代码来源:FormattedTable.C

示例10: Print

void StackFrame::Print(std::ostream &stream) const {
  char old_fill = stream.fill('0');

  stream << std::hex << std::setw(8)
         << reinterpret_cast<long>(return_address_)
         << std::dec;

  stream.fill(old_fill);

  if (!callee_name_.empty()) {
    stream << " in " << callee_name_ << " ()";
  } else {
    stream << " in ?? ()";
  }
}
开发者ID:Bloodhacker,项目名称:samp-plugin-crashdetect,代码行数:15,代码来源:stacktrace.cpp

示例11: printAlignedFP

// printAlignedFP - Simulate the printf "%A.Bf" format, where A is the
// TotalWidth size, and B is the AfterDec size.
//
static void printAlignedFP(double Val, unsigned AfterDec, unsigned TotalWidth,
                           std::ostream &OS) {
  assert(TotalWidth >= AfterDec+1 && "Bad FP Format!");
  OS.width(TotalWidth-AfterDec-1);
  char OldFill = OS.fill();
  OS.fill(' ');
  OS << (int)Val;  // Integer part;
  OS << ".";
  OS.width(AfterDec);
  OS.fill('0');
  unsigned ResultFieldSize = 1;
  while (AfterDec--) ResultFieldSize *= 10;
  OS << (int)(Val*ResultFieldSize) % ResultFieldSize;
  OS.fill(OldFill);
}
开发者ID:Killfrra,项目名称:llvm-kernel,代码行数:18,代码来源:Timer.cpp

示例12: hexDump

void hexDump(std::ostream &o,void const *v,uint cb,uint cbDone)
{
    boost::io::ios_all_saver streamStateSaver(o);

    PConstBuffer b = (PConstBuffer) v;
    uint cbLine = 16, cbThis;
    o.fill('0');
    for (; cb; cb -= cbThis, cbDone += cbThis) {
        cbThis = std::min(cbLine, cb);
        o << std::hex;
        o.width(4);
        o << cbDone << ": ";
        uint i;
        for (i = 0; i < cbThis; i++, b++) {
            o.width(2);
            o << (uint) *b << " ";
        }
        for (i = cbThis; i < cbLine; i++) {
            o << "   ";
        }
        o << "| ";
        for (i = 0, b -= cbThis; i < cbThis; i++, b++) {
            if (isprint(*b)) {
                o << *b;
            } else {
                o << " ";
            }
        }
        o << std::endl;
    }
}
开发者ID:Jach,项目名称:luciddb,代码行数:31,代码来源:Memory.cpp

示例13: print_in_readelf_style

void print_in_readelf_style(std::ostream& s, const core::Cie& cie)
{
	// first line is section-offset, length-not-including-length-field, zeroes, "CIE"
	s.width(8);
	s.fill('0');
	s 	<< setw(8) << setfill('0') << std::hex << cie.get_offset()
		<< ' ' 
		<< setw(16) << setfill('0') << std::hex << cie.get_bytes_in_cie()
		<< ' ' 
		<< setw(8) << setfill('0') << 0 << std::dec
		<< " CIE"
		<< endl;
	// cie fields come next
	s 	<< "  Version:               " << (int) cie.get_version()                 << endl
		<< "  Augmentation:          \"" << cie.get_augmenter() << "\""  << endl
		<< "  Code alignment factor: " << cie.get_code_alignment_factor() << endl
		<< "  Data alignment factor: " << cie.get_data_alignment_factor() << endl
		<< "  Return address column: " << cie.get_return_address_register_rule() << endl
		<< "  Augmentation data:     ";
	auto augbytes = cie.get_augmentation_bytes();
	for (auto i_byte = augbytes.begin(); i_byte != augbytes.end(); ++i_byte)
	{
		if (i_byte != augbytes.begin()) s << ' ';
		s << std::hex << setw(2) << setfill('0') << (unsigned) *i_byte;
	}
	s << std::dec << endl;
	
	s << endl;
	
	/* Now we need to print the "initial instructions". */
	encap::frame_instrlist initial_instrs(cie, /* FIXME */ 8, cie.initial_instructions_seq());
	print_in_readelf_style(s, initial_instrs, -1);
}
开发者ID:stephenrkell,项目名称:libdwarfpp,代码行数:33,代码来源:fde-print.cpp

示例14: generate_source_font_data

void generate_source_font_data(std::ostream& os, const txtvc::bfgfont& font,
    const std::string& font_data_identifier)
{
    const int bytes_per_line = 8;
    const boost::io::ios_fill_saver fill_saver(os);
    const boost::io::ios_width_saver width_saver(os);
    const boost::io::ios_flags_saver flags_saver(os);

    // Dump font data
    os << "static const uint8_t " << font_data_identifier << "[] =" << std::endl;
    os << "{" << std::endl;
    os << std::hex;
    os.fill('0');
    int count = 0;
    for (auto byte : font.data())
    {
        if (count % bytes_per_line == 0)
        {
            os << indent;
        }
        os << "0x" << std::setw(2) << int(byte) << ", ";
        if (count % bytes_per_line == bytes_per_line - 1)
        {
            os << std::endl;
        }
        ++count;
    }
    os << "};" << std::endl << std::endl;
}
开发者ID:tom42,项目名称:txtvc,代码行数:29,代码来源:bfg.cpp

示例15: check_command

size_t basic_fmt::check_command(std::ostream& formatter)
{
    fmt_command cmd;
    ostream_string_output output(formatter);
    
    size_t cmd_pos = process_fmt(this->fmt_, this->pos_, cmd, output);
    if( cmd_pos == (size_t)-1 ) 
        throw format_exception("basic_fmt: too many actual arguments");
    if( cmd.fill )
        formatter.fill(cmd.fill);
    if( cmd.width )
        formatter.width(cmd.width);
    if( cmd.precision )
        formatter.precision(cmd.precision);
    
    switch( cmd.command ) {
    case 's':
    case 'i':
    case 'd':
        std::dec(formatter);
        break;
    case 'x':
        std::hex(formatter);
        break;
    default:
        throw format_exception(fmt("basic_fmt: bad format command %s") % cmd.command);
    }
    return cmd_pos;
}
开发者ID:zbigg,项目名称:tinfra,代码行数:29,代码来源:fmt.cpp


注:本文中的std::ostream::fill方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。