forked from mia/Aegisub
Make AssFile::GetScriptInfo slightly less dumb
Originally committed to SVN as r5775.
This commit is contained in:
parent
5c487ae75f
commit
2ad0342103
2 changed files with 7 additions and 12 deletions
|
@ -597,27 +597,22 @@ void AssFile::InsertAttachment (wxString filename) {
|
||||||
InsertAttachment(newAttach);
|
InsertAttachment(newAttach);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString AssFile::GetScriptInfo(const wxString _key) {
|
wxString AssFile::GetScriptInfo(wxString key) {
|
||||||
wxString key = _key;;
|
|
||||||
key.Lower();
|
key.Lower();
|
||||||
key += ":";
|
key += ":";
|
||||||
std::list<AssEntry*>::iterator cur;
|
|
||||||
bool GotIn = false;
|
bool GotIn = false;
|
||||||
|
|
||||||
for (cur=Line.begin();cur!=Line.end();cur++) {
|
for (std::list<AssEntry*>::iterator cur = Line.begin(); cur != Line.end(); ++cur) {
|
||||||
if ((*cur)->group == "[Script Info]") {
|
if ((*cur)->group == "[Script Info]") {
|
||||||
GotIn = true;
|
GotIn = true;
|
||||||
wxString curText = (*cur)->GetEntryData();
|
wxString curText = (*cur)->GetEntryData();
|
||||||
curText.Lower();
|
curText.Lower();
|
||||||
|
|
||||||
if (curText.StartsWith(key)) {
|
wxString value;
|
||||||
wxString result = curText.Mid(key.length());
|
if (curText.StartsWith(key, &value))
|
||||||
result.Trim(false);
|
return value.Trim(true).Trim(false);
|
||||||
result.Trim(true);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (GotIn) break;
|
else if (GotIn) return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
|
|
|
@ -155,7 +155,7 @@ public:
|
||||||
/// Get the value in a [Script Info] key as int.
|
/// Get the value in a [Script Info] key as int.
|
||||||
int GetScriptInfoAsInt(const wxString key);
|
int GetScriptInfoAsInt(const wxString key);
|
||||||
/// Get the value in a [Script Info] key as string.
|
/// Get the value in a [Script Info] key as string.
|
||||||
wxString GetScriptInfo(const wxString key);
|
wxString GetScriptInfo(wxString key);
|
||||||
/// Set the value of a [Script Info] key. Adds it if it doesn't exist.
|
/// Set the value of a [Script Info] key. Adds it if it doesn't exist.
|
||||||
void SetScriptInfo(wxString const& key, wxString const& value);
|
void SetScriptInfo(wxString const& key, wxString const& value);
|
||||||
// Add a ";" comment in the [Script Info] section
|
// Add a ";" comment in the [Script Info] section
|
||||||
|
|
Loading…
Reference in a new issue