forked from mia/Aegisub
Fix compilation with C++ 11/libc++
This commit is contained in:
parent
ebd56f2163
commit
1848aad5c1
16 changed files with 42 additions and 46 deletions
|
@ -58,8 +58,8 @@ public:
|
|||
}
|
||||
|
||||
bool EOS() {
|
||||
m_iStr.peek(); // apparently eof flag isn't set until a character read is attempted. whatever.
|
||||
return m_iStr.eof();
|
||||
// libc++ doesn't set eof when a peek fails
|
||||
return m_iStr.peek() == EOF || m_iStr.eof();
|
||||
}
|
||||
|
||||
Location const& GetLocation() const { return m_Location; }
|
||||
|
|
|
@ -61,9 +61,9 @@ namespace {
|
|||
template<class T>
|
||||
void put_array(json::Object &obj, const std::string &path, const char *element_key, std::vector<T> const& value) {
|
||||
json::Array array;
|
||||
for (typename std::vector<T>::const_iterator it = value.begin(); it != value.end(); ++it) {
|
||||
for (T const& elem : value) {
|
||||
array.push_back(json::Object());
|
||||
static_cast<json::Object&>(array.back())[element_key] = (json::UnknownElement)*it;
|
||||
static_cast<json::Object&>(array.back())[element_key] = (json::UnknownElement)elem;
|
||||
}
|
||||
|
||||
put_option(obj, path, array);
|
||||
|
|
|
@ -272,7 +272,7 @@ void BaseGrid::UpdateMaps(bool preserve_selected_rows) {
|
|||
if (preserve_selected_rows) {
|
||||
sel_rows.reserve(selection.size());
|
||||
transform(selection.begin(), selection.end(), back_inserter(sel_rows),
|
||||
std::bind(&BaseGrid::GetDialogueIndex, this));
|
||||
[this](AssDialogue *diag) { return GetDialogueIndex(diag); });
|
||||
}
|
||||
|
||||
index_line_map.clear();
|
||||
|
|
|
@ -140,8 +140,8 @@ void DialogAutomation::RebuildList()
|
|||
script_info.clear();
|
||||
list->DeleteAllItems();
|
||||
|
||||
for_each(local_manager->GetScripts(), bind(&DialogAutomation::AddScript, this, _1, false));
|
||||
for_each(global_manager->GetScripts(), bind(&DialogAutomation::AddScript, this, _1, true));
|
||||
for_each(local_manager->GetScripts(), std::bind(&DialogAutomation::AddScript, this, _1, false));
|
||||
for_each(global_manager->GetScripts(), std::bind(&DialogAutomation::AddScript, this, _1, true));
|
||||
|
||||
UpdateDisplay();
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ template<class Container>
|
|||
static bool has_file(Container const& c, wxFileName const& fn)
|
||||
{
|
||||
return find_if(c.begin(), c.end(),
|
||||
bind(&wxFileName::SameAs, fn, bind(&Automation4::Script::GetFilename, _1), wxPATH_NATIVE)) != c.end();
|
||||
std::bind(&wxFileName::SameAs, fn, std::bind(&Automation4::Script::GetFilename, _1), wxPATH_NATIVE)) != c.end();
|
||||
}
|
||||
|
||||
void DialogAutomation::OnAdd(wxCommandEvent &)
|
||||
|
@ -276,7 +276,7 @@ void DialogAutomation::OnInfo(wxCommandEvent &)
|
|||
ei->script->GetFilename(),
|
||||
ei->script->GetLoadedState() ? _("Correctly loaded") : _("Failed to load")));
|
||||
|
||||
transform(ei->script->GetMacros(), append_info, bind(cmd_to_str, _1, context));
|
||||
transform(ei->script->GetMacros(), append_info, std::bind(cmd_to_str, _1, context));
|
||||
transform(ei->script->GetFilters(), append_info, filt_to_str);
|
||||
transform(ei->script->GetFormats(), append_info, form_to_str);
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ class FontsCollectorThread : public wxThread {
|
|||
void Collect() {
|
||||
using namespace std::placeholders;
|
||||
|
||||
FontCollectorStatusCallback callback(bind(&FontsCollectorThread::AppendText, this, _1, _2));
|
||||
FontCollectorStatusCallback callback(std::bind(&FontsCollectorThread::AppendText, this, _1, _2));
|
||||
|
||||
#ifdef WITH_FONTCONFIG
|
||||
FontConfigFontFileLister lister(callback);
|
||||
|
|
|
@ -59,7 +59,7 @@ public:
|
|||
: text_ctrl(t)
|
||||
{
|
||||
const agi::log::Sink *sink = agi::log::log->GetSink();
|
||||
for_each(sink->begin(), sink->end(), bind(&EmitLog::log, this, std::placeholders::_1));
|
||||
for_each(sink->begin(), sink->end(), std::bind(&EmitLog::log, this, std::placeholders::_1));
|
||||
}
|
||||
|
||||
void log(agi::log::SinkMessage *sm) {
|
||||
|
|
|
@ -248,7 +248,7 @@ void ResampleResolution(AssFile *ass, ResampleSettings const& settings) {
|
|||
if (settings.change_ar)
|
||||
state.ar = state.rx / state.ry;
|
||||
|
||||
for_each(ass->Line.begin(), ass->Line.end(), bind(resample_line, &state, std::placeholders::_1));
|
||||
for_each(ass->Line.begin(), ass->Line.end(), std::bind(resample_line, &state, std::placeholders::_1));
|
||||
|
||||
ass->SetScriptInfo("PlayResX", wxString::Format("%d", settings.script_x));
|
||||
ass->SetScriptInfo("PlayResY", wxString::Format("%d", settings.script_y));
|
||||
|
|
|
@ -82,17 +82,17 @@ std::function<bool (wxString)> get_predicate(int mode, wxRegEx *re, bool match_c
|
|||
|
||||
switch (mode) {
|
||||
case MODE_REGEXP:
|
||||
return bind(static_cast<bool (wxRegEx::*)(wxString const&,int) const>(&wxRegEx::Matches), re, _1, 0);
|
||||
return [=](wxString str) { return re->Matches(str); };
|
||||
case MODE_EXACT:
|
||||
if (match_case)
|
||||
return bind(std::equal_to<wxString>(), match_text, _1);
|
||||
return std::bind(std::equal_to<wxString>(), match_text, _1);
|
||||
else
|
||||
return bind(std::equal_to<wxString>(), match_text.Lower(), bind(&wxString::Lower, _1));
|
||||
return bind(std::equal_to<wxString>(), match_text.Lower(), std::bind(&wxString::Lower, _1));
|
||||
case MODE_CONTAINS:
|
||||
if (match_case)
|
||||
return bind(&wxString::Contains, _1, match_text);
|
||||
return std::bind(&wxString::Contains, _1, match_text);
|
||||
else
|
||||
return bind(&wxString::Contains, bind(&wxString::Lower, _1), match_text.Lower());
|
||||
return bind(&wxString::Contains, std::bind(&wxString::Lower, _1), match_text.Lower());
|
||||
break;
|
||||
default: throw agi::InternalError("Bad mode", 0);
|
||||
}
|
||||
|
|
|
@ -405,7 +405,7 @@ DialogStyleEditor::DialogStyleEditor(wxWindow *parent, AssStyle *style, agi::Con
|
|||
Bind(wxEVT_COMMAND_BUTTON_CLICKED, std::bind(&HelpButton::OpenPage, "Style Editor"), wxID_HELP);
|
||||
|
||||
for (int i = 0; i < 4; ++i)
|
||||
colorButton[i]->Bind(wxEVT_COMMAND_BUTTON_CLICKED, bind(&DialogStyleEditor::OnSetColor, this, i + 1, std::placeholders::_1));
|
||||
colorButton[i]->Bind(wxEVT_COMMAND_BUTTON_CLICKED, std::bind(&DialogStyleEditor::OnSetColor, this, i + 1, std::placeholders::_1));
|
||||
}
|
||||
|
||||
DialogStyleEditor::~DialogStyleEditor() {
|
||||
|
|
|
@ -476,16 +476,16 @@ void DialogStyleManager::CopyToClipboard(wxListBox *list, T const& v) {
|
|||
|
||||
void DialogStyleManager::PasteToCurrent() {
|
||||
add_styles(
|
||||
bind(&AssFile::GetStyle, c->ass, _1),
|
||||
bind(&AssFile::InsertStyle, c->ass, _1));
|
||||
std::bind(&AssFile::GetStyle, c->ass, _1),
|
||||
std::bind(&AssFile::InsertStyle, c->ass, _1));
|
||||
|
||||
c->ass->Commit(_("style paste"), AssFile::COMMIT_STYLES);
|
||||
}
|
||||
|
||||
void DialogStyleManager::PasteToStorage() {
|
||||
add_styles(
|
||||
bind(&AssStyleStorage::GetStyle, &Store, _1),
|
||||
bind(&AssStyleStorage::push_back, &Store, _1));
|
||||
std::bind(&AssStyleStorage::GetStyle, &Store, _1),
|
||||
std::bind(&AssStyleStorage::push_back, &Store, _1));
|
||||
|
||||
UpdateStorage();
|
||||
StorageList->SetStringSelection(Store.back()->name);
|
||||
|
@ -516,7 +516,7 @@ void DialogStyleManager::OnStorageCopy() {
|
|||
if (sel == -1) return;
|
||||
|
||||
ShowStorageEditor(Store[sel],
|
||||
unique_name(bind(&AssStyleStorage::GetStyle, &Store, _1), Store[sel]->name));
|
||||
unique_name(std::bind(&AssStyleStorage::GetStyle, &Store, _1), Store[sel]->name));
|
||||
}
|
||||
|
||||
void DialogStyleManager::OnStorageDelete() {
|
||||
|
@ -554,7 +554,7 @@ void DialogStyleManager::OnCurrentCopy() {
|
|||
if (sel == -1) return;
|
||||
|
||||
ShowCurrentEditor(styleMap[sel],
|
||||
unique_name(bind(&AssFile::GetStyle, c->ass, _1), styleMap[sel]->name));
|
||||
unique_name(std::bind(&AssFile::GetStyle, c->ass, _1), styleMap[sel]->name));
|
||||
}
|
||||
|
||||
void DialogStyleManager::OnCurrentDelete() {
|
||||
|
|
|
@ -90,12 +90,6 @@ static int FFMS_CC UpdateIndexingProgress(int64_t Current, int64_t Total, void *
|
|||
return ps->IsCancelled();
|
||||
}
|
||||
|
||||
/// A wrapper around FFMS_DoIndexing to make the signature void -> void
|
||||
static void DoIndexingWrapper(FFMS_Index **Ret, FFMS_Indexer *Indexer, int IndexMask, int ErrorHandling, void *ICPrivate, FFMS_ErrorInfo *ErrorInfo) {
|
||||
*Ret = FFMS_DoIndexing(Indexer, IndexMask, FFMS_TRACKMASK_NONE, NULL, NULL, ErrorHandling,
|
||||
UpdateIndexingProgress, ICPrivate, ErrorInfo);
|
||||
}
|
||||
|
||||
/// @brief Does indexing of a source file
|
||||
/// @param Indexer A pointer to the indexer object representing the file to be indexed
|
||||
/// @param CacheName The filename of the output index file
|
||||
|
@ -117,7 +111,9 @@ FFMS_Index *FFmpegSourceProvider::DoIndexing(FFMS_Indexer *Indexer, const wxStri
|
|||
|
||||
// index all audio tracks
|
||||
FFMS_Index *Index;
|
||||
Progress.Run(std::bind(DoIndexingWrapper, &Index, Indexer, Trackmask, IndexEH, std::placeholders::_1, &ErrInfo));
|
||||
Progress.Run([&](agi::ProgressSink *ps) {
|
||||
Index = FFMS_DoIndexing(Indexer, Trackmask, FFMS_TRACKMASK_NONE, nullptr, nullptr, IndexEH, UpdateIndexingProgress, ps, &ErrInfo);
|
||||
});
|
||||
|
||||
if (Index == NULL) {
|
||||
MsgString.Append("Failed to index: ").Append(wxString(ErrInfo.Buffer, wxConvUTF8));
|
||||
|
|
|
@ -220,7 +220,7 @@ void MatroskaWrapper::GetSubtitles(wxString const& filename, AssFile *target) {
|
|||
// Progress bar
|
||||
double totalTime = double(segInfo->Duration) / timecodeScale;
|
||||
DialogProgress progress(NULL, _("Parsing Matroska"), _("Reading subtitles from Matroska file."));
|
||||
progress.Run(bind(read_subtitles, std::placeholders::_1, file, &input, srt, totalTime, &parser));
|
||||
progress.Run(std::bind(read_subtitles, std::placeholders::_1, file, &input, srt, totalTime, &parser));
|
||||
}
|
||||
catch (...) {
|
||||
mkv_Close(file);
|
||||
|
|
|
@ -86,7 +86,7 @@ void HunspellSpellChecker::AddWord(std::string const& word) {
|
|||
++agi::line_iterator<std::string>(*stream),
|
||||
agi::line_iterator<std::string>(),
|
||||
inserter(words, words.end()),
|
||||
mem_fun_ref(&std::string::empty));
|
||||
[](std::string const& str) { return str.empty(); });
|
||||
}
|
||||
catch (agi::FileNotFoundError&) {
|
||||
LOG_I("dictionary/hunspell/add") << "User dictionary not found; creating it";
|
||||
|
|
|
@ -197,7 +197,7 @@ SubsTextEditCtrl::SubsTextEditCtrl(wxWindow* parent, wxSize wsize, long style, a
|
|||
|
||||
OPT_SUB("Subtitle/Highlight/Syntax", &SubsTextEditCtrl::UpdateStyle, this);
|
||||
static wxStyledTextEvent evt;
|
||||
OPT_SUB("App/Call Tips", &SubsTextEditCtrl::UpdateCallTip, this, ref(evt));
|
||||
OPT_SUB("App/Call Tips", &SubsTextEditCtrl::UpdateCallTip, this, std::ref(evt));
|
||||
}
|
||||
|
||||
SubsTextEditCtrl::~SubsTextEditCtrl() {
|
||||
|
@ -269,7 +269,7 @@ void SubsTextEditCtrl::SetStyles() {
|
|||
void SubsTextEditCtrl::UpdateStyle() {
|
||||
StartStyling(0,255);
|
||||
|
||||
std::string text = GetTextRaw();
|
||||
std::string text = GetTextRaw().data();
|
||||
|
||||
if (!OPT_GET("Subtitle/Highlight/Syntax")->GetBool()) {
|
||||
SetStyling(text.size(), 0);
|
||||
|
|
|
@ -244,7 +244,7 @@ void SubtitleFormat::RecombineOverlaps(AssFile &file) {
|
|||
newdlg->End = curdlg->Start;
|
||||
newdlg->Text = prevdlg->Text;
|
||||
|
||||
file.Line.insert(find_if(next, file.Line.end(), bind(dialog_start_lt, _1, newdlg)), *newdlg);
|
||||
file.Line.insert(find_if(next, file.Line.end(), std::bind(dialog_start_lt, _1, newdlg)), *newdlg);
|
||||
}
|
||||
|
||||
// Overlapping A+B part
|
||||
|
@ -255,7 +255,7 @@ void SubtitleFormat::RecombineOverlaps(AssFile &file) {
|
|||
// Put an ASS format hard linewrap between lines
|
||||
newdlg->Text = curdlg->Text + "\\N" + prevdlg->Text;
|
||||
|
||||
file.Line.insert(find_if(next, file.Line.end(), bind(dialog_start_lt, _1, newdlg)), *newdlg);
|
||||
file.Line.insert(find_if(next, file.Line.end(), std::bind(dialog_start_lt, _1, newdlg)), *newdlg);
|
||||
}
|
||||
|
||||
// Is there an A part after the overlap?
|
||||
|
@ -266,7 +266,7 @@ void SubtitleFormat::RecombineOverlaps(AssFile &file) {
|
|||
newdlg->End = prevdlg->End;
|
||||
newdlg->Text = prevdlg->Text;
|
||||
|
||||
file.Line.insert(find_if(next, file.Line.end(), bind(dialog_start_lt, _1, newdlg)), *newdlg);
|
||||
file.Line.insert(find_if(next, file.Line.end(), std::bind(dialog_start_lt, _1, newdlg)), *newdlg);
|
||||
}
|
||||
|
||||
// Is there a B part after the overlap?
|
||||
|
@ -277,7 +277,7 @@ void SubtitleFormat::RecombineOverlaps(AssFile &file) {
|
|||
newdlg->End = curdlg->End;
|
||||
newdlg->Text = curdlg->Text;
|
||||
|
||||
file.Line.insert(find_if(next, file.Line.end(), bind(dialog_start_lt, _1, newdlg)), *newdlg);
|
||||
file.Line.insert(find_if(next, file.Line.end(), std::bind(dialog_start_lt, _1, newdlg)), *newdlg);
|
||||
}
|
||||
|
||||
next--;
|
||||
|
@ -335,12 +335,12 @@ SubtitleFormat *find_or_throw(Cont &container, Pred pred) {
|
|||
|
||||
const SubtitleFormat *SubtitleFormat::GetReader(wxString const& filename) {
|
||||
LoadFormats();
|
||||
return find_or_throw(formats, bind(&SubtitleFormat::CanReadFile, _1, filename));
|
||||
return find_or_throw(formats, std::bind(&SubtitleFormat::CanReadFile, _1, filename));
|
||||
}
|
||||
|
||||
const SubtitleFormat *SubtitleFormat::GetWriter(wxString const& filename) {
|
||||
LoadFormats();
|
||||
return find_or_throw(formats, bind(&SubtitleFormat::CanWriteFile, _1, filename));
|
||||
return find_or_throw(formats, std::bind(&SubtitleFormat::CanWriteFile, _1, filename));
|
||||
}
|
||||
|
||||
wxString SubtitleFormat::GetWildcards(int mode) {
|
||||
|
@ -355,7 +355,7 @@ wxString SubtitleFormat::GetWildcards(int mode) {
|
|||
wxArrayString cur = mode == 0 ? format->GetReadWildcards() : format->GetWriteWildcards();
|
||||
if (cur.empty()) continue;
|
||||
|
||||
for_each(cur.begin(), cur.end(), bind(&wxString::Prepend, _1, "*."));
|
||||
for_each(cur.begin(), cur.end(), std::bind(&wxString::Prepend, _1, "*."));
|
||||
copy(cur.begin(), cur.end(), std::back_inserter(all));
|
||||
final += "|" + format->GetName() + " (" + wxJoin(cur, ',') + ")|" + wxJoin(cur, ';');
|
||||
}
|
||||
|
|
|
@ -218,9 +218,9 @@ void VisualTool<FeatureType>::OnMouseEvent(wxMouseEvent &event) {
|
|||
if (dragging) {
|
||||
// continue drag
|
||||
if (event.LeftIsDown()) {
|
||||
for_each(sel_features, bind(&FeatureType::UpdateDrag, _1,
|
||||
for_each(sel_features, std::bind(&FeatureType::UpdateDrag, _1,
|
||||
mouse_pos - drag_start, shift_down));
|
||||
for_each(sel_features, bind(&VisualTool<FeatureType>::UpdateDrag, this, _1));
|
||||
for_each(sel_features, std::bind(&VisualTool<FeatureType>::UpdateDrag, this, _1));
|
||||
Commit();
|
||||
need_render = true;
|
||||
}
|
||||
|
@ -273,7 +273,7 @@ void VisualTool<FeatureType>::OnMouseEvent(wxMouseEvent &event) {
|
|||
c->selectionController->SetActiveLine(active_feature->line);
|
||||
|
||||
if (InitializeDrag(active_feature)) {
|
||||
for_each(sel_features, bind(&VisualDraggableFeature::StartDrag, _1));
|
||||
for_each(sel_features, std::bind(&VisualDraggableFeature::StartDrag, _1));
|
||||
dragging = true;
|
||||
parent->CaptureMouse();
|
||||
}
|
||||
|
@ -553,7 +553,7 @@ wxString VisualToolBase::GetLineVectorClip(AssDialogue *diag, int &scale, bool &
|
|||
|
||||
void VisualToolBase::SetSelectedOverride(wxString const& tag, wxString const& value) {
|
||||
for_each(c->selectionController->GetSelectedSet(),
|
||||
bind(&VisualToolBase::SetOverride, this, _1, tag, value));
|
||||
std::bind(&VisualToolBase::SetOverride, this, _1, tag, value));
|
||||
}
|
||||
|
||||
void VisualToolBase::SetOverride(AssDialogue* line, wxString const& tag, wxString const& value) {
|
||||
|
|
Loading…
Reference in a new issue