/* */ #include "Signature.h" #include "File.h" #include namespace aria2 { Signature::Signature() {} Signature::~Signature() {} void Signature::setType(const std::string& type) { _type = type; } const std::string& Signature::getType() const { return _type; } void Signature::setFile(const std::string& file) { _file = file; } const std::string& Signature::getFile() const { return _file; } void Signature::setBody(const std::string& body) { _body = body; } const std::string& Signature::getBody() const { return _body; } bool Signature::save(const std::string& filepath) const { if(File(filepath).exists()) { return false; } std::ofstream out(filepath.c_str(), std::ios::binary); try { out.exceptions(std::ios::failbit); out << _body; out.close(); return true; } catch(const std::ios::failure& exception) { return false; } } } // namespace aria2