Use std::string for order key map.
git-svn-id: svn://localhost/ardour2/branches/3.0@5318 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
@@ -88,8 +88,8 @@ class Route : public SessionObject, public AutomatableControls
|
||||
|
||||
bool set_name (const std::string& str);
|
||||
|
||||
long order_key (const char* name) const;
|
||||
void set_order_key (const char* name, long n);
|
||||
long order_key (std::string const &) const;
|
||||
void set_order_key (std::string const &, long);
|
||||
|
||||
bool is_hidden() const { return _flags & Hidden; }
|
||||
bool is_master() const { return _flags & MasterOut; }
|
||||
@@ -312,8 +312,8 @@ class Route : public SessionObject, public AutomatableControls
|
||||
uint32_t remote_control_id () const;
|
||||
sigc::signal<void> RemoteControlIDChanged;
|
||||
|
||||
void sync_order_keys (const char* base);
|
||||
static sigc::signal<void,const char*> SyncOrderKeys;
|
||||
void sync_order_keys (std::string const &);
|
||||
static sigc::signal<void, std::string const &> SyncOrderKeys;
|
||||
|
||||
protected:
|
||||
friend class Session;
|
||||
@@ -399,13 +399,7 @@ class Route : public SessionObject, public AutomatableControls
|
||||
|
||||
static uint32_t order_key_cnt;
|
||||
|
||||
struct ltstr {
|
||||
bool operator()(const char* s1, const char* s2) const {
|
||||
return strcmp(s1, s2) < 0;
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::map<const char*,long,ltstr> OrderKeys;
|
||||
typedef std::map<std::string, long> OrderKeys;
|
||||
OrderKeys order_keys;
|
||||
|
||||
void input_change_handler (IOChange, void *src);
|
||||
|
||||
@@ -321,7 +321,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
|
||||
bool operator() (boost::shared_ptr<Route>, boost::shared_ptr<Route> b);
|
||||
};
|
||||
|
||||
void sync_order_keys (const char* base);
|
||||
void sync_order_keys (std::string const &);
|
||||
|
||||
template<class T> void foreach_route (T *obj, void (T::*func)(Route&));
|
||||
template<class T> void foreach_route (T *obj, void (T::*func)(boost::shared_ptr<Route>));
|
||||
|
||||
@@ -64,7 +64,7 @@ using namespace ARDOUR;
|
||||
using namespace PBD;
|
||||
|
||||
uint32_t Route::order_key_cnt = 0;
|
||||
sigc::signal<void,const char*> Route::SyncOrderKeys;
|
||||
sigc::signal<void, string const &> Route::SyncOrderKeys;
|
||||
|
||||
Route::Route (Session& sess, string name, Flag flg, DataType default_type)
|
||||
: SessionObject (sess, name)
|
||||
@@ -121,7 +121,7 @@ Route::init ()
|
||||
processor_max_streams.reset();
|
||||
_solo_safe = false;
|
||||
_recordable = true;
|
||||
order_keys[strdup (N_("signal"))] = order_key_cnt++;
|
||||
order_keys[N_("signal")] = order_key_cnt++;
|
||||
_silent = false;
|
||||
_meter_point = MeterPostFader;
|
||||
_initial_delay = 0;
|
||||
@@ -162,10 +162,6 @@ Route::~Route ()
|
||||
|
||||
clear_processors (PreFader);
|
||||
clear_processors (PostFader);
|
||||
|
||||
for (OrderKeys::iterator i = order_keys.begin(); i != order_keys.end(); ++i) {
|
||||
free ((void*)(i->first));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@@ -184,23 +180,20 @@ Route::remote_control_id() const
|
||||
}
|
||||
|
||||
long
|
||||
Route::order_key (const char* name) const
|
||||
Route::order_key (std::string const & name) const
|
||||
{
|
||||
OrderKeys::const_iterator i;
|
||||
|
||||
for (i = order_keys.begin(); i != order_keys.end(); ++i) {
|
||||
if (!strcmp (name, i->first)) {
|
||||
return i->second;
|
||||
}
|
||||
OrderKeys::const_iterator i = order_keys.find (name);
|
||||
if (i == order_keys.end()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return -1;
|
||||
return i->second;
|
||||
}
|
||||
|
||||
void
|
||||
Route::set_order_key (const char* name, long n)
|
||||
Route::set_order_key (std::string const & name, long n)
|
||||
{
|
||||
order_keys[strdup(name)] = n;
|
||||
order_keys[name] = n;
|
||||
|
||||
if (Config->get_sync_all_route_ordering()) {
|
||||
for (OrderKeys::iterator x = order_keys.begin(); x != order_keys.end(); ++x) {
|
||||
@@ -212,7 +205,7 @@ Route::set_order_key (const char* name, long n)
|
||||
}
|
||||
|
||||
void
|
||||
Route::sync_order_keys (const char* base)
|
||||
Route::sync_order_keys (std::string const & base)
|
||||
{
|
||||
if (order_keys.empty()) {
|
||||
return;
|
||||
@@ -1643,7 +1636,7 @@ Route::_set_state (const XMLNode& node, bool call_base)
|
||||
error << string_compose (_("badly formed order key string in state file! [%1] ... ignored."), remaining)
|
||||
<< endmsg;
|
||||
} else {
|
||||
set_order_key (remaining.substr (0, equal).c_str(), n);
|
||||
set_order_key (remaining.substr (0, equal), n);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4281,7 +4281,7 @@ Session::compute_initial_length ()
|
||||
}
|
||||
|
||||
void
|
||||
Session::sync_order_keys (const char* base)
|
||||
Session::sync_order_keys (std::string const & base)
|
||||
{
|
||||
if (!Config->get_sync_all_route_ordering()) {
|
||||
/* leave order keys as they are */
|
||||
|
||||
Reference in New Issue
Block a user