本文整理汇总了C++中endl函数的典型用法代码示例。如果您正苦于以下问题:C++ endl函数的具体用法?C++ endl怎么用?C++ endl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了endl函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: endl
FormattedOutput& FormattedOutput::print(const char* str, size_t len) {
for (size_t i = 0; i < len; ++i) {
if (str[i] == '{') {
line_ << '{';
++offset_;
endl();
}
else if (str[i] == '}') {
endl();
--offset_;
print_offset();
line_ << '}';
endl();
}
else {
if (line_.str().empty() && !std::isspace(str[i])) {
print_offset();
line_ << str[i];
}
else if (!line_.str().empty())
line_ << str[i];
}
}
return *this;
}
示例2: ALOGE
status_t ArcHmbPlayerBinder::onTransact(uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) {
ALOGE("ArcHmbPlayerBinder::onTransact(%i) %i", code, flags);
/*
* Before executing actual method, check whether the RPC are from expected client.
* Client will write interface token, to identify interface to which those methods
* belong.
*/
if (!data.enforceInterface(ArcHmbPlayerInterface::DESCRIPTOR)) {
ALOGE("failed to check Interface, you might call wrong service, this is for '%s'",
String8(ArcHmbPlayerInterface::DESCRIPTOR).string());
return BAD_TYPE;
}
data.print(aout);
endl(aout);
switch(code) {
case ArcHmbPlayerInterface::PRINT: {
String16 msg = data.readString16();
print(String8(msg).string());
return NO_ERROR;
}
case ArcHmbPlayerInterface::ADD: {
int32_t a = data.readInt32();
int32_t b = data.readInt32();
int32_t sum = add(a, b);
ALOGE("ArcHmbPlayerBinder:onTransact add(%i, %i) = %i", a, b, sum);
reply->print(aout); endl(aout);
reply->writeInt32(sum);
return NO_ERROR;
}
default:
ALOGE("ArcHmbPlayerBinder, bad requesting code, no match found");
}
return BBinder::onTransact(code, data, reply, flags);
}
示例3: ts
void ScribusQApp::showUsage()
{
QFile f;
f.open(stderr, QIODevice::WriteOnly);
QTextStream ts(&f);
ts << tr("Usage: scribus [option ... ] [file]") ; endl(ts);
ts << tr("Options:") ; endl(ts);
printArgLine(ts, ARG_FONTINFO_SHORT, ARG_FONTINFO, tr("Show information on the console when fonts are being loaded") );
printArgLine(ts, ARG_HELP_SHORT, ARG_HELP, tr("Print help (this message) and exit") );
printArgLine(ts, ARG_LANG_SHORT, ARG_LANG, tr("Uses xx as shortcut for a language, eg `en' or `de'") );
printArgLine(ts, ARG_AVAILLANG_SHORT, ARG_AVAILLANG, tr("List the currently installed interface languages") );
printArgLine(ts, ARG_NOSPLASH_SHORT, ARG_NOSPLASH, tr("Do not show the splashscreen on startup") );
printArgLine(ts, ARG_NEVERSPLASH_SHORT, ARG_NEVERSPLASH, tr("Stop the showing of the splashscreen on startup. Writes an empty file called .neversplash in ~/.scribus.") );
printArgLine(ts, ARG_PREFS_SHORT, QString(QString(ARG_PREFS) + QString(" ") + tr("filename")).toLocal8Bit().constData(), tr("Use filename as path for user given preferences") );
printArgLine(ts, ARG_PROFILEINFO_SHORT, ARG_PROFILEINFO, tr("Show location ICC profile information on console while starting") );
printArgLine(ts, ARG_SWAPDIABUTTONS_SHORT, ARG_SWAPDIABUTTONS, tr("Use right to left dialog button ordering (eg. Cancel/No/Yes instead of Yes/No/Cancel)") );
printArgLine(ts, ARG_UPGRADECHECK_SHORT, ARG_UPGRADECHECK, tr("Download a file from the Scribus website and show the latest available version.") );
printArgLine(ts, ARG_VERSION_SHORT, ARG_VERSION, tr("Output version information and exit") );
#if defined(_WIN32) && !defined(_CONSOLE)
printArgLine(ts, ARG_CONSOLE_SHORT, ARG_CONSOLE, tr("Display a console window") );
#endif
/* Delete me?
std::cout << "-file|-- name Open file 'name'" ; endl(ts);
std::cout << "name Open file 'name', the file name must not begin with '-'" ; endl(ts);
std::cout << "QT specific options as -display ..." ; endl(ts);
*/
endl(ts);
}
示例4: popStack
void
ZDriver::writeParserUtilDecl( std::ostream &out )
{
out << " void popStack( void );" << endl();
out << " ParserAct findParserAction( int &newVal, int tok );"
<< endl();
out << " void initTables( void );" << endl();
}
示例5: endl
void
ZDriver::emitFuncBreak( std::ostream &out )
{
out << endl();
out << endl();
out << "////////////////////////////////////////" << endl();
out << endl();
out << endl();
}
示例6: ts
void LanguageManager::printInstalledList()
{
QFile f;
f.open(stderr, QIODevice::WriteOnly);
QTextStream ts(&f);
for (int i = 0; i < langTable.size(); ++i)
{
ts << " " << langTable[i].m_priAbbrev.leftJustified(8) << ": " << langTable[i].m_name;
endl(ts);
}
endl(ts);
f.close();
}
示例7: getValue
void
ZDriver::writeAcceptFuncDecl( std::ostream &out )
{
const std::string &extraArg = getValue( "extra_argument" ).first;
if ( isValueSet( "parse_accept" ) )
{
if ( extraArg.empty() )
out << " void accept( void );" << endl();
else
out << " void accept( " << extraArg << " );" << endl();
}
}
示例8: ts
void ScribusQApp::showAvailLangs()
{
QFile f;
f.open(stderr, QIODevice::WriteOnly);
QTextStream ts(&f);
ts << tr("Installed interface languages for Scribus are as follows:"); endl(ts);
endl(ts);
LanguageManager::instance()->printInstalledList();
endl(ts);
ts << tr("To override the default language choice:"); endl(ts);
ts << tr("scribus -l xx or scribus --lang xx, where xx is the language of choice."); endl(ts);
}
示例9: tr
void LogBrowserDialog::save()
{
QString saveFileName = QFileDialog::getSaveFileName(this, tr("Save Log Output"),
tr("%1/logfile.txt").arg(QDir::homePath()),
tr("Text Files (*.txt);;All Files (*)"));
if (saveFileName.isEmpty()) {
return;
}
QFile file(saveFileName);
if (!file.open(QIODevice::WriteOnly)) {
QMessageBox::warning(this, tr("Error"), QString(tr("<nobr>File '%1'<br/>cannot be opened for writing.<br/><br/>"
"The log output could <b>not</b> be saved!</nobr>")).arg(saveFileName));
return;
}
QTextStream stream(&file);
for (int row = 0; row < _browser->rowCount(); row++) {
if (_browser->item(row, 0)) {
stream << tr("Warning: ");
}
stream << _browser->item(row, 1)->text();
endl(stream);
}
file.close();
}
示例10: emitFuncBreak
void
ZDriver::writeImplClassCtorDtor( std::ostream &out )
{
emitFuncBreak( out );
out << myPimplName << "::" << myPimplName
<< "( void )" << endl();
out << " : myErrCount( -1 )" << endl();
out << "{" << endl();
out << " initTables();" << endl();
out << "}" << endl();
emitFuncBreak( out );
out << myPimplName << "::~" << myPimplName
<< "( void )" << endl();
out << "{" << endl();
out << " while ( ! myStack.empty() )" << endl();
out << " popStack();" << endl();
out << "}" << endl();
}
示例11: drawBar
void drawBar()
{
out << "[";
const unsigned stop = value * width / max;
for(unsigned i = 0; i < width; ++i) {
out << (i <= stop? '*' : ' ');
}
out << "] " << std::min<int>(100, value * 100 / max + 1) << "\n";
endl();
}
示例12: f
bool PythonHandler::exportData(regina::NPacket* data, const QString& fileName,
QWidget* parentWidget) const {
regina::NScript* script = dynamic_cast<regina::NScript*>(data);
QFile f(fileName);
if (! f.open(QIODevice::WriteOnly)) {
ReginaSupport::warn(parentWidget,
QObject::tr("The export failed."),
QObject::tr("<qt>I could not write to the file <tt>%1</tt>.</qt>").
arg(fileName.toHtmlEscaped()));
return false;
}
QTextStream out(&f);
out.setCodec(ReginaPrefSet::importExportCodec());
// Write the name of the script.
out << "### " << scriptMarker << ' ';
out << QString(script->label().c_str());
endl(out);
out << "###";
endl(out);
// Output the value of each variable.
unsigned long i;
regina::NPacket* value;
for (i = 0; i < script->countVariables(); i++) {
value = script->variableValue(i);
out << "### " << varMarker
<< QString(script->variableName(i).c_str())
<< ": " << (value ? QString(value->label().c_str()) : "");
endl(out);
}
out << "###";
endl(out);
out << "### " << endMetadataMarker;
endl(out);
out << script->text().c_str();
// All done!
return true;
}
示例13: main
int main()
{
{
testbuf<char> sb;
std::ostream os(&sb);
endl(os);
assert(sb.str() == "\n");
assert(sync_called == 1);
assert(os.good());
}
{
testbuf<wchar_t> sb;
std::wostream os(&sb);
endl(os);
assert(sb.str() == L"\n");
assert(sync_called == 2);
assert(os.good());
}
}
示例14: endl
//-------------------------------------------------------------------------------------------------
// begin of new line
log& log::beginLine(int col, int style)
{
if ( !isLineEnded )
{
*this << efont;
endl( *this );
}
*this << font(col, style);
isLineEnded = false;
return *this;
}
示例15: printArgLine
/*! \brief Format an arguments line for printing
Helper procedure */
static void printArgLine(QTextStream & ts, const char * smallArg,
const char* fullArg, const QString desc)
{
const char* lineformat = " %1, %2 %3";
const int saw = 4; // Short argument width
const int aw = -18; // Argument width (negative is left aligned)
QString line = QString(lineformat)
.arg(smallArg, saw)
.arg(fullArg, aw)
.arg(desc);
ts << line;
endl(ts);
}