summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-12-08 22:17:35 +0000
committerCarl Hetherington <cth@carlh.net>2018-12-08 22:17:35 +0000
commit2e0c94655f51ea9f01afea57f0c5f9d0f8efeb8d (patch)
tree2f70c2b76d1c97c786c3b205f19eb983951c8d02 /src/lib
parent29436ead35fbb6041fd24115623cad7638693d8e (diff)
swaroop: better handling of missing content in SPLs.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/spl.cc7
-rw-r--r--src/lib/spl.h12
2 files changed, 14 insertions, 5 deletions
diff --git a/src/lib/spl.cc b/src/lib/spl.cc
index 74538aa99..2cba229c1 100644
--- a/src/lib/spl.cc
+++ b/src/lib/spl.cc
@@ -28,24 +28,23 @@
using std::cout;
using boost::shared_ptr;
-bool
+void
SPL::read (boost::filesystem::path path, ContentStore* store)
{
_spl.clear ();
+ _missing = false;
cxml::Document doc ("SPL");
doc.read_file (path);
- bool missing = false;
BOOST_FOREACH (cxml::ConstNodePtr i, doc.node_children("Entry")) {
shared_ptr<Content> c = store->get(i->string_child("Digest"));
if (c) {
add (SPLEntry(c, i));
} else {
- missing = true;
+ _missing = true;
}
}
_name = path.filename().string();
- return missing;
}
void
diff --git a/src/lib/spl.h b/src/lib/spl.h
index a0b754f04..b94c08571 100644
--- a/src/lib/spl.h
+++ b/src/lib/spl.h
@@ -28,6 +28,10 @@ class ContentStore;
class SPL
{
public:
+ SPL ()
+ : _missing (false)
+ {}
+
void add (SPLEntry e) {
_spl.push_back (e);
}
@@ -48,16 +52,22 @@ public:
return _spl[index];
}
- bool read (boost::filesystem::path path, ContentStore* store);
+ void read (boost::filesystem::path path, ContentStore* store);
void write (boost::filesystem::path path) const;
std::string name () const {
return _name;
}
+ bool missing () const {
+ return _missing;
+ }
+
private:
std::string _name;
std::vector<SPLEntry> _spl;
+ /** true if any content was missing when read() was last called on this SPL */
+ bool _missing;
};
#endif