| 97 | |
| 98 | template<typename String> |
| 99 | std::unique_ptr<AssDialogue> get_dialogue(String data) { |
| 100 | boost::trim(data); |
| 101 | try { |
| 102 | // Try to interpret the line as an ASS line |
| 103 | return std::make_unique<AssDialogue>(data); |
| 104 | } |
| 105 | catch (...) { |
| 106 | // Line didn't parse correctly, assume it's plain text that |
| 107 | // should be pasted in the Text field only |
| 108 | auto d = std::make_unique<AssDialogue>(); |
| 109 | d->End = 0; |
| 110 | d->Text = data; |
| 111 | return d; |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | template<typename Paster> |
| 116 | void paste_lines(agi::Context *c, bool paste_over, Paster&& paste_line) { |