MCPcopy Create free account
hub / github.com/TypesettingTools/Aegisub / AddLine

Method AddLine

src/ass_parser.cpp:224–265  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

222}
223
224void AssParser::AddLine(std::string const& data) {
225 // Special-case for attachments since a line could theoretically be both a
226 // valid attachment data line and a valid section header, and if an
227 // attachment is in progress it needs to be treated as that
228 if (attach.get()) {
229 ParseAttachmentLine(data);
230 return;
231 }
232
233 if (data.empty()) return;
234
235 // Section header
236 if (data[0] == '[' && data.back() == ']') {
237 // Ugly hacks to allow intermixed v4 and v4+ style sections
238 const std::string low = boost::to_lower_copy(data);
239 if (low == "[v4 styles]") {
240 version = 0;
241 state = &AssParser::ParseStyleLine;
242 }
243 else if (low == "[v4+ styles]") {
244 version = 1;
245 state = &AssParser::ParseStyleLine;
246 }
247 else if (low == "[events]")
248 state = &AssParser::ParseEventLine;
249 else if (low == "[script info]")
250 state = &AssParser::ParseScriptInfoLine;
251 else if (low == "[aegisub project garbage]")
252 state = &AssParser::ParseMetadataLine;
253 else if (low == "[aegisub extradata]")
254 state = &AssParser::ParseExtradataLine;
255 else if (low == "[graphics]")
256 state = &AssParser::ParseGraphicsLine;
257 else if (low == "[fonts]")
258 state = &AssParser::ParseFontLine;
259 else
260 state = &AssParser::UnknownLine;
261 return;
262 }
263
264 (this->*state)(data);
265}

Callers 3

read_subtitlesFunction · 0.80
GetSubtitlesMethod · 0.80
ReadFileMethod · 0.80

Calls 2

backMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected