[Summary] Move function remove_pattern_from_string(...) to ardour/utils.h(cc)

[Reviewed] GZharun

[git-p4: depot-paths = "//Abdaw/dev_main/tracks/": change = 465780]
This commit is contained in:
Nikolay Polyanovskii 2014-06-06 05:01:31 -05:00 committed by Paul Davis
parent 13862fbdb6
commit 4f6bd3b2d5
4 changed files with 17 additions and 26 deletions

View file

@ -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";

View file

@ -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__

View file

@ -138,19 +138,6 @@ PBD::Signal2<void,std::string,std::string> 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,

View file

@ -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); }
}