NDEVR
API Documentation
SubtitleFileReader

Class which can be used to read a subtitle file and return the subtitle that should be played at a specific time. More...

Collaboration diagram for SubtitleFileReader:
[legend]

Public Member Functions

 SubtitleFileReader (const File &file)
 Constructs a SubtitleFileReader that reads from the given file.
String currentText (const TimeSpan &current) const
 Returns the subtitle text that should be displayed at the given time.
void readText ()
 Parses and loads all subtitle entries from the file.

Protected Member Functions

TimeSpan convertFromString (const StringView &string)
 Converts a timestamp string from the subtitle file into a TimeSpan.

Protected Attributes

BufferedScanner m_scanner
 Buffered file scanner for reading the subtitle file.
Buffer< std::pair< Vector< 2, TimeSpan >, String > > m_subtitles
 Parsed subtitle entries with start/end times and text.

Detailed Description

Class which can be used to read a subtitle file and return the subtitle that should be played at a specific time.


Definition at line 55 of file SubtitleFile.h.

Constructor & Destructor Documentation

◆ SubtitleFileReader()

SubtitleFileReader::SubtitleFileReader ( const File & file)

Constructs a SubtitleFileReader that reads from the given file.

Parameters
[in]fileThe subtitle file to read.

Member Function Documentation

◆ convertFromString()

TimeSpan SubtitleFileReader::convertFromString ( const StringView & string)
protected

Converts a timestamp string from the subtitle file into a TimeSpan.

Parameters
[in]stringThe timestamp string to convert.
Returns
The parsed TimeSpan value.

◆ currentText()

String SubtitleFileReader::currentText ( const TimeSpan & current) const

Returns the subtitle text that should be displayed at the given time.

Parameters
[in]currentThe current playback time.
Returns
The subtitle text for the given time, or an empty string if none.

The documentation for this class was generated from the following file: