Merge pull request #1013 from p12tic/cleanup-std-endl

lib: Remove unnecessary use of std::endl
This commit is contained in:
Povilas Kanapickas 2021-01-10 14:48:24 +02:00 committed by GitHub
commit 773b5b5362
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 54 additions and 54 deletions

View File

@ -79,9 +79,9 @@ App::~App()
void void
App::version() App::version()
{ {
std::cout << argsBase().m_exename << " " << kVersion << std::endl; std::cout << argsBase().m_exename << " " << kVersion << "\n";
std::cout <<"Protocol version " << kProtocolMajorVersion << "." << kProtocolMinorVersion << std::endl; std::cout <<"Protocol version " << kProtocolMajorVersion << "." << kProtocolMinorVersion << "\n";
std::cout << kCopyright << std::endl; std::cout << kCopyright << "\n";
} }
int int

View File

@ -118,23 +118,23 @@ ClientApp::help()
#endif #endif
std::ostringstream buffer; std::ostringstream buffer;
buffer << "Start the barrier client and connect to a remote server component." << std::endl buffer << "Start the barrier client and connect to a remote server component.\n"
<< std::endl << "\n"
<< "Usage: " << args().m_exename << " [--yscroll <delta>]" << WINAPI_ARG << HELP_SYS_ARGS << "Usage: " << args().m_exename << " [--yscroll <delta>]" << WINAPI_ARG << HELP_SYS_ARGS
<< HELP_COMMON_ARGS << " <server-address>" << std::endl << HELP_COMMON_ARGS << " <server-address>\n"
<< std::endl << "\n"
<< "Options:" << std::endl << "Options:\n"
<< HELP_COMMON_INFO_1 << WINAPI_INFO << HELP_SYS_INFO << HELP_COMMON_INFO_1 << WINAPI_INFO << HELP_SYS_INFO
<< " --yscroll <delta> defines the vertical scrolling delta, which is" << std::endl << " --yscroll <delta> defines the vertical scrolling delta, which is\n"
<< " 120 by default." << std::endl << " 120 by default.\n"
<< HELP_COMMON_INFO_2 << HELP_COMMON_INFO_2
<< std::endl << "\n"
<< "Default options are marked with a *" << std::endl << "Default options are marked with a *\n"
<< std::endl << "\n"
<< "The server address is of the form: [<hostname>][:<port>]. The hostname" << std::endl << "The server address is of the form: [<hostname>][:<port>]. The hostname\n"
<< "must be the address or hostname of the server. Placing brackets around" << std::endl << "must be the address or hostname of the server. Placing brackets around\n"
<< "an IPv6 address is required when also specifying a port number and " << std::endl << "an IPv6 address is required when also specifying a port number and \n"
<< "optional otherwise. The default port number is " << kDefaultPort << "." << std::endl; << "optional otherwise. The default port number is " << kDefaultPort << ".\n";
LOG((CLOG_PRINT "%s", buffer.str().c_str())); LOG((CLOG_PRINT "%s", buffer.str().c_str()));
} }

View File

@ -135,29 +135,29 @@ ServerApp::help()
} }
std::ostringstream buffer; std::ostringstream buffer;
buffer << "Start the barrier server component." << std::endl buffer << "Start the barrier server component.\n"
<< std::endl << "\n"
<< "Usage: " << args().m_exename << "Usage: " << args().m_exename
<< " [--address <address>]" << " [--address <address>]"
<< " [--config <pathname>]" << " [--config <pathname>]"
<< WINAPI_ARGS << HELP_SYS_ARGS << HELP_COMMON_ARGS << std::endl << WINAPI_ARGS << HELP_SYS_ARGS << HELP_COMMON_ARGS << "\n"
<< std::endl << "\n"
<< "Options:" << std::endl << "Options:\n"
<< " -a, --address <address> listen for clients on the given address." << std::endl << " -a, --address <address> listen for clients on the given address.\n"
<< " -c, --config <pathname> use the named configuration file instead." << std::endl << " -c, --config <pathname> use the named configuration file instead.\n"
<< HELP_COMMON_INFO_1 << WINAPI_INFO << HELP_SYS_INFO << HELP_COMMON_INFO_2 << std::endl << HELP_COMMON_INFO_1 << WINAPI_INFO << HELP_SYS_INFO << HELP_COMMON_INFO_2 << "\n"
<< "Default options are marked with a *" << std::endl << "Default options are marked with a *\n"
<< std::endl << "\n"
<< "The argument for --address is of the form: [<hostname>][:<port>]. The" << std::endl << "The argument for --address is of the form: [<hostname>][:<port>]. The\n"
<< "hostname must be the address or hostname of an interface on the system." << std::endl << "hostname must be the address or hostname of an interface on the system.\n"
<< "Placing brackets around an IPv6 address is required when also specifying " << std::endl << "Placing brackets around an IPv6 address is required when also specifying \n"
<< "a port number and optional otherwise. The default is to listen on all" << std::endl << "a port number and optional otherwise. The default is to listen on all\n"
<< "interfaces using port number " << kDefaultPort << "." << std::endl << "interfaces using port number " << kDefaultPort << ".\n"
<< std::endl << "\n"
<< "If no configuration file pathname is provided then the first of the" << std::endl << "If no configuration file pathname is provided then the first of the\n"
<< "following to load successfully sets the configuration:" << std::endl << "following to load successfully sets the configuration:\n"
<< " " << PathUtilities::concat(profilePath, USR_CONFIG_NAME) << std::endl << " " << PathUtilities::concat(profilePath, USR_CONFIG_NAME) << "\n"
<< " " << PathUtilities::concat(DataDirectories::systemconfig(), SYS_CONFIG_NAME) << std::endl; << " " << PathUtilities::concat(DataDirectories::systemconfig(), SYS_CONFIG_NAME) << "\n";
LOG((CLOG_PRINT "%s", buffer.str().c_str())); LOG((CLOG_PRINT "%s", buffer.str().c_str()));
} }

