summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-11-26 11:09:09 +0000
committerCarl Hetherington <cth@carlh.net>2015-11-26 11:09:09 +0000
commitea629ead13e819b4ff5d5b5eba7b57520e8107e3 (patch)
tree22e58dc6176d80b5e600923627abc139455d6ff3
parentbc2b4bb709683de594f08c4db0228c11f14bbf66 (diff)
Extract examine_subtitle_nodes into its own method.
-rw-r--r--src/subtitle_asset.cc22
-rw-r--r--src/subtitle_asset.h6
2 files changed, 22 insertions, 6 deletions
diff --git a/src/subtitle_asset.cc b/src/subtitle_asset.cc
index 6a57f455..414825a4 100644
--- a/src/subtitle_asset.cc
+++ b/src/subtitle_asset.cc
@@ -67,6 +67,21 @@ SubtitleAsset::parse_subtitles (shared_ptr<cxml::Document> xml, list<shared_ptr<
}
void
+SubtitleAsset::examine_subtitle_nodes (
+ shared_ptr<const cxml::Node> xml,
+ list<shared_ptr<dcp::SubtitleNode> > const & subtitle_nodes,
+ ParseState& parse_state
+ )
+{
+ for (list<shared_ptr<dcp::SubtitleNode> >::const_iterator j = subtitle_nodes.begin(); j != subtitle_nodes.end(); ++j) {
+ parse_state.subtitle_nodes.push_back (*j);
+ examine_text_nodes (xml, (*j)->text_nodes, parse_state);
+ examine_font_nodes (xml, (*j)->font_nodes, parse_state);
+ parse_state.subtitle_nodes.pop_back ();
+ }
+}
+
+void
SubtitleAsset::examine_font_nodes (
shared_ptr<const cxml::Node> xml,
list<shared_ptr<dcp::FontNode> > const & font_nodes,
@@ -78,12 +93,7 @@ SubtitleAsset::examine_font_nodes (
parse_state.font_nodes.push_back (*i);
maybe_add_subtitle ((*i)->text, parse_state);
- for (list<shared_ptr<dcp::SubtitleNode> >::iterator j = (*i)->subtitle_nodes.begin(); j != (*i)->subtitle_nodes.end(); ++j) {
- parse_state.subtitle_nodes.push_back (*j);
- examine_text_nodes (xml, (*j)->text_nodes, parse_state);
- examine_font_nodes (xml, (*j)->font_nodes, parse_state);
- parse_state.subtitle_nodes.pop_back ();
- }
+ examine_subtitle_nodes (xml, (*i)->subtitle_nodes, parse_state);
examine_font_nodes (xml, (*i)->font_nodes, parse_state);
examine_text_nodes (xml, (*i)->text_nodes, parse_state);
diff --git a/src/subtitle_asset.h b/src/subtitle_asset.h
index 258329fc..8532d6a3 100644
--- a/src/subtitle_asset.h
+++ b/src/subtitle_asset.h
@@ -138,6 +138,12 @@ private:
std::list<boost::shared_ptr<TextNode> > const & text_nodes,
ParseState& parse_state
);
+
+ void examine_subtitle_nodes (
+ boost::shared_ptr<const cxml::Node> xml,
+ std::list<boost::shared_ptr<SubtitleNode> > const & subtitle_nodes,
+ ParseState& parse_state
+ );
};
}