forked from mia/Aegisub
Use emplace_back where applicable
This commit is contained in:
parent
eca70285f1
commit
e77e810bd8
13 changed files with 35 additions and 32 deletions
|
@ -445,7 +445,7 @@ int AssFile::Commit(wxString const& desc, int type, int amendId, AssEntry *singl
|
||||||
void AssFile::Undo() {
|
void AssFile::Undo() {
|
||||||
if (UndoStack.size() <= 1) return;
|
if (UndoStack.size() <= 1) return;
|
||||||
|
|
||||||
RedoStack.push_back(AssFile());
|
RedoStack.emplace_back();
|
||||||
swap(RedoStack.back());
|
swap(RedoStack.back());
|
||||||
UndoStack.pop_back();
|
UndoStack.pop_back();
|
||||||
*this = UndoStack.back();
|
*this = UndoStack.back();
|
||||||
|
|
|
@ -126,11 +126,12 @@ AssOverrideParamProto::AssOverrideParamProto(VariableDataType type,int opt,AssPa
|
||||||
}
|
}
|
||||||
|
|
||||||
void AssOverrideTagProto::AddParam(VariableDataType type, AssParameterClass classi, int opt) {
|
void AssOverrideTagProto::AddParam(VariableDataType type, AssParameterClass classi, int opt) {
|
||||||
params.push_back(AssOverrideParamProto(type, opt, classi));
|
params.emplace_back(type, opt, classi);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AssOverrideTagProto::Set(wxString newName, VariableDataType type, AssParameterClass classi, int opt) {
|
void AssOverrideTagProto::Set(wxString newName, VariableDataType type, AssParameterClass classi, int opt) {
|
||||||
name = newName;
|
name = newName;
|
||||||
params.push_back(AssOverrideParamProto(type, opt, classi));
|
params.emplace_back(type, opt, classi);
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::vector<AssOverrideTagProto> proto;
|
static std::vector<AssOverrideTagProto> proto;
|
||||||
|
|
|
@ -72,7 +72,7 @@ void AudioMarkerProviderKeyframes::Update() {
|
||||||
markers.clear();
|
markers.clear();
|
||||||
markers.reserve(keyframes.size());
|
markers.reserve(keyframes.size());
|
||||||
for (int frame : keyframes)
|
for (int frame : keyframes)
|
||||||
markers.push_back(AudioMarkerKeyframe(style.get(), timecodes.TimeAtFrame(frame, agi::vfr::START)));
|
markers.emplace_back(style.get(), timecodes.TimeAtFrame(frame, agi::vfr::START));
|
||||||
AnnounceMarkerMoved();
|
AnnounceMarkerMoved();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,7 @@ AudioSpectrumRenderer::AudioSpectrumRenderer(std::string const& color_scheme_nam
|
||||||
{
|
{
|
||||||
colors.reserve(AudioStyle_MAX);
|
colors.reserve(AudioStyle_MAX);
|
||||||
for (int i = 0; i < AudioStyle_MAX; ++i)
|
for (int i = 0; i < AudioStyle_MAX; ++i)
|
||||||
colors.push_back(AudioColorScheme(12, color_scheme_name, i));
|
colors.emplace_back(12, color_scheme_name, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioSpectrumRenderer::~AudioSpectrumRenderer()
|
AudioSpectrumRenderer::~AudioSpectrumRenderer()
|
||||||
|
|
|
@ -62,7 +62,7 @@ AudioWaveformRenderer::AudioWaveformRenderer(std::string const& color_scheme_nam
|
||||||
{
|
{
|
||||||
colors.reserve(AudioStyle_MAX);
|
colors.reserve(AudioStyle_MAX);
|
||||||
for (int i = 0; i < AudioStyle_MAX; ++i)
|
for (int i = 0; i < AudioStyle_MAX; ++i)
|
||||||
colors.push_back(AudioColorScheme(6, color_scheme_name, i));
|
colors.emplace_back(6, color_scheme_name, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioWaveformRenderer::~AudioWaveformRenderer()
|
AudioWaveformRenderer::~AudioWaveformRenderer()
|
||||||
|
|
|
@ -790,7 +790,7 @@ void AudioTimingControllerDialogue::AddInactiveLine(SubtitleSelection const& sel
|
||||||
{
|
{
|
||||||
if (sel.count(diag)) return;
|
if (sel.count(diag)) return;
|
||||||
|
|
||||||
inactive_lines.push_back(TimeableLine(AudioStyle_Inactive, &style_inactive, &style_inactive));
|
inactive_lines.emplace_back(AudioStyle_Inactive, &style_inactive, &style_inactive);
|
||||||
inactive_lines.back().SetLine(diag);
|
inactive_lines.back().SetLine(diag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -805,7 +805,7 @@ void AudioTimingControllerDialogue::RegenerateSelectedLines()
|
||||||
{
|
{
|
||||||
if (line == active) continue;
|
if (line == active) continue;
|
||||||
|
|
||||||
selected_lines.push_back(TimeableLine(AudioStyle_Selected, &style_inactive, &style_inactive));
|
selected_lines.emplace_back(AudioStyle_Selected, &style_inactive, &style_inactive);
|
||||||
selected_lines.back().SetLine(line);
|
selected_lines.back().SetLine(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -285,8 +285,8 @@ void AudioTimingControllerKaraoke::Revert() {
|
||||||
|
|
||||||
for (AssKaraoke::iterator it = kara->begin(); it != kara->end(); ++it) {
|
for (AssKaraoke::iterator it = kara->begin(); it != kara->end(); ++it) {
|
||||||
if (it != kara->begin())
|
if (it != kara->begin())
|
||||||
markers.push_back(KaraokeMarker(it->start_time, &separator_pen, AudioMarker::Feet_None));
|
markers.emplace_back(it->start_time, &separator_pen, AudioMarker::Feet_None);
|
||||||
labels.push_back(AudioLabel(it->text, TimeRange(it->start_time, it->start_time + it->duration)));
|
labels.emplace_back(it->text, TimeRange(it->start_time, it->start_time + it->duration));
|
||||||
}
|
}
|
||||||
|
|
||||||
AnnounceUpdatedPrimaryRange();
|
AnnounceUpdatedPrimaryRange();
|
||||||
|
|
|
@ -614,7 +614,7 @@ namespace Automation4 {
|
||||||
luaL_error(L, "Attempt to set an undo point in a context where it makes no sense to do so.");
|
luaL_error(L, "Attempt to set an undo point in a context where it makes no sense to do so.");
|
||||||
|
|
||||||
if (modification_type) {
|
if (modification_type) {
|
||||||
pending_commits.push_back(PendingCommit());
|
pending_commits.emplace_back();
|
||||||
PendingCommit& back = pending_commits.back();
|
PendingCommit& back = pending_commits.back();
|
||||||
|
|
||||||
back.modification_type = modification_type;
|
back.modification_type = modification_type;
|
||||||
|
|
|
@ -147,8 +147,8 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
wxDataViewItem AddChild(Combo const& combo) {
|
wxDataViewItem AddChild(Combo const& combo) {
|
||||||
children.push_back(HotkeyModelCombo(this, combo));
|
children.emplace_back(this, combo);
|
||||||
visible_items.push_back(wxDataViewItem(&children.back()));
|
visible_items.emplace_back(&children.back());
|
||||||
model->ItemAdded(wxDataViewItem(this), wxDataViewItem(&children.back()));
|
model->ItemAdded(wxDataViewItem(this), wxDataViewItem(&children.back()));
|
||||||
return wxDataViewItem(&children.back());
|
return wxDataViewItem(&children.back());
|
||||||
}
|
}
|
||||||
|
@ -183,11 +183,11 @@ public:
|
||||||
bool is_visible = combo.IsVisible(new_filter);
|
bool is_visible = combo.IsVisible(new_filter);
|
||||||
|
|
||||||
if (is_visible)
|
if (is_visible)
|
||||||
visible_items.push_back(wxDataViewItem(&combo));
|
visible_items.emplace_back(&combo);
|
||||||
if (was_visible && !is_visible)
|
if (was_visible && !is_visible)
|
||||||
removed.push_back(wxDataViewItem(&combo));
|
removed.emplace_back(&combo);
|
||||||
if (is_visible && !was_visible)
|
if (is_visible && !was_visible)
|
||||||
added.push_back(wxDataViewItem(&combo));
|
added.emplace_back(&combo);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!added.empty())
|
if (!added.empty())
|
||||||
|
@ -228,7 +228,7 @@ public:
|
||||||
if (cat_it != cat_map.end())
|
if (cat_it != cat_map.end())
|
||||||
cat = cat_it->second;
|
cat = cat_it->second;
|
||||||
else {
|
else {
|
||||||
categories.push_back(HotkeyModelCategory(model, cat_name));
|
categories.emplace_back(model, cat_name);
|
||||||
cat = cat_map[cat_name] = &categories.back();
|
cat = cat_map[cat_name] = &categories.back();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@ public:
|
||||||
unsigned int GetChildren(wxDataViewItemArray &out) const {
|
unsigned int GetChildren(wxDataViewItemArray &out) const {
|
||||||
out.reserve(categories.size());
|
out.reserve(categories.size());
|
||||||
for (auto const& category : categories)
|
for (auto const& category : categories)
|
||||||
out.push_back(wxDataViewItem((void*)&category));
|
out.emplace_back((void*)&category);
|
||||||
return out.size();
|
return out.size();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -243,7 +243,7 @@ void Spline::GetClosestParametricPoint(Vector2D reference,iterator &curve,float
|
||||||
if (empty()) return;
|
if (empty()) return;
|
||||||
|
|
||||||
// Close the shape
|
// Close the shape
|
||||||
push_back(SplineCurve(back().EndPoint(), front().p1));
|
emplace_back(back().EndPoint(), front().p1);
|
||||||
|
|
||||||
float closest = std::numeric_limits<float>::infinity();
|
float closest = std::numeric_limits<float>::infinity();
|
||||||
for (iterator cur = begin(); cur != end(); ++cur) {
|
for (iterator cur = begin(); cur != end(); ++cur) {
|
||||||
|
|
|
@ -117,6 +117,8 @@ public:
|
||||||
using std::list<SplineCurve>::push_back;
|
using std::list<SplineCurve>::push_back;
|
||||||
using std::list<SplineCurve>::pop_front;
|
using std::list<SplineCurve>::pop_front;
|
||||||
using std::list<SplineCurve>::pop_back;
|
using std::list<SplineCurve>::pop_back;
|
||||||
|
using std::list<SplineCurve>::emplace_front;
|
||||||
|
using std::list<SplineCurve>::emplace_back;
|
||||||
using std::list<SplineCurve>::insert;
|
using std::list<SplineCurve>::insert;
|
||||||
using std::list<SplineCurve>::erase;
|
using std::list<SplineCurve>::erase;
|
||||||
using std::list<SplineCurve>::clear;
|
using std::list<SplineCurve>::clear;
|
||||||
|
|
|
@ -224,7 +224,7 @@ namespace
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply the splits
|
// Apply the splits
|
||||||
new_text.push_back(EbuTextRow());
|
new_text.emplace_back();
|
||||||
size_t cur_word = 0;
|
size_t cur_word = 0;
|
||||||
size_t split_point = 0;
|
size_t split_point = 0;
|
||||||
for (auto const& cur_block : row)
|
for (auto const& cur_block : row)
|
||||||
|
@ -233,7 +233,7 @@ namespace
|
||||||
{
|
{
|
||||||
if (split_points[split_point] == cur_word)
|
if (split_points[split_point] == cur_word)
|
||||||
{
|
{
|
||||||
new_text.push_back(EbuTextRow());
|
new_text.emplace_back();
|
||||||
++split_point;
|
++split_point;
|
||||||
}
|
}
|
||||||
++cur_word;
|
++cur_word;
|
||||||
|
@ -271,13 +271,13 @@ namespace
|
||||||
line->ParseAssTags();
|
line->ParseAssTags();
|
||||||
|
|
||||||
text_rows.clear();
|
text_rows.clear();
|
||||||
text_rows.push_back(EbuTextRow());
|
text_rows.emplace_back();
|
||||||
|
|
||||||
// current row being worked on
|
// current row being worked on
|
||||||
EbuTextRow *cur_row = &text_rows.back();
|
EbuTextRow *cur_row = &text_rows.back();
|
||||||
|
|
||||||
// create initial text part
|
// create initial text part
|
||||||
cur_row->push_back(EbuFormattedText("", style_underline, style_italic, true));
|
cur_row->emplace_back("", style_underline, style_italic, true);
|
||||||
|
|
||||||
bool underline = style_underline, italic = style_italic;
|
bool underline = style_underline, italic = style_italic;
|
||||||
|
|
||||||
|
@ -309,14 +309,14 @@ namespace
|
||||||
if (substr == "\\N" || (wrap_mode == 1 && substr == "\\n"))
|
if (substr == "\\N" || (wrap_mode == 1 && substr == "\\n"))
|
||||||
{
|
{
|
||||||
// create a new row with current style
|
// create a new row with current style
|
||||||
text_rows.push_back(EbuTextRow());
|
text_rows.emplace_back();
|
||||||
cur_row = &text_rows.back();
|
cur_row = &text_rows.back();
|
||||||
cur_row->push_back(EbuFormattedText("", underline, italic, true));
|
cur_row->emplace_back("", underline, italic, true);
|
||||||
}
|
}
|
||||||
else // if (substr == " " || substr == "\\h" || substr == "\\n")
|
else // if (substr == " " || substr == "\\h" || substr == "\\n")
|
||||||
{
|
{
|
||||||
cur_row->back().text.append(" ");
|
cur_row->back().text.append(" ");
|
||||||
cur_row->push_back(EbuFormattedText("", underline, italic, true));
|
cur_row->emplace_back("", underline, italic, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
text = text.Mid(start+len);
|
text = text.Mid(start+len);
|
||||||
|
@ -388,7 +388,7 @@ namespace
|
||||||
for (auto line : copy.Line | agi::of_type<AssDialogue>())
|
for (auto line : copy.Line | agi::of_type<AssDialogue>())
|
||||||
{
|
{
|
||||||
// add a new subtitle and work on it
|
// add a new subtitle and work on it
|
||||||
subs_list.push_back(EbuSubtitle());
|
subs_list.emplace_back();
|
||||||
EbuSubtitle &imline = subs_list.back();
|
EbuSubtitle &imline = subs_list.back();
|
||||||
|
|
||||||
// some defaults for compatibility
|
// some defaults for compatibility
|
||||||
|
@ -429,9 +429,9 @@ namespace
|
||||||
// (it still has to contain a space to not get ignored)
|
// (it still has to contain a space to not get ignored)
|
||||||
if (subs_list.empty())
|
if (subs_list.empty())
|
||||||
{
|
{
|
||||||
subs_list.push_back(EbuSubtitle());
|
subs_list.emplace_back();
|
||||||
subs_list.back().text_rows.push_back(EbuTextRow());
|
subs_list.back().text_rows.emplace_back();
|
||||||
subs_list.back().text_rows.back().push_back(EbuFormattedText(" "));
|
subs_list.back().text_rows.back().emplace_back(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
return subs_list;
|
return subs_list;
|
||||||
|
|
|
@ -323,7 +323,7 @@ bool VisualToolVectorClip::InitializeHold() {
|
||||||
features.clear();
|
features.clear();
|
||||||
active_feature = features.end();
|
active_feature = features.end();
|
||||||
spline.clear();
|
spline.clear();
|
||||||
spline.push_back(SplineCurve(mouse_pos));
|
spline.emplace_back(mouse_pos);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -367,7 +367,7 @@ void VisualToolVectorClip::UpdateHold() {
|
||||||
Vector2D const& last = spline.back().EndPoint();
|
Vector2D const& last = spline.back().EndPoint();
|
||||||
float len = (last - mouse_pos).SquareLen();
|
float len = (last - mouse_pos).SquareLen();
|
||||||
if ((mode == 6 && len >= 900) || (mode == 7 && len >= 3600)) {
|
if ((mode == 6 && len >= 900) || (mode == 7 && len >= 3600)) {
|
||||||
spline.push_back(SplineCurve(last, mouse_pos));
|
spline.emplace_back(last, mouse_pos);
|
||||||
MakeFeature(--spline.end());
|
MakeFeature(--spline.end());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue