A basic parser for Sub Station Alpha (SSA/ASS) subtitles files.
More...
|
static QString | normalized (const QString &name) |
| Convert an identifier to a normalized format. More...
|
|
A basic parser for Sub Station Alpha (SSA/ASS) subtitles files.
SSA: Sub Station Alpha version 4. ASS: Advanced Sub Station Alpha version 4+. SSA/ASS specification: http://moodub.free.fr/video/ass-specs.doc
◆ QtlSubStationAlphaParser()
QtlSubStationAlphaParser::QtlSubStationAlphaParser |
( |
QtlLogger * |
log = 0 , |
|
|
QObject * |
parent = 0 |
|
) |
| |
|
explicit |
Constructor.
- Parameters
-
[in] | log | Where to log errors. |
[in] | parent | Optional parent object. |
◆ addLine()
void QtlSubStationAlphaParser::addLine |
( |
const QString & |
line | ) |
|
Provide one input line.
- Parameters
-
[in] | line | One line of ASS/SSA file. |
◆ addLines()
void QtlSubStationAlphaParser::addLines |
( |
const QStringList & |
lines | ) |
|
Provide input lines.
- Parameters
-
[in] | lines | Lines of ASS/SSA file. |
◆ addFile()
bool QtlSubStationAlphaParser::addFile |
( |
const QString & |
fileName, |
|
|
const char * |
codecName = "UTF-8" |
|
) |
| |
Provide a complete input file.
- Parameters
-
[in] | fileName | Name of an ASS/SSA file. |
[in] | codecName | Codec name for the file. Default is UTF-8. |
- Returns
- True on success, false on error (file not found, etc.)
- See also
- QTextStream::setCodec()
◆ currentSection()
QString QtlSubStationAlphaParser::currentSection |
( |
| ) |
const |
|
inline |
Get the current section name.
- Returns
- The current section name.
◆ isAdvanced()
bool QtlSubStationAlphaParser::isAdvanced |
( |
| ) |
const |
|
inline |
Check if the format is "advanced" Sub Station Alpha (aka ASS).
- Returns
- True for ASS, false for SSA.
◆ scriptInfoCompleted()
bool QtlSubStationAlphaParser::scriptInfoCompleted |
( |
| ) |
const |
|
inline |
Check if the [Script Info] section has been completely parsed.
- Returns
- True if the [Script Info] section has been completely parsed.
◆ getScriptInfo()
QString QtlSubStationAlphaParser::getScriptInfo |
( |
const QString & |
name, |
|
|
const QString & |
defaultValue = QString() |
|
) |
| const |
Get one field of the script info.
- Parameters
-
[in] | name | Info name. |
[in] | defaultValue | Default value if the field is not found. |
- Returns
- The information value as a string.
◆ normalized()
QString QtlSubStationAlphaParser::normalized |
( |
const QString & |
name | ) |
|
|
static |
Convert an identifier to a normalized format.
This method is useless for applications.
- Parameters
-
- Returns
- Normalized format, in lower case, with all spaces "simplified".
◆ sectionChanged
void QtlSubStationAlphaParser::sectionChanged |
( |
const QString & |
sectionName | ) |
|
|
signal |
Emitted at the start of a section.
- Parameters
-
[in] | sectionName | Name of the section, as it appears in the file. |
◆ subtitleFrame
Emitted when a subtitle frame is found.
- Parameters
-
[in] | frame | Smart pointer to a subtitle frame. |
◆ _nullLog
◆ _log
◆ _isAdvanced
bool QtlSubStationAlphaParser::_isAdvanced |
|
private |
True for ASS, false for SSA.
◆ _scriptInfoCompleted
bool QtlSubStationAlphaParser::_scriptInfoCompleted |
|
private |
True if [Script Info] section has been completely parsed.
◆ _sectionName
QString QtlSubStationAlphaParser::_sectionName |
|
private |
◆ _sectionNormalized
QString QtlSubStationAlphaParser::_sectionNormalized |
|
private |
◆ _formatList
QStringList QtlSubStationAlphaParser::_formatList |
|
private |
Current list of formats, in normalized form.
◆ _infoMap
QMap<QString,QString> QtlSubStationAlphaParser::_infoMap |
|
private |
Map of script info, using normalized type names as keys.
◆ _styles
Map of styles, using normalized names as keys.
The documentation for this class was generated from the following files: