blob: 0c21822cba066c5e037923d18b5bd71c059f0c0a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#include <boost/thread/mutex.hpp>
#include <libxml++/libxml++.h>
#include <libcxml/cxml.h>
#include "content.h"
#include "util.h"
using std::string;
using boost::shared_ptr;
Content::Content (boost::filesystem::path f)
: _file (f)
{
}
Content::Content (shared_ptr<const cxml::Node> node)
{
_file = node->string_child ("File");
_digest = node->string_child ("Digest");
}
Content::Content (Content const & o)
: _file (o._file)
, _digest (o._digest)
{
}
void
Content::as_xml (xmlpp::Node* node) const
{
boost::mutex::scoped_lock lm (_mutex);
node->add_child("File")->add_child_text (_file.string());
node->add_child("Digest")->add_child_text (_digest);
}
void
Content::examine (shared_ptr<Film>, shared_ptr<Job>, bool)
{
string const d = md5_digest (_file);
boost::mutex::scoped_lock lm (_mutex);
_digest = d;
}
|