diff options
author | David Robillard <d@drobilla.net> | 2024-06-04 15:01:57 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2024-06-04 15:01:57 -0400 |
commit | 5ce1f36d4202046661411481a30cc13101862575 (patch) | |
tree | 32222a8b5f83e34d3a9191d50a81e984560f7a34 | |
parent | c94e92befcc94fca6d0639c2fd562762d152d46f (diff) | |
download | patchage-5ce1f36d4202046661411481a30cc13101862575.tar.gz patchage-5ce1f36d4202046661411481a30cc13101862575.tar.bz2 patchage-5ce1f36d4202046661411481a30cc13101862575.zip |
Avoid std::endl
-rw-r--r-- | src/Configuration.cpp | 40 | ||||
-rw-r--r-- | src/UIFile.hpp | 6 | ||||
-rw-r--r-- | src/main.cpp | 4 |
3 files changed, 24 insertions, 26 deletions
diff --git a/src/Configuration.cpp b/src/Configuration.cpp index 9bb2ac6..d434aeb 100644 --- a/src/Configuration.cpp +++ b/src/Configuration.cpp @@ -192,13 +192,13 @@ Configuration::load() for (const auto& filename : filenames) { file.open(filename.c_str(), std::ios::in); if (file.good()) { - std::cout << "Loading configuration from " << filename << std::endl; + std::cout << "Loading configuration from " << filename << "\n"; break; } } if (!file.good()) { - std::cout << "No configuration file present" << std::endl; + std::cout << "No configuration file present\n"; return; } @@ -253,8 +253,7 @@ Configuration::load() } } if (!found) { - std::cerr << "error: color for unknown port type `" << type_name << "'" - << std::endl; + std::cerr << "error: color for unknown port type `" << type_name << "'\n"; } } else if (key == "module_position") { Coord loc; @@ -273,7 +272,7 @@ Configuration::load() type = SignalDirection::duplex; } else { std::cerr << "error: bad position type `" << type_str - << "' for module `" << name << "'" << std::endl; + << "' for module `" << name << "'\n"; file.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); continue; } @@ -283,8 +282,7 @@ Configuration::load() set_module_location(name, type, loc); } else { - std::cerr << "warning: unknown configuration key `" << key << "'" - << std::endl; + std::cerr << "warning: unknown configuration key `" << key << "'\n"; file.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); } @@ -304,7 +302,7 @@ write_module_position(std::ofstream& os, const Coord& loc) { os << "module_position \"" << name << "\"" - << " " << type << " " << loc.x << " " << loc.y << std::endl; + << " " << type << " " << loc.x << " " << loc.y << "\n"; } void @@ -316,36 +314,36 @@ Configuration::save() for (const std::string& filename : filenames) { file.open(filename.c_str(), std::ios::out); if (file.good()) { - std::cout << "Writing configuration to " << filename << std::endl; + std::cout << "Writing configuration to " << filename << "\n"; break; } } if (!file.good()) { - std::cout << "Unable to open configuration file to write" << std::endl; + std::cout << "Unable to open configuration file to write\n"; return; } file << "window_location " << get<setting::WindowLocation>().x << " " - << get<setting::WindowLocation>().y << std::endl; + << get<setting::WindowLocation>().y << "\n"; file << "window_size " << get<setting::WindowSize>().x << " " - << get<setting::WindowSize>().y << std::endl; + << get<setting::WindowSize>().y << "\n"; - file << "zoom_level " << get<setting::Zoom>() << std::endl; - file << "font_size " << get<setting::FontSize>() << std::endl; - file << "show_toolbar " << get<setting::ToolbarVisible>() << std::endl; - file << "sprung_layout " << get<setting::SprungLayout>() << std::endl; - file << "show_messages " << get<setting::MessagesVisible>() << std::endl; - file << "sort_ports " << get<setting::SortedPorts>() << std::endl; - file << "messages_height " << get<setting::MessagesHeight>() << std::endl; - file << "human_names " << get<setting::HumanNames>() << std::endl; + file << "zoom_level " << get<setting::Zoom>() << "\n"; + file << "font_size " << get<setting::FontSize>() << "\n"; + file << "show_toolbar " << get<setting::ToolbarVisible>() << "\n"; + file << "sprung_layout " << get<setting::SprungLayout>() << "\n"; + file << "show_messages " << get<setting::MessagesVisible>() << "\n"; + file << "sort_ports " << get<setting::SortedPorts>() << "\n"; + file << "messages_height " << get<setting::MessagesHeight>() << "\n"; + file << "human_names " << get<setting::HumanNames>() << "\n"; file << std::hex << std::uppercase; for (unsigned i = 0U; i < n_port_types; ++i) { if (_port_colors[i] != _default_port_colors[i]) { file << "port_color " << port_type_names[i] << " " << _port_colors[i] - << std::endl; + << "\n"; } } file << std::dec << std::nouppercase; diff --git a/src/UIFile.hpp b/src/UIFile.hpp index 36be144..38a46b1 100644 --- a/src/UIFile.hpp +++ b/src/UIFile.hpp @@ -41,7 +41,7 @@ public: if (!bundle.empty()) { const std::string bundle_ui_filename = bundle + "/" + ui_filename; if (is_readable(bundle_ui_filename)) { - std::cout << "Loading UI file " << bundle_ui_filename << std::endl; + std::cout << "Loading UI file " << bundle_ui_filename << "\n"; return Gtk::Builder::create_from_file(bundle_ui_filename); } } @@ -49,12 +49,12 @@ public: ui_filename = std::string(PATCHAGE_DATA_DIR) + "/" + ui_filename; if (is_readable(ui_filename)) { - std::cout << "Loading UI file " << ui_filename << std::endl; + std::cout << "Loading UI file " << ui_filename << "\n"; return Gtk::Builder::create_from_file(ui_filename); } std::stringstream ss; - ss << "Unable to find " << ui_filename << std::endl; + ss << "Unable to find " << ui_filename << "\n"; throw std::runtime_error(ss.str()); return {}; } diff --git a/src/main.cpp b/src/main.cpp index 6d09fe4..0f4d1b0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -148,10 +148,10 @@ main(int argc, char** argv) patchage.save(); } catch (std::exception& e) { - std::cerr << "patchage: error: " << e.what() << std::endl; + std::cerr << "patchage: error: " << e.what() << "\n"; return 1; } catch (Glib::Exception& e) { - std::cerr << "patchage: error: " << e.what() << std::endl; + std::cerr << "patchage: error: " << e.what() << "\n"; return 1; } |