From 4f6bd3b2d5d42456b55b54817ff3d0d9e46c4feb Mon Sep 17 00:00:00 2001 From: Nikolay Polyanovskii Date: Fri, 6 Jun 2014 05:01:31 -0500 Subject: [PATCH] [Summary] Move function remove_pattern_from_string(...) to ardour/utils.h(cc) [Reviewed] GZharun [git-p4: depot-paths = "//Abdaw/dev_main/tracks/": change = 465780] --- gtk2_ardour/tracks_control_panel.logic.cc | 15 ++------------- libs/ardour/ardour/utils.h | 2 ++ libs/ardour/session.cc | 13 ------------- libs/ardour/utils.cc | 13 +++++++++++++ 4 files changed, 17 insertions(+), 26 deletions(-) diff --git a/gtk2_ardour/tracks_control_panel.logic.cc b/gtk2_ardour/tracks_control_panel.logic.cc index 9a5efab7b9..3783678b90 100644 --- a/gtk2_ardour/tracks_control_panel.logic.cc +++ b/gtk2_ardour/tracks_control_panel.logic.cc @@ -28,6 +28,7 @@ #include "ardour/engine_state_controller.h" #include "ardour/rc_configuration.h" +#include "ardour/utils.h" #include "ardour_ui.h" #include "gui_thread.h" #include "utils.h" @@ -45,19 +46,7 @@ using namespace Glib; #define dbg_msg(a) MessageDialog (a, PROGRAM_NAME).run(); namespace { - bool remove_pattern_from_string(const std::string& in_str, const std::string& pattern, std::string& out_str) { - - out_str.assign(in_str); - - size_t pos = in_str.find(pattern); - if ( pos != std::string::npos ) { - out_str.erase(pos, pattern.length() ); - return true; - } else { - return false; - } - } - + static const char* audio_port_name_prefix = "system:"; static const char* midi_port_name_prefix = "system_midi:"; static const char* midi_capture_suffix = " capture"; diff --git a/libs/ardour/ardour/utils.h b/libs/ardour/ardour/utils.h index 6dba01c797..4164515046 100644 --- a/libs/ardour/ardour/utils.h +++ b/libs/ardour/ardour/utils.h @@ -170,6 +170,8 @@ LIBARDOUR_API bool matching_unsuffixed_filename_exists_in (const std::string& di LIBARDOUR_API uint32_t how_many_dsp_threads (); +LIBARDOUR_API bool remove_pattern_from_string(const std::string& in_str, const std::string& pattern, std::string& out_str); + #if __APPLE__ LIBARDOUR_API std::string CFStringRefToStdString(CFStringRef stringRef); #endif // __APPLE__ diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 316ce78672..59db5e2a81 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -138,19 +138,6 @@ PBD::Signal2 Session::VersionMismatch; static void clean_up_session_event (SessionEvent* ev) { delete ev; } const SessionEvent::RTeventCallback Session::rt_cleanup (clean_up_session_event); -namespace { - // if pattern is not found out_str == in_str - bool remove_pattern_from_string(const std::string& in_str, const std::string& pattern, std::string& out_str) { - if (in_str.find(pattern) != std::string::npos ) { - out_str = in_str.substr(pattern.size() ); - return true; - } else { - out_str = in_str; - return false; - } - } -} - /** @param snapshot_name Snapshot name, without .ardour suffix */ Session::Session (AudioEngine &eng, const string& fullpath, diff --git a/libs/ardour/utils.cc b/libs/ardour/utils.cc index d1d2372977..56e91f77b0 100644 --- a/libs/ardour/utils.cc +++ b/libs/ardour/utils.cc @@ -730,6 +730,19 @@ double slider_position_to_gain_with_max (double g, double max_gain) return slider_position_to_gain (g * max_gain/2.0); } +bool remove_pattern_from_string(const std::string& in_str, const std::string& pattern, std::string& out_str) { + + out_str.assign(in_str); + + size_t pos = in_str.find(pattern); + if ( pos != std::string::npos ) { + out_str.erase(pos, pattern.length() ); + return true; + } else { + return false; + } +} + extern "C" { void c_stacktrace() { stacktrace (cerr); } }