View File

@ -126,7 +126,7 @@ AppUtilWindows::beforeAppExit()
// a new console window, and will normally close on exit (making it so // a new console window, and will normally close on exit (making it so
// that we can't see error messages). // that we can't see error messages).
if (app().argsBase().m_pauseOnExit) { if (app().argsBase().m_pauseOnExit) {
std::cout << std::endl << "press any key to exit..." << std::endl; std::cout << "\n" << "press any key to exit...\n";
int c = _getch(); int c = _getch();
} }
} }

View File

@ -1748,10 +1748,10 @@ std::ostream&
operator<<(std::ostream& s, const Config& config) operator<<(std::ostream& s, const Config& config)
{ {
// screens section // screens section
s << "section: screens" << std::endl; s << "section: screens\n";
for (Config::const_iterator screen = config.begin(); for (Config::const_iterator screen = config.begin();
screen != config.end(); ++screen) { screen != config.end(); ++screen) {
s << "\t" << screen->c_str() << ":" << std::endl; s << "\t" << screen->c_str() << ":\n";
const Config::ScreenOptions* options = config.getOptions(*screen); const Config::ScreenOptions* options = config.getOptions(*screen);
if (options != NULL && options->size() > 0) { if (options != NULL && options->size() > 0) {
for (Config::ScreenOptions::const_iterator for (Config::ScreenOptions::const_iterator
@ -1760,19 +1760,19 @@ operator<<(std::ostream& s, const Config& config)
const char* name = Config::getOptionName(option->first); const char* name = Config::getOptionName(option->first);
std::string value = Config::getOptionValue(option->first, option->second); std::string value = Config::getOptionValue(option->first, option->second);
if (name != NULL && !value.empty()) { if (name != NULL && !value.empty()) {
s << "\t\t" << name << " = " << value << std::endl; s << "\t\t" << name << " = " << value << "\n";
} }
} }
} }
} }
s << "end" << std::endl; s << "end\n";
// links section // links section
std::string neighbor; std::string neighbor;
s << "section: links" << std::endl; s << "section: links\n";
for (Config::const_iterator screen = config.begin(); for (Config::const_iterator screen = config.begin();
screen != config.end(); ++screen) { screen != config.end(); ++screen) {
s << "\t" << screen->c_str() << ":" << std::endl; s << "\t" << screen->c_str() << ":\n";
for (Config::link_const_iterator for (Config::link_const_iterator
link = config.beginNeighbor(*screen), link = config.beginNeighbor(*screen),
@ -1781,10 +1781,10 @@ operator<<(std::ostream& s, const Config& config)
Config::formatInterval(link->first.getInterval()) << Config::formatInterval(link->first.getInterval()) <<
" = " << link->second.getName().c_str() << " = " << link->second.getName().c_str() <<
Config::formatInterval(link->second.getInterval()) << Config::formatInterval(link->second.getInterval()) <<
std::endl; "\n";
} }
} }
s << "end" << std::endl; s << "end\n";
// aliases section (if there are any) // aliases section (if there are any)
if (config.m_map.size() != config.m_nameToCanonicalName.size()) { if (config.m_map.size() != config.m_nameToCanonicalName.size()) {
@ -1802,20 +1802,20 @@ operator<<(std::ostream& s, const Config& config)
// dump it // dump it
std::string screen; std::string screen;
s << "section: aliases" << std::endl; s << "section: aliases\n";
for (CMNameMap::const_iterator index = aliases.begin(); for (CMNameMap::const_iterator index = aliases.begin();
index != aliases.end(); ++index) { index != aliases.end(); ++index) {
if (index->first != screen) { if (index->first != screen) {
screen = index->first; screen = index->first;
s << "\t" << screen.c_str() << ":" << std::endl; s << "\t" << screen.c_str() << ":\n";
} }
s << "\t\t" << index->second.c_str() << std::endl; s << "\t\t" << index->second.c_str() << "\n";
} }
s << "end" << std::endl; s << "end\n";
} }
// options section // options section
s << "section: options" << std::endl; s << "section: options\n";
const Config::ScreenOptions* options = config.getOptions(""); const Config::ScreenOptions* options = config.getOptions("");
if (options != NULL && options->size() > 0) { if (options != NULL && options->size() > 0) {
for (Config::ScreenOptions::const_iterator for (Config::ScreenOptions::const_iterator
@ -1824,16 +1824,16 @@ operator<<(std::ostream& s, const Config& config)
const char* name = Config::getOptionName(option->first); const char* name = Config::getOptionName(option->first);
std::string value = Config::getOptionValue(option->first, option->second); std::string value = Config::getOptionValue(option->first, option->second);
if (name != NULL && !value.empty()) { if (name != NULL && !value.empty()) {
s << "\t" << name << " = " << value << std::endl; s << "\t" << name << " = " << value << "\n";
} }
} }
} }
if (config.m_barrierAddress.isValid()) { if (config.m_barrierAddress.isValid()) {
s << "\taddress = " << s << "\taddress = " <<
config.m_barrierAddress.getHostname().c_str() << std::endl; config.m_barrierAddress.getHostname().c_str() << "\n";
} }
s << config.m_inputFilter.format("\t"); s << config.m_inputFilter.format("\t");
s << "end" << std::endl; s << "end\n";
return s; return s;
} }