libdigidocpp
|
#include <WDoc.h>
Public Member Functions | |
WDoc () | |
WDoc (DocumentType type) | |
WDoc (ADoc *doc) | |
WDoc (const std::string &path) throw (IOException, BDocException) | |
~WDoc () | |
void | save () throw (IOException, BDocException) |
void | saveTo (const std::string &path) throw (IOException, BDocException) |
void | addDocument (const Document &document) throw (BDocException) |
Document | getDocument (unsigned int id) const throw (BDocException) |
void | removeDocument (unsigned int id) throw (BDocException) |
unsigned int | documentCount () const |
DocumentType | documentType () const |
void | addSignature (const std::vector< unsigned char > &signature) throw (BDocException) |
const Signature * | getSignature (unsigned int id) const throw (BDocException) |
void | removeSignature (unsigned int id) throw (BDocException) |
unsigned int | signatureCount () const |
void | sign (Signer *signer) throw (BDocException) |
void | setType (DocumentType type) |
std::vector< unsigned char > | getFileDigest (unsigned int id) throw (BDocException) |
![]() | |
virtual | ~ADoc () |
unsigned int | newSignatureId () const |
Private Attributes | |
ADoc * | m_doc |
Additional Inherited Members | |
![]() | |
enum | DocumentType { UnknownType = 0, BDocType = 1, DDocType = 2 } |
Implements wrapper signed digital document container. Container can contain several files and all these files can be signed using signing certificates. Container can only be signed if it contains documents. Documents can be added and removed from container only if the container is not signed. To add or remove documents from signed container remove all the signatures before modifying documents list in container.
WDoc::WDoc | ( | ) |
Initialize container. Default type DDoc
Definition at line 33 of file WDoc.cpp.
References digidoc::ADoc::DDocType, and setType().
WDoc::WDoc | ( | DocumentType | type | ) |
WDoc::WDoc | ( | ADoc * | doc | ) |
WDoc::WDoc | ( | const std::string & | path | ) | throw (IOException, BDocException) |
|
virtual |
Adds document to the container. Documents can be removed from container only after all signatures are removed.
document | a document, which is added to the container. |
BDocException | exception is thrown if the document path is incorrect or document with same file name already exists. Also no document can be added if the container already has one or more signatures. |
Implements digidoc::ADoc.
|
virtual |
Adds signature to the container.
signature | signature, which is added to the container. |
BDocException | throws exception if there are no documents in container. |
Implements digidoc::ADoc.
|
virtual |
Implements digidoc::ADoc.
Definition at line 106 of file WDoc.cpp.
References digidoc::ADoc::documentCount(), and m_doc.
|
virtual |
Reimplemented from digidoc::ADoc.
Definition at line 251 of file WDoc.cpp.
References digidoc::ADoc::documentType(), and m_doc.
|
virtual |
Returns document referenced by document id.
id | document id. |
BDocException | throws exception if the document id is incorrect. |
Implements digidoc::ADoc.
|
virtual |
|
virtual |
Returns signature referenced by signature id.
id | signature id. |
BDocException | throws exception if the signature id is incorrect. |
Implements digidoc::ADoc.
|
virtual |
Removes document from container by document id. Documents can be removed from container only after all signatures are removed.
id | document's id, which will be removed. |
BDocException | throws exception if the document id is incorrect or there are one or more signatures. |
Implements digidoc::ADoc.
|
virtual |
Removes signature from container by signature id.
id | signature's id, which will be removed. |
BDocException | throws exception if the signature id is incorrect. |
Implements digidoc::ADoc.
|
virtual |
Saves the container using the serializer
implementation provided in readFrom()
method.
IOException | is thrown if there was a failure saving BDOC container. For example added document does not exist. |
BDocException | is thrown if BDoc class is not correctly initialized. |
Implements digidoc::ADoc.
Definition at line 182 of file WDoc.cpp.
References m_doc, and digidoc::ADoc::save().
|
virtual |
Saves the container using the serializer
implementation provided.
path | filepath, used to save data to BDOC container. |
IOException | is thrown if there was a failure saving BDOC container. For example added document does not exist. |
BDocException | is thrown if BDOC class is not correctly initialized. |
Implements digidoc::ADoc.
void WDoc::setType | ( | DocumentType | type | ) |
Sets doucment type
type | document type |
Definition at line 211 of file WDoc.cpp.
References digidoc::ADoc::BDocType, digidoc::ADoc::DDocType, and m_doc.
Referenced by WDoc().
|
virtual |
Signs all documents in container.
signer | signer implementation. |
profile | signature profile (e.g. BES, TM). |
BDocException | exception is throws if signing the BDCO container failed. |
Implements digidoc::ADoc.
|
virtual |
Implements digidoc::ADoc.
Definition at line 240 of file WDoc.cpp.
References m_doc, and digidoc::ADoc::signatureCount().
|
private |
Definition at line 61 of file WDoc.h.
Referenced by documentCount(), documentType(), save(), setType(), signatureCount(), WDoc(), and ~WDoc().