/*
- Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
*/
+#ifndef LIBSUB_DCP_READER_H
+#define LIBSUB_DCP_READER_H
+
#include "reader.h"
+#include <libcxml/cxml.h>
#include <boost/shared_ptr.hpp>
-
-namespace cxml {
- class Node;
-}
+#include <boost/filesystem.hpp>
namespace sub {
-class DCPFont;
-class DCPText;
-class DCPSubtitle;
-class DCPLoadFont;
+namespace dcp {
+ class Font;
+ class Text;
+ class Subtitle;
+}
+/** @class DCPReader
+ * @brief A class which reads DCP subtitles.
+ */
class DCPReader : public Reader
{
-public:
- DCPReader (std::istream &);
+protected:
-private:
-
struct ParseState {
- std::list<boost::shared_ptr<DCPFont> > font_nodes;
- std::list<boost::shared_ptr<DCPText> > text_nodes;
- std::list<boost::shared_ptr<DCPSubtitle> > subtitle_nodes;
+ std::list<boost::shared_ptr<dcp::Font> > font_nodes;
+ std::list<boost::shared_ptr<dcp::Text> > text_nodes;
+ std::list<boost::shared_ptr<dcp::Subtitle> > subtitle_nodes;
};
- void maybe_add_subtitle (std::string text, ParseState const & parse_state);
+ void parse_common (cxml::NodePtr root, boost::optional<int> tcr);
+
+ std::string _id;
- void examine_font_nodes (
- boost::shared_ptr<const cxml::Node> xml,
- std::list<boost::shared_ptr<DCPFont> > const & font_nodes,
- ParseState& parse_state
- );
+private:
+ void parse_node (xmlpp::Node const * node, ParseState& parse_state, boost::optional<int> tcr);
+ void maybe_add_subtitle (std::string text, ParseState const & parse_state);
- void examine_text_nodes (
- boost::shared_ptr<const cxml::Node> xml,
- std::list<boost::shared_ptr<DCPText> > const & text_nodes,
- ParseState& parse_state
- );
-
- std::string font_id_to_name (std::string id) const;
-
- std::list<boost::shared_ptr<DCPLoadFont> > _load_font_nodes;
+ std::string _reel_number;
+ std::string _language;
};
}
+
+#endif