Rename some things to ...Node.
authorCarl Hetherington <cth@carlh.net>
Thu, 30 Apr 2015 18:22:31 +0000 (19:22 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 30 Apr 2015 18:22:31 +0000 (19:22 +0100)
32 files changed:
src/font.cc [deleted file]
src/font.h [deleted file]
src/font_node.cc [new file with mode: 0644]
src/font_node.h [new file with mode: 0644]
src/interop_load_font.cc [deleted file]
src/interop_load_font.h [deleted file]
src/interop_load_font_node.cc [new file with mode: 0644]
src/interop_load_font_node.h [new file with mode: 0644]
src/interop_subtitle_content.cc
src/interop_subtitle_content.h
src/load_font.h [deleted file]
src/load_font_node.h [new file with mode: 0644]
src/smpte_load_font.cc [deleted file]
src/smpte_load_font.h [deleted file]
src/smpte_load_font_node.cc [new file with mode: 0644]
src/smpte_load_font_node.h [new file with mode: 0644]
src/smpte_subtitle_content.cc
src/smpte_subtitle_content.h
src/subtitle.cc [deleted file]
src/subtitle.h [deleted file]
src/subtitle_content.cc
src/subtitle_content.h
src/subtitle_node.cc [new file with mode: 0644]
src/subtitle_node.h [new file with mode: 0644]
src/text.cc [deleted file]
src/text.h [deleted file]
src/text_node.cc [new file with mode: 0644]
src/text_node.h [new file with mode: 0644]
src/wscript
test/interop_load_font_test.cc
test/smpte_load_font_test.cc
test/text_test.cc

diff --git a/src/font.cc b/src/font.cc
deleted file mode 100644 (file)
index 8656e90..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
-    Copyright (C) 2012-2014 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
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include "types.h"
-#include "raw_convert.h"
-#include "font.h"
-#include "xml.h"
-#include "text.h"
-#include <libcxml/cxml.h>
-#include <boost/foreach.hpp>
-
-using std::string;
-using std::list;
-using boost::shared_ptr;
-using boost::optional;
-using namespace dcp;
-
-Font::Font (cxml::ConstNodePtr node, int tcr)
-{
-       text = node->content ();
-       
-       id = node->optional_string_attribute ("Id");
-       size = node->optional_number_attribute<int64_t> ("Size").get_value_or (0);
-       italic = node->optional_bool_attribute ("Italic");
-       optional<string> c = node->optional_string_attribute ("Color");
-       if (c) {
-               colour = Colour (c.get ());
-       }
-       optional<string> const e = node->optional_string_attribute ("Effect");
-       if (e) {
-               effect = string_to_effect (e.get ());
-       }
-       c = node->optional_string_attribute ( "EffectColor");
-       if (c) {
-               effect_colour = Colour (c.get ());
-       }
-
-       list<cxml::NodePtr> s = node->node_children ("Subtitle");
-       BOOST_FOREACH (cxml::NodePtr& i, s) {
-               subtitle_nodes.push_back (shared_ptr<Subtitle> (new Subtitle (i, tcr)));
-       }
-
-       list<cxml::NodePtr> f = node->node_children ("Font");
-       BOOST_FOREACH (cxml::NodePtr& i, f) {
-               font_nodes.push_back (shared_ptr<Font> (new Font (i, tcr)));
-       }
-       
-       list<cxml::NodePtr> t = node->node_children ("Text");
-       BOOST_FOREACH (cxml::NodePtr& i, t) {
-               text_nodes.push_back (shared_ptr<Text> (new Text (i, tcr)));
-       }
-}
-
-Font::Font (std::list<boost::shared_ptr<Font> > const & font_nodes)
-       : size (0)
-       , italic (false)
-       , colour ("FFFFFFFF")
-       , effect_colour ("FFFFFFFF")
-{
-       for (list<shared_ptr<Font> >::const_iterator i = font_nodes.begin(); i != font_nodes.end(); ++i) {
-               if ((*i)->id) {
-                       id = (*i)->id;
-               }
-               if ((*i)->size != 0) {
-                       size = (*i)->size;
-               }
-               if ((*i)->italic) {
-                       italic = (*i)->italic.get ();
-               }
-               if ((*i)->colour) {
-                       colour = (*i)->colour.get ();
-               }
-               if ((*i)->effect) {
-                       effect = (*i)->effect.get ();
-               }
-               if ((*i)->effect_colour) {
-                       effect_colour = (*i)->effect_colour.get ();
-               }
-       }
-}
diff --git a/src/font.h b/src/font.h
deleted file mode 100644 (file)
index a2589be..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
-    Copyright (C) 2012-2014 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
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-/** @file  src/font.h
- *  @brief Font class
- */
-
-#include "types.h"
-#include "subtitle.h"
-#include <libcxml/cxml.h>
-#include <boost/shared_ptr.hpp>
-#include <boost/optional.hpp>
-#include <list>
-
-namespace dcp {
-
-/** @class Font
- *  @brief Helper class for parsing subtitle XML.
- */
-class Font 
-{
-public:
-       Font ()
-               : size (0)
-       {}
-       
-       Font (cxml::ConstNodePtr node, int tcr);
-       Font (std::list<boost::shared_ptr<Font> > const & font_nodes);
-
-       std::string text;
-       boost::optional<std::string> id;
-       int size;
-       boost::optional<bool> italic;
-       boost::optional<Colour> colour;
-       boost::optional<Effect> effect;
-       boost::optional<Colour> effect_colour;
-       
-       std::list<boost::shared_ptr<Subtitle> > subtitle_nodes;
-       std::list<boost::shared_ptr<Font> > font_nodes;
-       std::list<boost::shared_ptr<Text> > text_nodes;
-};
-
-}
diff --git a/src/font_node.cc b/src/font_node.cc
new file mode 100644 (file)
index 0000000..257a6b5
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+    Copyright (C) 2012-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
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "types.h"
+#include "raw_convert.h"
+#include "font_node.h"
+#include "xml.h"
+#include "text_node.h"
+#include <libcxml/cxml.h>
+#include <boost/foreach.hpp>
+
+using std::string;
+using std::list;
+using boost::shared_ptr;
+using boost::optional;
+using namespace dcp;
+
+FontNode::FontNode (cxml::ConstNodePtr node, int tcr)
+{
+       text = node->content ();
+       
+       id = node->optional_string_attribute ("Id");
+       size = node->optional_number_attribute<int64_t> ("Size").get_value_or (0);
+       italic = node->optional_bool_attribute ("Italic");
+       optional<string> c = node->optional_string_attribute ("Color");
+       if (c) {
+               colour = Colour (c.get ());
+       }
+       optional<string> const e = node->optional_string_attribute ("Effect");
+       if (e) {
+               effect = string_to_effect (e.get ());
+       }
+       c = node->optional_string_attribute ( "EffectColor");
+       if (c) {
+               effect_colour = Colour (c.get ());
+       }
+
+       list<cxml::NodePtr> s = node->node_children ("Subtitle");
+       BOOST_FOREACH (cxml::NodePtr& i, s) {
+               subtitle_nodes.push_back (shared_ptr<SubtitleNode> (new SubtitleNode (i, tcr)));
+       }
+
+       list<cxml::NodePtr> f = node->node_children ("Font");
+       BOOST_FOREACH (cxml::NodePtr& i, f) {
+               font_nodes.push_back (shared_ptr<FontNode> (new FontNode (i, tcr)));
+       }
+       
+       list<cxml::NodePtr> t = node->node_children ("Text");
+       BOOST_FOREACH (cxml::NodePtr& i, t) {
+               text_nodes.push_back (shared_ptr<TextNode> (new TextNode (i, tcr)));
+       }
+}
+
+FontNode::FontNode (std::list<boost::shared_ptr<FontNode> > const & font_nodes)
+       : size (0)
+       , italic (false)
+       , colour ("FFFFFFFF")
+       , effect_colour ("FFFFFFFF")
+{
+       for (list<shared_ptr<FontNode> >::const_iterator i = font_nodes.begin(); i != font_nodes.end(); ++i) {
+               if ((*i)->id) {
+                       id = (*i)->id;
+               }
+               if ((*i)->size != 0) {
+                       size = (*i)->size;
+               }
+               if ((*i)->italic) {
+                       italic = (*i)->italic.get ();
+               }
+               if ((*i)->colour) {
+                       colour = (*i)->colour.get ();
+               }
+               if ((*i)->effect) {
+                       effect = (*i)->effect.get ();
+               }
+               if ((*i)->effect_colour) {
+                       effect_colour = (*i)->effect_colour.get ();
+               }
+       }
+}
diff --git a/src/font_node.h b/src/font_node.h
new file mode 100644 (file)
index 0000000..97efde7
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+    Copyright (C) 2012-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
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+/** @file  src/font_node.h
+ *  @brief FontNode class
+ */
+
+#include "types.h"
+#include "subtitle_node.h"
+#include <libcxml/cxml.h>
+#include <boost/shared_ptr.hpp>
+#include <boost/optional.hpp>
+#include <list>
+
+namespace dcp {
+
+/** @class Font
+ *  @brief Helper class for parsing subtitle XML.
+ */
+class FontNode
+{
+public:
+       FontNode ()
+               : size (0)
+       {}
+       
+       FontNode (cxml::ConstNodePtr node, int tcr);
+       FontNode (std::list<boost::shared_ptr<FontNode> > const & font_nodes);
+
+       std::string text;
+       boost::optional<std::string> id;
+       int size;
+       boost::optional<bool> italic;
+       boost::optional<Colour> colour;
+       boost::optional<Effect> effect;
+       boost::optional<Colour> effect_colour;
+       
+       std::list<boost::shared_ptr<SubtitleNode> > subtitle_nodes;
+       std::list<boost::shared_ptr<FontNode> > font_nodes;
+       std::list<boost::shared_ptr<TextNode> > text_nodes;
+};
+
+}
diff --git a/src/interop_load_font.cc b/src/interop_load_font.cc
deleted file mode 100644 (file)
index d29e49d..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
-    Copyright (C) 2012-2014 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
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include "interop_load_font.h"
-#include <libcxml/cxml.h>
-
-using std::string;
-using boost::shared_ptr;
-using boost::optional;
-using namespace dcp;
-
-InteropLoadFont::InteropLoadFont (string id_, string uri_)
-       : LoadFont (id_)
-       , uri (uri_)
-{
-
-}
-
-InteropLoadFont::InteropLoadFont (cxml::ConstNodePtr node)
-{
-       optional<string> x = node->optional_string_attribute ("Id");
-       if (!x) {
-               x = node->optional_string_attribute ("ID");
-       }
-       id = x.get_value_or ("");
-       
-       uri = node->string_attribute ("URI");
-}
-
-bool
-dcp::operator== (InteropLoadFont const & a, InteropLoadFont const & b)
-{
-       return a.id == b.id && a.uri == b.uri;
-}
-
-bool
-dcp::operator!= (InteropLoadFont const & a, InteropLoadFont const & b)
-{
-       return !(a == b);
-}
diff --git a/src/interop_load_font.h b/src/interop_load_font.h
deleted file mode 100644 (file)
index 0ab39ad..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-    Copyright (C) 2012-2014 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
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include "load_font.h"
-#include <libcxml/cxml.h>
-#include <boost/shared_ptr.hpp>
-#include <boost/optional.hpp>
-
-namespace dcp {
-       
-class InteropLoadFont : public LoadFont
-{
-public:
-       InteropLoadFont () {}
-       InteropLoadFont (std::string id, std::string uri);
-       InteropLoadFont (cxml::ConstNodePtr node);
-
-       std::string uri;
-};
-
-bool operator== (InteropLoadFont const & a, InteropLoadFont const & b);
-bool operator!= (InteropLoadFont const & a, InteropLoadFont const & b);
-
-}
diff --git a/src/interop_load_font_node.cc b/src/interop_load_font_node.cc
new file mode 100644 (file)
index 0000000..7c15f40
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+    Copyright (C) 2012-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
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "interop_load_font_node.h"
+#include <libcxml/cxml.h>
+
+using std::string;
+using boost::shared_ptr;
+using boost::optional;
+using namespace dcp;
+
+InteropLoadFontNode::InteropLoadFontNode (string id_, string uri_)
+       : LoadFontNode (id_)
+       , uri (uri_)
+{
+
+}
+
+InteropLoadFontNode::InteropLoadFontNode (cxml::ConstNodePtr node)
+{
+       optional<string> x = node->optional_string_attribute ("Id");
+       if (!x) {
+               x = node->optional_string_attribute ("ID");
+       }
+       id = x.get_value_or ("");
+       
+       uri = node->string_attribute ("URI");
+}
+
+bool
+dcp::operator== (InteropLoadFontNode const & a, InteropLoadFontNode const & b)
+{
+       return a.id == b.id && a.uri == b.uri;
+}
+
+bool
+dcp::operator!= (InteropLoadFontNode const & a, InteropLoadFontNode const & b)
+{
+       return !(a == b);
+}
diff --git a/src/interop_load_font_node.h b/src/interop_load_font_node.h
new file mode 100644 (file)
index 0000000..5afe869
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+    Copyright (C) 2012-2014 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
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "load_font_node.h"
+#include <libcxml/cxml.h>
+#include <boost/shared_ptr.hpp>
+#include <boost/optional.hpp>
+
+namespace dcp {
+       
+class InteropLoadFontNode : public LoadFontNode
+{
+public:
+       InteropLoadFontNode () {}
+       InteropLoadFontNode (std::string id, std::string uri);
+       InteropLoadFontNode (cxml::ConstNodePtr node);
+
+       std::string uri;
+};
+
+bool operator== (InteropLoadFontNode const & a, InteropLoadFontNode const & b);
+bool operator!= (InteropLoadFontNode const & a, InteropLoadFontNode const & b);
+
+}
index 1018d85cb3f7c397b0a7b40d6b1793c9dba3e0f8..2ba698db1f10e7b3a7b91fac1be9cb6b7f93dd1d 100644 (file)
 */
 
 #include "interop_subtitle_content.h"
-#include "interop_load_font.h"
+#include "interop_load_font_node.h"
 #include "xml.h"
 #include "raw_convert.h"
-#include "font.h"
+#include "font_node.h"
 #include <boost/foreach.hpp>
 
 using std::list;
@@ -40,12 +40,12 @@ InteropSubtitleContent::InteropSubtitleContent (boost::filesystem::path file)
        _id = xml->string_child ("SubtitleID");
 
        _movie_title = xml->string_child ("MovieTitle");
-       _load_font_nodes = type_children<dcp::InteropLoadFont> (xml, "LoadFont");
+       _load_font_nodes = type_children<dcp::InteropLoadFontNode> (xml, "LoadFont");
 
        list<cxml::NodePtr> f = xml->node_children ("Font");
-       list<shared_ptr<dcp::Font> > font_nodes;
+       list<shared_ptr<dcp::FontNode> > font_nodes;
        BOOST_FOREACH (cxml::NodePtr& i, f) {
-               font_nodes.push_back (shared_ptr<Font> (new Font (i, 250)));
+               font_nodes.push_back (shared_ptr<FontNode> (new FontNode (i, 250)));
        }
 
        parse_common (xml, font_nodes);
@@ -78,7 +78,7 @@ InteropSubtitleContent::xml_as_string () const
        root->add_child("ReelNumber")->add_child_text (raw_convert<string> (_reel_number));
        root->add_child("Language")->add_child_text (_language);
 
-       for (list<shared_ptr<InteropLoadFont> >::const_iterator i = _load_font_nodes.begin(); i != _load_font_nodes.end(); ++i) {
+       for (list<shared_ptr<InteropLoadFontNode> >::const_iterator i = _load_font_nodes.begin(); i != _load_font_nodes.end(); ++i) {
                xmlpp::Element* load_font = root->add_child("LoadFont");
                load_font->set_attribute ("Id", (*i)->id);
                load_font->set_attribute ("URI", (*i)->uri);
@@ -175,7 +175,7 @@ InteropSubtitleContent::xml_as_string () const
 void
 InteropSubtitleContent::add_font (string id, string uri)
 {
-       _load_font_nodes.push_back (shared_ptr<InteropLoadFont> (new InteropLoadFont (id, uri)));
+       _load_font_nodes.push_back (shared_ptr<InteropLoadFontNode> (new InteropLoadFontNode (id, uri)));
 }
 
 bool
@@ -190,8 +190,8 @@ InteropSubtitleContent::equals (shared_ptr<const Asset> other_asset, EqualityOpt
                return false;
        }
 
-       list<shared_ptr<InteropLoadFont> >::const_iterator i = _load_font_nodes.begin ();
-       list<shared_ptr<InteropLoadFont> >::const_iterator j = other->_load_font_nodes.begin ();
+       list<shared_ptr<InteropLoadFontNode> >::const_iterator i = _load_font_nodes.begin ();
+       list<shared_ptr<InteropLoadFontNode> >::const_iterator j = other->_load_font_nodes.begin ();
 
        while (i != _load_font_nodes.end ()) {
                if (j == _load_font_nodes.end ()) {
@@ -216,10 +216,10 @@ InteropSubtitleContent::equals (shared_ptr<const Asset> other_asset, EqualityOpt
        return true;
 }
 
-list<shared_ptr<LoadFont> >
+list<shared_ptr<LoadFontNode> >
 InteropSubtitleContent::load_font_nodes () const
 {
-       list<shared_ptr<LoadFont> > lf;
+       list<shared_ptr<LoadFontNode> > lf;
        copy (_load_font_nodes.begin(), _load_font_nodes.end(), back_inserter (lf));
        return lf;
 }
index 98a4b599327bb144dcc6d4ada4e923edb657f2b4..cb7c52d5fd1e0b53b4c1d021b87c6720b211260a 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-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
@@ -22,7 +22,7 @@
 
 namespace dcp {
 
-class InteropLoadFont
+class InteropLoadFontNode;
 
 class InteropSubtitleContent : public SubtitleContent
 {
@@ -36,7 +36,7 @@ public:
                NoteHandler note
                ) const;
 
-       std::list<boost::shared_ptr<LoadFont> > load_font_nodes () const;
+       std::list<boost::shared_ptr<LoadFontNode> > load_font_nodes () const;
 
        void add_font (std::string id, std::string uri);
        
@@ -44,7 +44,7 @@ public:
 
 private:
        std::string _movie_title;
-       std::list<boost::shared_ptr<InteropLoadFont> > _load_font_nodes;
+       std::list<boost::shared_ptr<InteropLoadFontNode> > _load_font_nodes;
 };
 
 }
diff --git a/src/load_font.h b/src/load_font.h
deleted file mode 100644 (file)
index 15906ef..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
-    Copyright (C) 2012-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
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include <string>
-
-namespace dcp {
-
-class LoadFont
-{
-public:
-       LoadFont () {}
-       LoadFont (std::string id_)
-               : id (id_)
-       {}
-       
-       std::string id;
-};
-
-}
diff --git a/src/load_font_node.h b/src/load_font_node.h
new file mode 100644 (file)
index 0000000..24f193b
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+    Copyright (C) 2012-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
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <string>
+
+namespace dcp {
+
+class LoadFontNode
+{
+public:
+       LoadFontNode () {}
+       LoadFontNode (std::string id_)
+               : id (id_)
+       {}
+       
+       std::string id;
+};
+
+}
diff --git a/src/smpte_load_font.cc b/src/smpte_load_font.cc
deleted file mode 100644 (file)
index 0991f7d..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
-    Copyright (C) 2012-2014 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
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include "smpte_load_font.h"
-#include <libcxml/cxml.h>
-
-using std::string;
-using boost::shared_ptr;
-using namespace dcp;
-
-SMPTELoadFont::SMPTELoadFont (shared_ptr<const cxml::Node> node)
-       : LoadFont (node->string_attribute ("ID"))
-{
-       urn = node->content().substr (9);
-}
diff --git a/src/smpte_load_font.h b/src/smpte_load_font.h
deleted file mode 100644 (file)
index 7df9ea2..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
-    Copyright (C) 2012-2014 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
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include "load_font.h"
-#include <boost/shared_ptr.hpp>
-#include <boost/optional.hpp>
-
-namespace cxml {
-       class Node;
-}
-
-namespace dcp {
-       
-class SMPTELoadFont : public LoadFont
-{
-public:
-       SMPTELoadFont () {}
-       SMPTELoadFont (boost::shared_ptr<const cxml::Node> node);
-
-       std::string urn;
-};
-
-}
diff --git a/src/smpte_load_font_node.cc b/src/smpte_load_font_node.cc
new file mode 100644 (file)
index 0000000..11f7d5a
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+    Copyright (C) 2012-2014 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
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "smpte_load_font_node.h"
+#include <libcxml/cxml.h>
+
+using std::string;
+using boost::shared_ptr;
+using namespace dcp;
+
+SMPTELoadFontNode::SMPTELoadFontNode (shared_ptr<const cxml::Node> node)
+       : LoadFontNode (node->string_attribute ("ID"))
+{
+       urn = node->content().substr (9);
+}
diff --git a/src/smpte_load_font_node.h b/src/smpte_load_font_node.h
new file mode 100644 (file)
index 0000000..1ca7786
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+    Copyright (C) 2012-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
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "load_font_node.h"
+#include <boost/shared_ptr.hpp>
+#include <boost/optional.hpp>
+
+namespace cxml {
+       class Node;
+}
+
+namespace dcp {
+       
+class SMPTELoadFontNode : public LoadFontNode
+{
+public:
+       SMPTELoadFontNode () {}
+       SMPTELoadFontNode (boost::shared_ptr<const cxml::Node> node);
+
+       std::string urn;
+};
+
+}
index 4435fe23929c0f5ed4c2236b464e42a3e284d583..e95a64fccdfb2729bd69433ff47f69499b3c6459 100644 (file)
@@ -18,8 +18,8 @@
 */
 
 #include "smpte_subtitle_content.h"
-#include "smpte_load_font.h"
-#include "font.h"
+#include "smpte_load_font_node.h"
+#include "font_node.h"
 #include "exceptions.h"
 #include "xml.h"
 #include "AS_DCP.h"
@@ -62,25 +62,25 @@ SMPTESubtitleContent::SMPTESubtitleContent (boost::filesystem::path file, bool m
                _id = xml->string_child("Id").substr (9);
        }
        
-       _load_font_nodes = type_children<dcp::SMPTELoadFont> (xml, "LoadFont");
+       _load_font_nodes = type_children<dcp::SMPTELoadFontNode> (xml, "LoadFont");
 
        int tcr = xml->number_child<int> ("TimeCodeRate");
 
        shared_ptr<cxml::Node> subtitle_list = xml->optional_node_child ("SubtitleList");
 
        list<cxml::NodePtr> f = subtitle_list->node_children ("Font");
-       list<shared_ptr<dcp::Font> > font_nodes;
+       list<shared_ptr<dcp::FontNode> > font_nodes;
        BOOST_FOREACH (cxml::NodePtr& i, f) {
-               font_nodes.push_back (shared_ptr<Font> (new Font (i, tcr)));
+               font_nodes.push_back (shared_ptr<FontNode> (new FontNode (i, tcr)));
        }
 
        parse_common (xml, font_nodes);
 }
 
-list<shared_ptr<LoadFont> >
+list<shared_ptr<LoadFontNode> >
 SMPTESubtitleContent::load_font_nodes () const
 {
-       list<shared_ptr<LoadFont> > lf;
+       list<shared_ptr<LoadFontNode> > lf;
        copy (_load_font_nodes.begin(), _load_font_nodes.end(), back_inserter (lf));
        return lf;
 }
index a47cbb3c20b8eb8d4942185ea8ce1fbf75df9f8b..8526e0ec3cbe33603ca12a2d4164e9e166c25e28 100644 (file)
@@ -22,7 +22,7 @@
 
 namespace dcp {
 
-class SMPTELoadFont;   
+class SMPTELoadFontNode;
 
 class SMPTESubtitleContent : public SubtitleContent
 {
@@ -32,12 +32,12 @@ public:
         */
        SMPTESubtitleContent (boost::filesystem::path file, bool mxf = true);
 
-       std::list<boost::shared_ptr<LoadFont> > load_font_nodes () const;
+       std::list<boost::shared_ptr<LoadFontNode> > load_font_nodes () const;
 
        static bool valid_mxf (boost::filesystem::path);
        
 private:
-       std::list<boost::shared_ptr<SMPTELoadFont> > _load_font_nodes;
+       std::list<boost::shared_ptr<SMPTELoadFontNode> > _load_font_nodes;
 };
 
 }
diff --git a/src/subtitle.cc b/src/subtitle.cc
deleted file mode 100644 (file)
index 6c2ccd7..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
-    Copyright (C) 2012-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
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include "subtitle.h"
-#include "xml.h"
-#include "font.h"
-#include "text.h"
-#include <libcxml/cxml.h>
-#include <boost/lexical_cast.hpp>
-
-using std::string;
-using std::list;
-using boost::optional;
-using boost::shared_ptr;
-using boost::lexical_cast;
-using namespace dcp;
-
-Subtitle::Subtitle (boost::shared_ptr<const cxml::Node> node, int tcr)
-{
-       in = Time (node->string_attribute ("TimeIn"), tcr);
-       out = Time (node->string_attribute ("TimeOut"), tcr);
-
-       list<cxml::NodePtr> f = node->node_children ("Font");
-       for (list<cxml::NodePtr>::iterator i = f.begin(); i != f.end(); ++i) {
-               font_nodes.push_back (shared_ptr<Font> (new Font (*i, tcr)));
-       }
-
-       list<cxml::NodePtr> t = node->node_children ("Text");
-       for (list<cxml::NodePtr>::iterator i = t.begin(); i != t.end(); ++i) {
-               text_nodes.push_back (shared_ptr<Text> (new Text (*i, tcr)));
-       }
-       
-       fade_up_time = fade_time (node, "FadeUpTime", tcr);
-       fade_down_time = fade_time (node, "FadeDownTime", tcr);
-}
-
-Time
-Subtitle::fade_time (shared_ptr<const cxml::Node> node, string name, int tcr)
-{
-       string const u = node->optional_string_attribute (name).get_value_or ("");
-       Time t;
-       
-       if (u.empty ()) {
-               t = Time (0, 0, 0, 20, 250);
-       } else if (u.find (":") != string::npos) {
-               t = Time (u, tcr);
-       } else {
-               t = Time (0, 0, 0, lexical_cast<int> (u), tcr);
-       }
-
-       if (t > Time (0, 0, 8, 0, 250)) {
-               t = Time (0, 0, 8, 0, 250);
-       }
-
-       return t;
-}
diff --git a/src/subtitle.h b/src/subtitle.h
deleted file mode 100644 (file)
index 0958a1d..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
-    Copyright (C) 2012-2014 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
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#ifndef LIBDCP_SUBTITLE_H
-#define LIBDCP_SUBTITLE_H
-
-#include "dcp_time.h"
-#include <boost/shared_ptr.hpp>
-#include <boost/optional.hpp>
-#include <list>
-
-namespace cxml {
-       class Node;
-}
-
-namespace dcp {
-
-class Font;    
-class Text;
-
-class Subtitle 
-{
-public:
-       Subtitle () {}
-       Subtitle (boost::shared_ptr<const cxml::Node> node, int tcr);
-
-       Time in;
-       Time out;
-       Time fade_up_time;
-       Time fade_down_time;
-       std::list<boost::shared_ptr<Font> > font_nodes;
-       std::list<boost::shared_ptr<Text> > text_nodes;
-
-private:
-       Time fade_time (boost::shared_ptr<const cxml::Node>, std::string name, int tcr);
-};
-
-}
-
-#endif
index 07fd90f01ebb0357a37cb9f12cda40c472b9d07a..f8321273c46789926d7a06009462ea94bf25adc1 100644 (file)
@@ -21,8 +21,8 @@
 #include "subtitle_content.h"
 #include "util.h"
 #include "xml.h"
-#include "font.h"
-#include "text.h"
+#include "font_node.h"
+#include "text_node.h"
 #include "subtitle_string.h"
 #include "dcp_assert.h"
 #include "AS_DCP.h"
@@ -56,7 +56,7 @@ SubtitleContent::SubtitleContent (boost::filesystem::path file)
 }
 
 void
-SubtitleContent::parse_common (shared_ptr<cxml::Document> xml, list<shared_ptr<dcp::Font> > font_nodes)
+SubtitleContent::parse_common (shared_ptr<cxml::Document> xml, list<shared_ptr<dcp::FontNode> > font_nodes)
 {
        _reel_number = xml->string_child ("ReelNumber");
        _language = xml->string_child ("Language");
@@ -72,16 +72,16 @@ SubtitleContent::parse_common (shared_ptr<cxml::Document> xml, list<shared_ptr<d
 void
 SubtitleContent::examine_font_nodes (
        shared_ptr<const cxml::Node> xml,
-       list<shared_ptr<dcp::Font> > const & font_nodes,
+       list<shared_ptr<dcp::FontNode> > const & font_nodes,
        ParseState& parse_state
        )
 {
-       for (list<shared_ptr<dcp::Font> >::const_iterator i = font_nodes.begin(); i != font_nodes.end(); ++i) {
+       for (list<shared_ptr<dcp::FontNode> >::const_iterator i = font_nodes.begin(); i != font_nodes.end(); ++i) {
 
                parse_state.font_nodes.push_back (*i);
                maybe_add_subtitle ((*i)->text, parse_state);
 
-               for (list<shared_ptr<dcp::Subtitle> >::iterator j = (*i)->subtitle_nodes.begin(); j != (*i)->subtitle_nodes.end(); ++j) {
+               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);
@@ -98,11 +98,11 @@ SubtitleContent::examine_font_nodes (
 void
 SubtitleContent::examine_text_nodes (
        shared_ptr<const cxml::Node> xml,
-       list<shared_ptr<dcp::Text> > const & text_nodes,
+       list<shared_ptr<dcp::TextNode> > const & text_nodes,
        ParseState& parse_state
        )
 {
-       for (list<shared_ptr<dcp::Text> >::const_iterator i = text_nodes.begin(); i != text_nodes.end(); ++i) {
+       for (list<shared_ptr<dcp::TextNode> >::const_iterator i = text_nodes.begin(); i != text_nodes.end(); ++i) {
                parse_state.text_nodes.push_back (*i);
                maybe_add_subtitle ((*i)->text, parse_state);
                examine_font_nodes (xml, (*i)->font_nodes, parse_state);
@@ -124,9 +124,9 @@ SubtitleContent::maybe_add_subtitle (string text, ParseState const & parse_state
        DCP_ASSERT (!parse_state.text_nodes.empty ());
        DCP_ASSERT (!parse_state.subtitle_nodes.empty ());
        
-       dcp::Font effective_font (parse_state.font_nodes);
-       dcp::Text effective_text (*parse_state.text_nodes.back ());
-       dcp::Subtitle effective_subtitle (*parse_state.subtitle_nodes.back ());
+       dcp::FontNode effective_font (parse_state.font_nodes);
+       dcp::TextNode effective_text (*parse_state.text_nodes.back ());
+       dcp::SubtitleNode effective_subtitle (*parse_state.subtitle_nodes.back ());
 
        _subtitles.push_back (
                SubtitleString (
index 0ef7b19d478a3e3438cadcf997c2160fae7c953e..ee4249160b0a75ad3f5eac055d2962df0c416eb5 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-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
@@ -29,10 +29,10 @@ namespace dcp
 {
 
 class SubtitleString;  
-class Font;
-class Text;
-class Subtitle;
-class LoadFont;
+class FontNode;
+class TextNode;
+class SubtitleNode;
+class LoadFontNode;
 
 /** @class SubtitleContent
  *  @brief A parent for classes representing a file containing subtitles.
@@ -68,10 +68,10 @@ public:
 
        Time latest_subtitle_out () const;
 
-       virtual std::list<boost::shared_ptr<LoadFont> > load_font_nodes () const = 0;
+       virtual std::list<boost::shared_ptr<LoadFontNode> > load_font_nodes () const = 0;
 
 protected:
-       void parse_common (boost::shared_ptr<cxml::Document> xml, std::list<boost::shared_ptr<Font> > font_nodes);
+       void parse_common (boost::shared_ptr<cxml::Document> xml, std::list<boost::shared_ptr<FontNode> > font_nodes);
        
        std::string pkl_type (Standard) const {
                return "text/xml";
@@ -89,22 +89,22 @@ protected:
 
 private:
        struct ParseState {
-               std::list<boost::shared_ptr<Font> > font_nodes;
-               std::list<boost::shared_ptr<Text> > text_nodes;
-               std::list<boost::shared_ptr<Subtitle> > subtitle_nodes;
+               std::list<boost::shared_ptr<FontNode> > font_nodes;
+               std::list<boost::shared_ptr<TextNode> > text_nodes;
+               std::list<boost::shared_ptr<SubtitleNode> > subtitle_nodes;
        };
 
        void maybe_add_subtitle (std::string text, ParseState const & parse_state);
        
        void examine_font_nodes (
                boost::shared_ptr<const cxml::Node> xml,
-               std::list<boost::shared_ptr<Font> > const & font_nodes,
+               std::list<boost::shared_ptr<FontNode> > const & font_nodes,
                ParseState& parse_state
                );
        
        void examine_text_nodes (
                boost::shared_ptr<const cxml::Node> xml,
-               std::list<boost::shared_ptr<Text> > const & text_nodes,
+               std::list<boost::shared_ptr<TextNode> > const & text_nodes,
                ParseState& parse_state
                );
 };
diff --git a/src/subtitle_node.cc b/src/subtitle_node.cc
new file mode 100644 (file)
index 0000000..5747633
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+    Copyright (C) 2012-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
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "subtitle_node.h"
+#include "xml.h"
+#include "font_node.h"
+#include "text_node.h"
+#include <libcxml/cxml.h>
+#include <boost/lexical_cast.hpp>
+
+using std::string;
+using std::list;
+using boost::optional;
+using boost::shared_ptr;
+using boost::lexical_cast;
+using namespace dcp;
+
+SubtitleNode::SubtitleNode (boost::shared_ptr<const cxml::Node> node, int tcr)
+{
+       in = Time (node->string_attribute ("TimeIn"), tcr);
+       out = Time (node->string_attribute ("TimeOut"), tcr);
+
+       list<cxml::NodePtr> f = node->node_children ("Font");
+       for (list<cxml::NodePtr>::iterator i = f.begin(); i != f.end(); ++i) {
+               font_nodes.push_back (shared_ptr<FontNode> (new FontNode (*i, tcr)));
+       }
+
+       list<cxml::NodePtr> t = node->node_children ("Text");
+       for (list<cxml::NodePtr>::iterator i = t.begin(); i != t.end(); ++i) {
+               text_nodes.push_back (shared_ptr<TextNode> (new TextNode (*i, tcr)));
+       }
+       
+       fade_up_time = fade_time (node, "FadeUpTime", tcr);
+       fade_down_time = fade_time (node, "FadeDownTime", tcr);
+}
+
+Time
+SubtitleNode::fade_time (shared_ptr<const cxml::Node> node, string name, int tcr)
+{
+       string const u = node->optional_string_attribute (name).get_value_or ("");
+       Time t;
+       
+       if (u.empty ()) {
+               t = Time (0, 0, 0, 20, 250);
+       } else if (u.find (":") != string::npos) {
+               t = Time (u, tcr);
+       } else {
+               t = Time (0, 0, 0, lexical_cast<int> (u), tcr);
+       }
+
+       if (t > Time (0, 0, 8, 0, 250)) {
+               t = Time (0, 0, 8, 0, 250);
+       }
+
+       return t;
+}
diff --git a/src/subtitle_node.h b/src/subtitle_node.h
new file mode 100644 (file)
index 0000000..d615557
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+    Copyright (C) 2012-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
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef LIBDCP_SUBTITLE_NODE_H
+#define LIBDCP_SUBTITLE_NODE_H
+
+#include "dcp_time.h"
+#include <boost/shared_ptr.hpp>
+#include <boost/optional.hpp>
+#include <list>
+
+namespace cxml {
+       class Node;
+}
+
+namespace dcp {
+
+class FontNode;        
+class TextNode;
+
+class SubtitleNode
+{
+public:
+       SubtitleNode () {}
+       SubtitleNode (boost::shared_ptr<const cxml::Node> node, int tcr);
+
+       Time in;
+       Time out;
+       Time fade_up_time;
+       Time fade_down_time;
+       std::list<boost::shared_ptr<FontNode> > font_nodes;
+       std::list<boost::shared_ptr<TextNode> > text_nodes;
+
+private:
+       Time fade_time (boost::shared_ptr<const cxml::Node>, std::string name, int tcr);
+};
+
+}
+
+#endif
diff --git a/src/text.cc b/src/text.cc
deleted file mode 100644 (file)
index d18066d..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
-    Copyright (C) 2012-2014 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
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-/** @file  src/text.cc
- *  @brief Text class for parsing subtitle XML.
- */
-
-#include "text.h"
-#include "xml.h"
-#include "font.h"
-#include <libcxml/cxml.h>
-#include <boost/foreach.hpp>
-
-using std::string;
-using std::list;
-using boost::shared_ptr;
-using boost::optional;
-using namespace dcp;
-
-/** Read a &lt;Text&gt; node from a subtitle XML file, noting its contents
- *  in this object's member variables.
- *  @param node Node to read.
- */
-Text::Text (boost::shared_ptr<const cxml::Node> node, int tcr)
-       : v_align (CENTER)
-{
-       text = node->content ();
-       optional<float> x = node->optional_number_attribute<float> ("VPosition");
-       if (!x) {
-               x = node->number_attribute<float> ("Vposition");
-       }
-       v_position = x.get () / 100;
-       
-       optional<string> v = node->optional_string_attribute ("VAlign");
-       if (!v) {
-               v = node->optional_string_attribute ("Valign");
-       }
-       
-       if (v) {
-               v_align = string_to_valign (v.get ());
-       }
-
-       list<cxml::NodePtr> f = node->node_children ("Font");
-       BOOST_FOREACH (cxml::NodePtr& i, f) {
-               font_nodes.push_back (shared_ptr<Font> (new Font (i, tcr)));
-       }
-}
diff --git a/src/text.h b/src/text.h
deleted file mode 100644 (file)
index fe314f7..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
-    Copyright (C) 2012-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
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-/** @file  src/text.h
- *  @brief Text class for parsing subtitle XML.
- */
-
-#include "types.h"
-#include <boost/shared_ptr.hpp>
-#include <boost/optional.hpp>
-#include <list>
-
-namespace cxml {
-       class Node;
-}
-
-namespace dcp {
-
-class Font;
-
-/** @class Text
- *  @brief Parser for Text nodes from subtitle XML.
- */
-class Text
-{
-public:
-       /** Construct a default text node */
-       Text ()
-               : v_position (0)
-               , v_align (TOP)
-       {}
-       
-       Text (boost::shared_ptr<const cxml::Node> node, int tcr);
-
-       float v_position;
-       VAlign v_align;
-       std::string text;
-       std::list<boost::shared_ptr<Font> > font_nodes;
-};
-
-}
diff --git a/src/text_node.cc b/src/text_node.cc
new file mode 100644 (file)
index 0000000..834b78b
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+    Copyright (C) 2012-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
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+/** @file  src/text.cc
+ *  @brief TextNode class for parsing subtitle XML.
+ */
+
+#include "text_node.h"
+#include "xml.h"
+#include "font_node.h"
+#include <libcxml/cxml.h>
+#include <boost/foreach.hpp>
+
+using std::string;
+using std::list;
+using boost::shared_ptr;
+using boost::optional;
+using namespace dcp;
+
+/** Read a &lt;Text&gt; node from a subtitle XML file, noting its contents
+ *  in this object's member variables.
+ *  @param node Node to read.
+ */
+TextNode::TextNode (boost::shared_ptr<const cxml::Node> node, int tcr)
+       : v_align (CENTER)
+{
+       text = node->content ();
+       optional<float> x = node->optional_number_attribute<float> ("VPosition");
+       if (!x) {
+               x = node->number_attribute<float> ("Vposition");
+       }
+       v_position = x.get () / 100;
+       
+       optional<string> v = node->optional_string_attribute ("VAlign");
+       if (!v) {
+               v = node->optional_string_attribute ("Valign");
+       }
+       
+       if (v) {
+               v_align = string_to_valign (v.get ());
+       }
+
+       list<cxml::NodePtr> f = node->node_children ("Font");
+       BOOST_FOREACH (cxml::NodePtr& i, f) {
+               font_nodes.push_back (shared_ptr<FontNode> (new FontNode (i, tcr)));
+       }
+}
diff --git a/src/text_node.h b/src/text_node.h
new file mode 100644 (file)
index 0000000..2e1b9ac
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+    Copyright (C) 2012-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
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+/** @file  src/text.h
+ *  @brief TextNode class for parsing subtitle XML.
+ */
+
+#include "types.h"
+#include <boost/shared_ptr.hpp>
+#include <boost/optional.hpp>
+#include <list>
+
+namespace cxml {
+       class Node;
+}
+
+namespace dcp {
+
+class FontNode;
+
+/** @class TextNode
+ *  @brief Parser for Text nodes from subtitle XML.
+ */
+class TextNode
+{
+public:
+       /** Construct a default text node */
+       TextNode ()
+               : v_position (0)
+               , v_align (TOP)
+       {}
+       
+       TextNode (boost::shared_ptr<const cxml::Node> node, int tcr);
+
+       float v_position;
+       VAlign v_align;
+       std::string text;
+       std::list<boost::shared_ptr<FontNode> > font_nodes;
+};
+
+}
index 1107d8cd0af87a7799d1e992c852b8eb8203d8bb..ea0623740c620d7d84eab7fac5249bbd4f08e83a 100644 (file)
@@ -16,9 +16,9 @@ def build(bld):
              encrypted_kdm.cc
              exceptions.cc
              file.cc
-             font.cc
+             font_node.cc
              gamma_transfer_function.cc
-             interop_load_font.cc
+             interop_load_font_node.cc
              interop_subtitle_content.cc
              key.cc
              local_time.cc
@@ -42,7 +42,7 @@ def build(bld):
              reel_subtitle_asset.cc
              rgb_xyz.cc
              signer.cc
-             smpte_load_font.cc
+             smpte_load_font_node.cc
              smpte_subtitle_content.cc
              sound_mxf.cc
              sound_mxf_writer.cc
@@ -50,10 +50,10 @@ def build(bld):
              stereo_picture_mxf.cc
              stereo_picture_mxf_writer.cc
              stereo_picture_frame.cc
-             subtitle.cc
+             subtitle_node.cc
              subtitle_content.cc
              subtitle_string.cc
-             text.cc
+             text_node.cc
              transfer_function.cc
              types.cc
              util.cc
index b5972762b74cb058dba2171467c5fbfbe448fd36..9940c5e0829492097e04f51fca1f016a4b070ac8 100644 (file)
 
 */
 
-#include "interop_load_font.h"
+#include "interop_load_font_node.h"
 #include <libcxml/cxml.h>
 #include <libxml++/libxml++.h>
 #include <boost/test/unit_test.hpp>
 
 BOOST_AUTO_TEST_CASE (interop_load_font_test1)
 {
-       dcp::InteropLoadFont lf ("my-great-id", "my-great-uri");
+       dcp::InteropLoadFontNode lf ("my-great-id", "my-great-uri");
        BOOST_CHECK_EQUAL (lf.id, "my-great-id");
        BOOST_CHECK_EQUAL (lf.uri, "my-great-uri");
 }
@@ -36,7 +36,7 @@ BOOST_AUTO_TEST_CASE (interop_load_font_test2)
 
        text->set_attribute("Id", "my-great-id");
        text->set_attribute("URI", "my-great-uri");
-       dcp::InteropLoadFont lf (cxml::ConstNodePtr (new cxml::Node (text)));
+       dcp::InteropLoadFontNode lf (cxml::ConstNodePtr (new cxml::Node (text)));
 
        BOOST_CHECK_EQUAL (lf.id, "my-great-id");
 }
@@ -49,7 +49,7 @@ BOOST_AUTO_TEST_CASE (interop_load_font_test3)
 
        text->set_attribute("ID", "my-great-id");
        text->set_attribute("URI", "my-great-uri");
-       dcp::InteropLoadFont lf (cxml::ConstNodePtr (new cxml::Node (text)));
+       dcp::InteropLoadFontNode lf (cxml::ConstNodePtr (new cxml::Node (text)));
 
        BOOST_CHECK_EQUAL (lf.id, "my-great-id");
 }
@@ -57,9 +57,9 @@ BOOST_AUTO_TEST_CASE (interop_load_font_test3)
 /** Test operator== and operator!= */
 BOOST_AUTO_TEST_CASE (interop_load_font_test4)
 {
-       dcp::InteropLoadFont A ("my-create-id", "my-great-uri");
-       dcp::InteropLoadFont B ("my-create-id", "my-great-uri");
-       dcp::InteropLoadFont C ("my-create-id", "another-great-uri");
+       dcp::InteropLoadFontNode A ("my-create-id", "my-great-uri");
+       dcp::InteropLoadFontNode B ("my-create-id", "my-great-uri");
+       dcp::InteropLoadFontNode C ("my-create-id", "another-great-uri");
 
        BOOST_CHECK (A == B);
        BOOST_CHECK (B != C);
index 4f9d212830ba358e2ce69a07b3108f40c13ece75..77020b98c97c2ab4ce6198ac0e6475bdb40ba95c 100644 (file)
@@ -17,7 +17,7 @@
 
 */
 
-#include "smpte_load_font.h"
+#include "smpte_load_font_node.h"
 #include <libcxml/cxml.h>
 #include <libxml++/libxml++.h>
 #include <boost/test/unit_test.hpp>
@@ -27,9 +27,9 @@ BOOST_AUTO_TEST_CASE (smpte_load_font_test1)
        xmlpp::Document doc;
        xmlpp::Element* text = doc.create_root_node("Font");
 
-       text->set_attribute("ID", "my-great-id");
-       text->add_child_text("urn:uuid:my-great-urn");
-       dcp::SMPTELoadFont lf (cxml::ConstNodePtr (new cxml::Node (text)));
+       text->set_attribute ("ID", "my-great-id");
+       text->add_child_text ("urn:uuid:my-great-urn");
+       dcp::SMPTELoadFontNode lf (cxml::ConstNodePtr (new cxml::Node (text)));
 
        BOOST_CHECK_EQUAL (lf.id, "my-great-id");
        BOOST_CHECK_EQUAL (lf.urn, "my-great-urn");
index 6749a753d6b9e312f0a9d5ce589486fe04632f85..8aff4f1d77f7e3cf769d346d5656f8e878f39acb 100644 (file)
@@ -17,7 +17,7 @@
 
 */
 
-#include "text.h"
+#include "text_node.h"
 #include <libcxml/cxml.h>
 #include <libxml++/libxml++.h>
 #include <boost/test/unit_test.hpp>
@@ -31,7 +31,7 @@ BOOST_AUTO_TEST_CASE (text_test1)
        text->set_attribute("VAlign", "top");
        text->add_child_text("Hello world");
 
-       dcp::Text t (cxml::NodePtr (new cxml::Node (text)), 250);
+       dcp::TextNode t (cxml::NodePtr (new cxml::Node (text)), 250);
        BOOST_CHECK_CLOSE (t.v_position, 0.042, 0.001);
        BOOST_CHECK_EQUAL (t.v_align, dcp::TOP);
        BOOST_CHECK_EQUAL (t.text, "Hello world");
@@ -46,7 +46,7 @@ BOOST_AUTO_TEST_CASE (text_test2)
        text->set_attribute("Valign", "top");
        text->add_child_text("Hello world");
 
-       dcp::Text t (cxml::NodePtr (new cxml::Node (text)), 250);
+       dcp::TextNode t (cxml::NodePtr (new cxml::Node (text)), 250);
        BOOST_CHECK_CLOSE (t.v_position, 0.042, 0.001);
        BOOST_CHECK_EQUAL (t.v_align, dcp::TOP);
        BOOST_CHECK_EQUAL (t.text, "Hello world");