libdigidocpp
digidoc::Document Class Reference

#include <Document.h>

Collaboration diagram for digidoc::Document:
Collaboration graph

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

Detailed Description

Document wrapper for signed file in BDOC container.

Author
Janari Põld

Definition at line 32 of file Document.h.

Constructor & Destructor Documentation

digidoc::Document::Document ( const std::string &  filepath,
const std::string &  mediaType 
)

Initializes the document object.

Parameters
filepathfull path of the document.
mediaTypedocument 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.

Parameters
filenamename of the document
filepathfull path of the document.
mediaTypedocument media type (e.g. "application/msword" or "text/xml").

Definition at line 47 of file Document.cpp.

Member Function Documentation

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.

Parameters
calcdigest 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().

Here is the call graph for this function:

Here is the caller graph for this function:

std::string digidoc::Document::getFileName ( ) const
Returns
returns document name

Definition at line 66 of file Document.cpp.

Referenced by digidoc::SignatureBES::checkReferencesToDocs(), open(), and digidoc::SignatureBES::prepareSignedInfo().

Here is the caller graph for this function:

std::string digidoc::Document::getFilePath ( ) const
Returns
returns document full path.

Definition at line 74 of file Document.cpp.

Referenced by digidoc::DDoc::loadFile().

Here is the caller graph for this function:

std::string digidoc::Document::getId ( ) const
Returns
returns document id

Definition at line 58 of file Document.cpp.

std::string digidoc::Document::getMediaType ( ) const
Returns
returns documents media type. @ see Document::Document(const std::string& fullPath, const std::string& mediaType)

Definition at line 83 of file Document.cpp.

Referenced by open(), and digidoc::SignatureBES::prepareSignedInfo().

Here is the caller graph for this function:

unsigned long digidoc::Document::getSize ( ) const throw (IOException)
Returns
returns the document file size.

Definition at line 91 of file Document.cpp.

References digidoc::util::File::fileSize().

Referenced by open().

Here is the call graph for this function:

Here is the caller graph for this function:

void digidoc::Document::saveAs ( const std::string &  path) throw (IOException)

Saves a copy of the document as file specified by path.

Parameters
pathfull 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().

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

std::vector<unsigned char> digidoc::Document::digest
protected

Definition at line 48 of file Document.h.

std::string digidoc::Document::filename
protected

Definition at line 47 of file Document.h.

std::string digidoc::Document::filepath
protected

Definition at line 47 of file Document.h.

std::string digidoc::Document::id
protected

Definition at line 47 of file Document.h.

std::string digidoc::Document::mediaType
protected

Definition at line 47 of file Document.h.


The documentation for this class was generated from the following files: