std::map<std::string, uint32_t> RegionFactory::region_name_map;
boost::shared_ptr<Region>
-RegionFactory::create (boost::shared_ptr<const Region> region)
+RegionFactory::create (boost::shared_ptr<const Region> region, bool announce)
{
boost::shared_ptr<Region> ret;
boost::shared_ptr<const AudioRegion> ar;
}
if (ret) {
+ ret->set_name (new_region_name(ret->name()));
map_add (ret);
/* pure copy constructor - no property list */
/* pure copy constructor - no CheckNewRegion emitted */
+ if (announce) {
+ CheckNewRegion (ret);
+ }
}
+
return ret;
}
RegionMap::iterator i = region_map.find (id);
if (i == region_map.end()) {
- cerr << "ID " << id << " not found in region map\n";
return boost::shared_ptr<Region>();
}
return i->second;
}
-
+
+boost::shared_ptr<Region>
+RegionFactory::wholefile_region_by_name (const std::string& name)
+{
+ for (RegionMap::iterator i = region_map.begin(); i != region_map.end(); ++i) {
+ if (i->second->whole_file() && i->second->name() == name) {
+ return i->second;
+ }
+ }
+ return boost::shared_ptr<Region>();
+}
+
+boost::shared_ptr<Region>
+RegionFactory::region_by_name (const std::string& name)
+{
+ for (RegionMap::iterator i = region_map.begin(); i != region_map.end(); ++i) {
+ if (i->second->name() == name) {
+ return i->second;
+ }
+ }
+ return boost::shared_ptr<Region>();
+}
+
void
RegionFactory::clear_map ()
{