Make a parent for SMPTELoadFont and InteropLoadFont.
authorCarl Hetherington <cth@carlh.net>
Sun, 4 Jan 2015 01:13:33 +0000 (01:13 +0000)
committerCarl Hetherington <cth@carlh.net>
Sun, 4 Jan 2015 01:13:33 +0000 (01:13 +0000)
src/interop_load_font.cc
src/interop_load_font.h
src/interop_subtitle_content.cc
src/interop_subtitle_content.h
src/smpte_load_font.cc
src/smpte_load_font.h
src/smpte_subtitle_content.cc
src/smpte_subtitle_content.h
src/subtitle_content.h
src/wscript

index dede5696044866d8fc4f55e9791e2a7763034b92..d29e49de67d5096b5471c1561acef862bb58c46c 100644 (file)
@@ -26,7 +26,7 @@ using boost::optional;
 using namespace dcp;
 
 InteropLoadFont::InteropLoadFont (string id_, string uri_)
-       : id (id_)
+       : LoadFont (id_)
        , uri (uri_)
 {
 
index c553b557a66f128918c6542a742a3a9fbbdbfe5a..0ab39ad44e5127d8fa7c71102a2579cf9a2873f0 100644 (file)
 
 */
 
+#include "load_font.h"
 #include <libcxml/cxml.h>
 #include <boost/shared_ptr.hpp>
 #include <boost/optional.hpp>
 
 namespace dcp {
        
-class InteropLoadFont 
+class InteropLoadFont : public LoadFont
 {
 public:
        InteropLoadFont () {}
        InteropLoadFont (std::string id, std::string uri);
        InteropLoadFont (cxml::ConstNodePtr node);
 
-       std::string id;
        std::string uri;
 };
 
index 09b30e99141e2d484d3cca2b14158045f6421d53..45977d67da96677250dca452c7d9ec126e16cdd9 100644 (file)
@@ -210,3 +210,11 @@ InteropSubtitleContent::equals (shared_ptr<const Asset> other_asset, EqualityOpt
 
        return true;
 }
+
+list<shared_ptr<LoadFont> >
+InteropSubtitleContent::load_font_nodes () const
+{
+       list<shared_ptr<LoadFont> > lf;
+       copy (_load_font_nodes.begin(), _load_font_nodes.end(), back_inserter (lf));
+       return lf;
+}
index 9dfde104ce6669081ddd313b4f66aac3dfc90f9d..adb45c6b72d63287adbd62c9d6e60b29d223ddac 100644 (file)
@@ -36,9 +36,7 @@ public:
                boost::function<void (NoteType, std::string)> note
                ) const;
 
-       std::list<boost::shared_ptr<InteropLoadFont> > load_font_nodes () const {
-               return _load_font_nodes;
-       }
+       std::list<boost::shared_ptr<LoadFont> > load_font_nodes () const;
 
        void add_font (std::string id, std::string uri);
        
index 90e9c993bf0b188992d42819f17899e5d3ab7e6c..0991f7db0a93bcb1c54e0b7d9c48253293fcc804 100644 (file)
@@ -25,7 +25,7 @@ using boost::shared_ptr;
 using namespace dcp;
 
 SMPTELoadFont::SMPTELoadFont (shared_ptr<const cxml::Node> node)
+       : LoadFont (node->string_attribute ("ID"))
 {
-       id = node->string_attribute ("ID");
        urn = node->content().substr (9);
 }
index d8d1fa66222ab6f7af821c512664a2dc8e6ffc23..7df9ea293bb57875d6d81c5d19a49a9d96584d67 100644 (file)
@@ -17,6 +17,7 @@
 
 */
 
+#include "load_font.h"
 #include <boost/shared_ptr.hpp>
 #include <boost/optional.hpp>
 
@@ -26,13 +27,12 @@ namespace cxml {
 
 namespace dcp {
        
-class SMPTELoadFont 
+class SMPTELoadFont : public LoadFont
 {
 public:
        SMPTELoadFont () {}
        SMPTELoadFont (boost::shared_ptr<const cxml::Node> node);
 
-       std::string id;
        std::string urn;
 };
 
index d34c1dbe6b5f9702ae7f31625f913b55a66a466c..e54b33c31b32b10f9200f9063e28ca8bb2336953 100644 (file)
@@ -67,3 +67,11 @@ SMPTESubtitleContent::SMPTESubtitleContent (boost::filesystem::path file, bool m
 
        parse_common (xml, font_nodes);
 }
+
+list<shared_ptr<LoadFont> >
+SMPTESubtitleContent::load_font_nodes () const
+{
+       list<shared_ptr<LoadFont> > lf;
+       copy (_load_font_nodes.begin(), _load_font_nodes.end(), back_inserter (lf));
+       return lf;
+}
index 70f6f2601009d83a14d27c631a7da068655cb41d..8faea817b9da8069b480afc0cd65b4cb41ed8647 100644 (file)
@@ -31,6 +31,8 @@ public:
         */
        SMPTESubtitleContent (boost::filesystem::path file, bool mxf = true);
 
+       std::list<boost::shared_ptr<LoadFont> > load_font_nodes () const;
+       
 private:
        std::list<boost::shared_ptr<SMPTELoadFont> > _load_font_nodes;
 };
index 94b468681088a4237c2fe3458033790984bd3402..7121387ace45eb9ae6a21750789844d3c2d3f627 100644 (file)
@@ -32,6 +32,7 @@ class SubtitleString;
 class Font;
 class Text;
 class Subtitle;
+class LoadFont;
 
 /** @class SubtitleContent
  *  @brief A parent for classes representing a file containing subtitles.
@@ -67,8 +68,10 @@ public:
 
        Time latest_subtitle_out () const;
 
+       virtual std::list<boost::shared_ptr<LoadFont> > load_font_nodes () const = 0;
+
 protected:
-       void parse_common (boost::shared_ptr<cxml::Document> xml, std::list<boost::shared_ptr<dcp::Font> > font_nodes);
+       void parse_common (boost::shared_ptr<cxml::Document> xml, std::list<boost::shared_ptr<Font> > font_nodes);
        
        std::string pkl_type (Standard) const {
                return "text/xml";
index ae2983a91e00eb19d236b9ce7f5a38f1a530ecfc..d6444aee507b049b853884de2a9ebd313b0d8b8b 100644 (file)
@@ -82,6 +82,7 @@ def build(bld):
               interop_load_font.h
               interop_subtitle_content.h
               key.h
+              load_font.h
               local_time.h
               metadata.h
               mono_picture_mxf.h