summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-06-09 16:18:00 +0100
committerCarl Hetherington <cth@carlh.net>2015-06-09 16:18:00 +0100
commit2a01820de9229fd778787421ec4f7bbf1e4b8bf1 (patch)
tree9243a62fb21cea583f6b012fcc0ec1088ae19c84 /src/lib
parentea3e9db20ede512d5e5d73b41c4cb796eeef56d3 (diff)
Hide Font members behind accessors.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/font.cc12
-rw-r--r--src/lib/font.h23
-rw-r--r--src/lib/writer.cc2
3 files changed, 25 insertions, 12 deletions
diff --git a/src/lib/font.cc b/src/lib/font.cc
index 5cf30a2aa..0e1ad85cd 100644
--- a/src/lib/font.cc
+++ b/src/lib/font.cc
@@ -21,8 +21,8 @@
#include <libxml++/libxml++.h>
Font::Font (cxml::NodePtr node)
- : id (node->string_child ("Id"))
- , file (node->optional_string_child ("File"))
+ : _id (node->string_child ("Id"))
+ , _file (node->optional_string_child ("File"))
{
}
@@ -30,14 +30,14 @@ Font::Font (cxml::NodePtr node)
void
Font::as_xml (xmlpp::Node* node)
{
- node->add_child("Id")->add_child_text (id);
- if (file) {
- node->add_child("File")->add_child_text (file.get().string ());
+ node->add_child("Id")->add_child_text (_id);
+ if (_file) {
+ node->add_child("File")->add_child_text (_file.get().string ());
}
}
bool
operator!= (Font const & a, Font const & b)
{
- return (a.id != b.id || a.file != b.file);
+ return (a.id() != b.id() || a.file() != b.file());
}
diff --git a/src/lib/font.h b/src/lib/font.h
index 8021ab5bc..0dedf7e49 100644
--- a/src/lib/font.h
+++ b/src/lib/font.h
@@ -28,16 +28,29 @@
class Font
{
public:
- Font (std::string id_)
- : id (id_) {}
+ Font (std::string id)
+ : _id (id) {}
Font (cxml::NodePtr node);
void as_xml (xmlpp::Node* node);
-
+
+ std::string id () const {
+ return _id;
+ }
+
+ boost::optional<boost::filesystem::path> file () const {
+ return _file;
+ }
+
+ void set_file (boost::filesystem::path file) {
+ _file = file;
+ }
+
+private:
/** Font ID, used to describe it in the subtitle content */
- std::string id;
- boost::optional<boost::filesystem::path> file;
+ std::string _id;
+ boost::optional<boost::filesystem::path> _file;
};
bool
diff --git a/src/lib/writer.cc b/src/lib/writer.cc
index 7e47c317e..289f10c42 100644
--- a/src/lib/writer.cc
+++ b/src/lib/writer.cc
@@ -521,7 +521,7 @@ Writer::finish ()
/* Add all the fonts to the subtitle content */
BOOST_FOREACH (shared_ptr<Font> i, _fonts) {
- _subtitle_asset->add_font (i->id, i->file.get_value_or (liberation));
+ _subtitle_asset->add_font (i->id(), i->file().get_value_or (liberation));
}
if (dynamic_pointer_cast<dcp::InteropSubtitleAsset> (_subtitle_asset)) {