#include "docwire.h"
 
int main(int argc, char* argv[])
{
using namespace docwire
std::filesystem::path("1.pst") | content_type::detector{} |
mail_parser{} | office_formats_parser{} |
[](Tag&& tag, const emission_callbacks& emit_tag) // Create an input from file path, parser and connect them to transformer
{
if (std::holds_alternative<tag::Mail>(tag)) // if current node is mail
{
auto subject = std::get<tag::Mail>(tag).subject // get the subject attribute
if (subject) // if subject attribute exists
{
if (subject->find("Hello") != std::string::npos) // if subject contains "Hello"
{
return continuation::skip // skip the current node
}
}
}
return emit_tag(std::move(tag))
} |
[counter = 0, max_mails = 1](Tag&& tag, const emission_callbacks& emit_tag) mutable // Create a transformer and connect it to previous transformer
{
if (std::holds_alternative<tag::Mail>(tag)) // if current node is mail
{
if (++counter > max_mails) // if counter is greater than max_mails
{
return continuation::stop // cancel the parsing process
}
}
return emit_tag(std::move(tag))
} |
PlainTextExporter() | // sets exporter to plain text
std::cout
return 0
}
posted on 2025-07-05 10:09  北京开发  阅读(6)  评论(0)    收藏  举报