| 1 | /***************************************************************************** |
| 2 | ** QNapi |
| 3 | ** Copyright (C) 2008-2017 Piotr KrzemiĆski <[email protected]> |
| 4 | ** |
| 5 | ** This program is free software; you can redistribute it and/or modify |
| 6 | ** it under the terms of the GNU General Public License as published by |
| 7 | ** the Free Software Foundation; either version 2 of the License, or |
| 8 | ** (at your option) any later version. |
| 9 | ** |
| 10 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
| 11 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
| 12 | ** |
| 13 | *****************************************************************************/ |
| 14 | |
| 15 | #ifndef SUBFILE_H |
| 16 | #define SUBFILE_H |
| 17 | |
| 18 | #include <QStringList> |
| 19 | #include <QVector> |
| 20 | |
| 21 | enum SubTokenType { |
| 22 | STT_WS = 0, |
| 23 | STT_WORD = 1, |
| 24 | STT_NEWLINE = 2, |
| 25 | STT_BOLD = 3, |
| 26 | STT_BOLD_END = 4, |
| 27 | STT_ITALIC = 5, |
| 28 | STT_ITALIC_END = 6, |
| 29 | STT_UNDERLINE = 7, |
| 30 | STT_UNDERLINE_END = 8, |
| 31 | STT_FONTCOLOR = 9, |
| 32 | STT_FONTCOLOR_END = 10 |
| 33 | }; |
| 34 | |
| 35 | struct SubToken { |
| 36 | SubTokenType type; |
| 37 | QString payload; |
| 38 | |
| 39 | bool operator==(const SubToken& other) const { |
| 40 | return type == other.type && payload == other.payload; |
| 41 | } |
| 42 | }; |
| 43 | |
| 44 | struct SubEntry { |
| 45 | long frameStart, frameStop; |
| 46 | // if time-based, they represent frames as milliseconds |
| 47 | // if frame-based, they represent exact frame numbers |
| 48 | |
| 49 | QVector<SubToken> tokens; |
| 50 | }; |
| 51 | |
| 52 | struct SubFile { |
| 53 | QVector<SubEntry> entries; |
| 54 | }; |
| 55 | |
| 56 | #endif // SUBFILE_H |