This example demonstrates how to join multiple transformers to create a more complex filter.
#include "docwire.h"
int main(int argc, char* argv[])
{
try
{
std::filesystem::path("1.pst") | content_type::detector{} | mail_parser{} | office_formats_parser{} |
[](message_ptr msg, const message_callbacks& emit_message)
{
if (msg->is<mail::mail>())
{
auto subject = msg->get<mail::mail>().subject;
if (subject)
{
if (subject->find("Hello") != std::string::npos)
{
return continuation::skip;
}
}
}
return emit_message(std::move(msg));
} |
[counter = 0, max_mails = 3](message_ptr msg, const message_callbacks& emit_message) mutable
{
if (msg->is<mail::mail>() && ++counter > max_mails)
return continuation::stop;
return emit_message(std::move(msg));
} |
plain_text_exporter() |
std::cout;
return 0;
}
DOCWIRE_CORE_EXPORT std::string diagnostic_message(const std::exception &e)
Generates a diagnostic message for the given nested exceptions chain.
The main namespace for the DocWire SDK.