libdigidocpp
|
#include <Document.h>
Public Member Functions | |
Document (const std::string &filepath, const std::string &mediaType) | |
Document (const std::string &filename, const std::string &filepath, const std::string &mediaType, const std::string &id="") | |
std::string | getId () const |
std::string | getFileName () const |
std::string | getFilePath () const |
std::string | getMediaType () const |
unsigned long | getSize () const throw (IOException) |
std::vector< unsigned char > | calcDigest (Digest *calc) throw (IOException) |
void | saveAs (const std::string &path) throw (IOException) |
Protected Attributes | |
std::string | id |
std::string | filename |
std::string | filepath |
std::string | mediaType |
std::vector< unsigned char > | digest |
Document wrapper for signed file in BDOC container.
Definition at line 32 of file Document.h.
digidoc::Document::Document | ( | const std::string & | filepath, |
const std::string & | mediaType | ||
) |
Initializes the document object.
filepath | full path of the document. |
mediaType | document media type (e.g. "application/msword" or "text/xml"). |
Definition at line 33 of file Document.cpp.
digidoc::Document::Document | ( | const std::string & | filename, |
const std::string & | filepath, | ||
const std::string & | mediaType, | ||
const std::string & | id = "" |
||
) |
Initializes the document object.
filename | name of the document |
filepath | full path of the document. |
mediaType | document media type (e.g. "application/msword" or "text/xml"). |
Definition at line 47 of file Document.cpp.
std::vector< unsigned char > digidoc::Document::calcDigest | ( | Digest * | calc | ) | throw (IOException) |
Calculates digest for document. If digest is already calculated returns it, otherwise calculates the digest.
calc | digest calculator implementation. return returns calculated digest. throws IOException throws exception if the file does not exist or digest calculation fails. |
Definition at line 104 of file Document.cpp.
References DEBUG, DEBUGMEM, digidoc::util::File::encodeName(), long(), and THROW_IOEXCEPTION.
Referenced by digidoc::SignatureBES::prepareSignedInfo().
std::string digidoc::Document::getFileName | ( | ) | const |
Definition at line 66 of file Document.cpp.
Referenced by digidoc::SignatureBES::checkReferencesToDocs(), open(), and digidoc::SignatureBES::prepareSignedInfo().
std::string digidoc::Document::getFilePath | ( | ) | const |
Definition at line 74 of file Document.cpp.
Referenced by digidoc::DDoc::loadFile().
std::string digidoc::Document::getId | ( | ) | const |
Definition at line 58 of file Document.cpp.
std::string digidoc::Document::getMediaType | ( | ) | const |
Definition at line 83 of file Document.cpp.
Referenced by open(), and digidoc::SignatureBES::prepareSignedInfo().
unsigned long digidoc::Document::getSize | ( | ) | const throw (IOException) |
Definition at line 91 of file Document.cpp.
References digidoc::util::File::fileSize().
Referenced by open().
void digidoc::Document::saveAs | ( | const std::string & | path | ) | throw (IOException) |
Saves a copy of the document as file specified by path.
path | full file path, where the document should be saved to. If file exists, it is overwritten throws IOException if part of path does not exist or path is existing directory (without file name) |
Definition at line 144 of file Document.cpp.
References digidoc::util::File::copyFile().
Referenced by open().
|
protected |
Definition at line 48 of file Document.h.
|
protected |
Definition at line 47 of file Document.h.
|
protected |
Definition at line 47 of file Document.h.
|
protected |
Definition at line 47 of file Document.h.
|
protected |
Definition at line 47 of file Document.h.