13
0

NO-OP: clang-format

This commit is contained in:
Robin Gareus 2021-05-01 14:52:35 +02:00
parent 3e04e30e9e
commit 747a3d4a7b
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 156 additions and 170 deletions

View File

@ -24,16 +24,15 @@
#ifndef __ardour_region_factory_h__
#define __ardour_region_factory_h__
#include <glibmm/threads.h>
#include <map>
#include <set>
#include <glibmm/threads.h>
#include "pbd/id.h"
#include "pbd/property_list.h"
#include "pbd/signals.h"
#include "ardour/libardour_visibility.h"
#include "ardour/thawlist.h"
#include "ardour/types.h"
class XMLNode;
@ -41,25 +40,30 @@ class RegionNamingTest;
namespace ARDOUR {
class Session;
class AudioRegion;
class Session;
class ThawList;
class LIBARDOUR_API RegionFactory {
class LIBARDOUR_API RegionFactory
{
public:
typedef std::map<PBD::ID, boost::shared_ptr<Region> > RegionMap;
static boost::shared_ptr<Region> wholefile_region_by_name (const std::string& name);
static boost::shared_ptr<Region> region_by_id (const PBD::ID&);
static boost::shared_ptr<Region> region_by_name (const std::string& name);
static const RegionMap all_regions() { return region_map; }
static void clear_map ();
static const RegionMap all_regions ()
{
return region_map;
}
/** This is emitted only when a new id is assigned. Therefore,
in a pure Region copy, it will not be emitted.
It must be emitted using a derived instance of Region, not Region
itself, to permit dynamic_cast<> to be used to
infer the type of Region.
* in a pure Region copy, it will not be emitted.
*
* It must be emitted using a derived instance of Region, not Region
* itself, to permit dynamic_cast<> to be used to
* infer the type of Region.
*/
static PBD::Signal1<void, boost::shared_ptr<Region> > CheckNewRegion;
@ -67,26 +71,21 @@ public:
static boost::shared_ptr<Region> create (boost::shared_ptr<const Region> other, bool announce, bool fork = false, ThawList* tl = 0);
/** Lua binding to create a "pure copy" of Region \p other */
static boost::shared_ptr<Region> create (boost::shared_ptr<Region> other, bool announce, bool fork) {
static boost::shared_ptr<Region> create (boost::shared_ptr<Region> other, bool announce, bool fork)
{
return create (boost::shared_ptr<const Region> (other), announce, fork, 0);
}
/** create a region from a single Source */
static boost::shared_ptr<Region> create (boost::shared_ptr<Source>,
const PBD::PropertyList&, bool announce = true, ThawList* tl = 0);
static boost::shared_ptr<Region> create (boost::shared_ptr<Source>, const PBD::PropertyList&, bool announce = true, ThawList* tl = 0);
/** create a region from a multiple sources */
static boost::shared_ptr<Region> create (const SourceList &,
const PBD::PropertyList&, bool announce = true, ThawList* tl = 0);
static boost::shared_ptr<Region> create (const SourceList&, const PBD::PropertyList&, bool announce = true, ThawList* tl = 0);
/** create a copy of \p other starting at zero within \p other's sources */
static boost::shared_ptr<Region> create (boost::shared_ptr<Region> other,
const PBD::PropertyList&, bool announce = true, ThawList* tl = 0);
static boost::shared_ptr<Region> create (boost::shared_ptr<Region> other, const PBD::PropertyList&, bool announce = true, ThawList* tl = 0);
/** create a copy of \p other starting at \p offset within \p other */
static boost::shared_ptr<Region> create (boost::shared_ptr<Region> other, ARDOUR::MusicSample offset,
const PBD::PropertyList&, bool announce = true, ThawList* tl = 0);
static boost::shared_ptr<Region> create (boost::shared_ptr<Region> other, ARDOUR::MusicSample offset, const PBD::PropertyList&, bool announce = true, ThawList* tl = 0);
/** create a "copy" of \p other but using a different set of sources \p srcs */
static boost::shared_ptr<Region> create (boost::shared_ptr<Region> other, const SourceList& srcs,
const PBD::PropertyList&, bool announce = true, ThawList* tl = 0);
static boost::shared_ptr<Region> create (boost::shared_ptr<Region> other, const SourceList& srcs, const PBD::PropertyList&, bool announce = true, ThawList* tl = 0);
/** create a region with no sources, using XML state */
static boost::shared_ptr<Region> create (Session&, XMLNode&, bool);
@ -100,18 +99,22 @@ public:
static void map_remove (boost::weak_ptr<Region>);
static void delete_all_regions ();
static const RegionMap& regions() { return region_map; }
static const RegionMap& regions ()
{
return region_map;
}
static uint32_t nregions ();
static void foreach_region (boost::function<void( boost::shared_ptr<Region> )> f) {
static void foreach_region (boost::function<void (boost::shared_ptr<Region>)> f)
{
Glib::Threads::Mutex::Lock ls (region_map_lock);
for (RegionMap::const_iterator i = region_map.begin (); i != region_map.end (); ++i) {
f ((*i).second);
}
}
static int region_name (std::string&, std::string, bool new_level = false);
static std::string new_region_name (std::string);
static std::string compound_region_name (const std::string& playlist, uint32_t compound_ops, uint32_t depth, bool whole_source);
@ -130,7 +133,11 @@ public:
*/
typedef std::map<boost::shared_ptr<Region>, boost::shared_ptr<Region> > CompoundAssociations;
static CompoundAssociations& compound_associations() { return _compound_associations; }
static CompoundAssociations& compound_associations ()
{
return _compound_associations;
}
static void add_compound_association (boost::shared_ptr<Region>, boost::shared_ptr<Region>);
@ -145,9 +152,12 @@ public:
friend class ::RegionNamingTest;
static void region_changed (PBD::PropertyChange const&, boost::weak_ptr<Region>);
static void add_to_region_name_maps (boost::shared_ptr<Region>);
static void rename_in_region_name_maps (boost::shared_ptr<Region>);
static void update_region_name_number_map (boost::shared_ptr<Region>);
static void remove_from_region_name_map (std::string);
static Glib::Threads::Mutex region_map_lock;
static RegionMap region_map;
static Glib::Threads::Mutex region_name_maps_mutex;
@ -155,15 +165,11 @@ public:
static std::map<std::string, uint32_t> region_name_number_map;
/** map of complete region names with their region ID */
static std::map<std::string, PBD::ID> region_name_map;
static void add_to_region_name_maps (boost::shared_ptr<Region>);
static void rename_in_region_name_maps (boost::shared_ptr<Region>);
static void update_region_name_number_map (boost::shared_ptr<Region>);
static void remove_from_region_name_map (std::string);
static PBD::ScopedConnectionList* region_list_connections;
static CompoundAssociations _compound_associations;
};
}
} // namespace ARDOUR
#endif /* __ardour_region_factory_h__ */

View File

@ -34,6 +34,7 @@
#include "ardour/region.h"
#include "ardour/region_factory.h"
#include "ardour/session.h"
#include "ardour/thawlist.h"
#include "pbd/i18n.h"
@ -58,11 +59,9 @@ RegionFactory::create (boost::shared_ptr<const Region> region, bool announce, bo
boost::shared_ptr<const MidiRegion> mr;
if ((ar = boost::dynamic_pointer_cast<const AudioRegion> (region)) != 0) {
ret = boost::shared_ptr<Region> (new AudioRegion (ar, MusicSample (0, 0)));
} else if ((mr = boost::dynamic_pointer_cast<const MidiRegion> (region)) != 0) {
if (mr->session ().config.get_midi_copy_is_fork () || fork) {
/* What we really want to do here is what Editor::fork_region()
does via Session::create_midi_source_by_stealing_name(), but we
@ -116,11 +115,9 @@ RegionFactory::create (boost::shared_ptr<Region> region, const PropertyList& pli
boost::shared_ptr<const MidiRegion> other_m;
if ((other_a = boost::dynamic_pointer_cast<AudioRegion> (region)) != 0) {
ret = boost::shared_ptr<Region> (new AudioRegion (other_a));
} else if ((other_m = boost::dynamic_pointer_cast<MidiRegion> (region)) != 0) {
ret = boost::shared_ptr<Region> (new MidiRegion (other_m));
} else {
@ -160,11 +157,9 @@ RegionFactory::create (boost::shared_ptr<Region> region, MusicSample offset, con
boost::shared_ptr<const MidiRegion> other_m;
if ((other_a = boost::dynamic_pointer_cast<AudioRegion> (region)) != 0) {
ret = boost::shared_ptr<Region> (new AudioRegion (other_a, offset));
} else if ((other_m = boost::dynamic_pointer_cast<MidiRegion> (region)) != 0) {
ret = boost::shared_ptr<Region> (new MidiRegion (other_m, offset));
} else {
@ -206,7 +201,6 @@ RegionFactory::create (boost::shared_ptr<Region> region, const SourceList& srcs,
*/
if ((other = boost::dynamic_pointer_cast<AudioRegion> (region)) != 0) {
// XXX use me in caller where plist is setup, this is start i think srcs.front()->length (srcs.front()->natural_position())
ret = boost::shared_ptr<Region> (new AudioRegion (other, srcs));
@ -255,13 +249,10 @@ RegionFactory::create (const SourceList& srcs, const PropertyList& plist, bool a
boost::shared_ptr<MidiSource> ms;
if ((as = boost::dynamic_pointer_cast<AudioSource> (srcs[0])) != 0) {
ret = boost::shared_ptr<Region> (new AudioRegion (srcs));
} else if ((ms = boost::dynamic_pointer_cast<MidiSource> (srcs[0])) != 0) {
ret = boost::shared_ptr<Region> (new MidiRegion (srcs));
}
if (ret) {
@ -302,13 +293,10 @@ RegionFactory::create (SourceList& srcs, const XMLNode& node)
}
if (srcs[0]->type () == DataType::AUDIO) {
ret = boost::shared_ptr<Region> (new AudioRegion (srcs));
} else if (srcs[0]->type () == DataType::MIDI) {
ret = boost::shared_ptr<Region> (new MidiRegion (srcs));
}
if (ret) {
@ -495,7 +483,6 @@ RegionFactory::update_region_name_number_map (boost::shared_ptr<Region> region)
string::size_type const last_period = region->name ().find_last_of ('.');
if (last_period != string::npos && last_period < region->name ().length () - 1) {
string const base = region->name ().substr (0, last_period);
string const number = region->name ().substr (last_period + 1);
@ -532,13 +519,11 @@ RegionFactory::region_name (string& result, string base, bool newlevel)
}
if (base == "") {
snprintf (buf, sizeof (buf), "%d", RegionFactory::nregions () + 1);
result = "region.";
result += buf;
} else {
if (newlevel) {
subbase = base;
} else {
@ -549,7 +534,6 @@ RegionFactory::region_name (string& result, string base, bool newlevel)
/* pos may be npos, but then we just use entire base */
subbase = base.substr (0, pos);
}
{
@ -594,7 +578,6 @@ RegionFactory::new_region_name (string old)
std::vector<char> buf (len);
if ((last_period = old.find_last_of ('.')) == string::npos) {
/* no period present - add one explicitly */
old += '.';
@ -602,9 +585,7 @@ RegionFactory::new_region_name (string old)
number = 0;
} else {
if (last_period < old.length () - 1) {
string period_to_end = old.substr (last_period + 1);
/* extra material after the period */
@ -625,7 +606,6 @@ RegionFactory::new_region_name (string old)
}
while (number < (UINT_MAX - 1)) {
string sbuf;
number++;