diff options
| author | Carl Hetherington <cth@carlh.net> | 2018-08-21 14:27:00 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2018-08-21 14:27:00 +0100 |
| commit | e2ebf847ce9d6e74a1b9d768475b8ae552cfba82 (patch) | |
| tree | 4aaf64c47cc3f0dcc7eb002b7ed86bb75bcee51d /src/lib/content.cc | |
| parent | 8c61932cc0425a67153fd9e8a34ec585bfa985c1 (diff) | |
Make Content::_paths private.
Diffstat (limited to 'src/lib/content.cc')
| -rw-r--r-- | src/lib/content.cc | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/lib/content.cc b/src/lib/content.cc index ee394d8e5..9e7beee33 100644 --- a/src/lib/content.cc +++ b/src/lib/content.cc @@ -87,7 +87,7 @@ Content::Content (shared_ptr<const Film> film, boost::filesystem::path p) , _trim_end (0) , _change_signals_frequent (false) { - _paths.push_back (p); + add_path (p); } Content::Content (shared_ptr<const Film> film, cxml::ConstNodePtr node) @@ -145,8 +145,8 @@ Content::as_xml (xmlpp::Node* node, bool with_paths) const boost::mutex::scoped_lock lm (_mutex); if (with_paths) { - for (vector<boost::filesystem::path>::const_iterator i = _paths.begin(); i != _paths.end(); ++i) { - node->add_child("Path")->add_child_text (i->string ()); + BOOST_FOREACH (boost::filesystem::path i, _paths) { + node->add_child("Path")->add_child_text (i.string()); } } node->add_child("Digest")->add_child_text (_digest); @@ -299,8 +299,8 @@ Content::identifier () const bool Content::paths_valid () const { - for (vector<boost::filesystem::path>::const_iterator i = _paths.begin(); i != _paths.end(); ++i) { - if (!boost::filesystem::exists (*i)) { + BOOST_FOREACH (boost::filesystem::path i, _paths) { + if (!boost::filesystem::exists (i)) { return false; } } @@ -312,7 +312,11 @@ void Content::set_paths (vector<boost::filesystem::path> paths) { ChangeSignaller<Content> cc (this, ContentProperty::PATH); - _paths = paths; + + { + boost::mutex::scoped_lock lm (_mutex); + _paths = paths; + } } string @@ -474,3 +478,10 @@ Content::text_of_original_type (TextType type) const return shared_ptr<TextContent> (); } + +void +Content::add_path (boost::filesystem::path p) +{ + boost::mutex::scoped_lock lm (_mutex); + _paths.push_back (p); +} |
