2 Copyright (C) 2008 Paul Davis
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #include "ardour/export_format_base.h"
27 ExportFormatBase::SelectableCompatible::set_selected (bool value
)
29 if (_selected
!= value
) {
31 SelectChanged (value
);
36 ExportFormatBase::SelectableCompatible::set_compatible (bool value
)
38 if (_compatible
!= value
) {
40 CompatibleChanged (value
);
47 ExportFormatBase::ExportFormatBase ()
52 ExportFormatBase::ExportFormatBase (ExportFormatBase
const & other
) :
53 sample_formats (other
.sample_formats
),
54 endiannesses (other
.endiannesses
),
55 sample_rates (other
.sample_rates
),
56 format_ids (other
.format_ids
),
57 qualities (other
.qualities
)
62 ExportFormatBase::~ExportFormatBase ()
67 boost::shared_ptr
<ExportFormatBase
>
68 ExportFormatBase::get_intersection (ExportFormatBase
const & other
) const
70 return do_set_operation (other
, SetIntersection
);
73 boost::shared_ptr
<ExportFormatBase
>
74 ExportFormatBase::get_difference (ExportFormatBase
const & other
) const
76 return do_set_operation (other
, SetDifference
);
79 boost::shared_ptr
<ExportFormatBase
>
80 ExportFormatBase::get_union (ExportFormatBase
const & other
) const
82 return do_set_operation (other
, SetUnion
);
85 boost::shared_ptr
<ExportFormatBase
>
86 ExportFormatBase::do_set_operation (ExportFormatBase
const & other
, SetOperation operation
) const
88 boost::shared_ptr
<ExportFormatBase
> result (new ExportFormatBase ());
94 EndianSet::const_iterator start1
= endiannesses
.begin();
95 EndianSet::const_iterator end1
= endiannesses
.end();
96 EndianSet::const_iterator start2
= other
.endiannesses
.begin();
97 EndianSet::const_iterator end2
= other
.endiannesses
.end();
98 std::insert_iterator
<EndianSet
> insert (result
->endiannesses
, result
->endiannesses
.begin());
101 case SetIntersection
:
102 std::set_intersection (start1
, end1
, start2
, end2
, insert
);
105 std::set_difference (start1
, end1
, start2
, end2
, insert
);
108 std::set_union (start1
, end1
, start2
, end2
, insert
);
115 SampleFormatSet::const_iterator start1
= sample_formats
.begin();
116 SampleFormatSet::const_iterator end1
= sample_formats
.end();
117 SampleFormatSet::const_iterator start2
= other
.sample_formats
.begin();
118 SampleFormatSet::const_iterator end2
= other
.sample_formats
.end();
119 std::insert_iterator
<SampleFormatSet
> insert (result
->sample_formats
, result
->sample_formats
.begin());
122 case SetIntersection
:
123 std::set_intersection (start1
, end1
, start2
, end2
, insert
);
126 std::set_difference (start1
, end1
, start2
, end2
, insert
);
129 std::set_union (start1
, end1
, start2
, end2
, insert
);
137 SampleRateSet::const_iterator start1
= sample_rates
.begin();
138 SampleRateSet::const_iterator end1
= sample_rates
.end();
139 SampleRateSet::const_iterator start2
= other
.sample_rates
.begin();
140 SampleRateSet::const_iterator end2
= other
.sample_rates
.end();
141 std::insert_iterator
<SampleRateSet
> insert (result
->sample_rates
, result
->sample_rates
.begin());
144 case SetIntersection
:
145 std::set_intersection (start1
, end1
, start2
, end2
, insert
);
148 std::set_difference (start1
, end1
, start2
, end2
, insert
);
151 std::set_union (start1
, end1
, start2
, end2
, insert
);
158 FormatSet::const_iterator start1
= format_ids
.begin();
159 FormatSet::const_iterator end1
= format_ids
.end();
160 FormatSet::const_iterator start2
= other
.format_ids
.begin();
161 FormatSet::const_iterator end2
= other
.format_ids
.end();
162 std::insert_iterator
<FormatSet
> insert (result
->format_ids
, result
->format_ids
.begin());
165 case SetIntersection
:
166 std::set_intersection (start1
, end1
, start2
, end2
, insert
);
169 std::set_difference (start1
, end1
, start2
, end2
, insert
);
172 std::set_union (start1
, end1
, start2
, end2
, insert
);
179 QualitySet::const_iterator start1
= qualities
.begin();
180 QualitySet::const_iterator end1
= qualities
.end();
181 QualitySet::const_iterator start2
= other
.qualities
.begin();
182 QualitySet::const_iterator end2
= other
.qualities
.end();
183 std::insert_iterator
<QualitySet
> insert (result
->qualities
, result
->qualities
.begin());
186 case SetIntersection
:
187 std::set_intersection (start1
, end1
, start2
, end2
, insert
);
190 std::set_difference (start1
, end1
, start2
, end2
, insert
);
193 std::set_union (start1
, end1
, start2
, end2
, insert
);
201 }; // namespace ARDOUR