#include <paludis/paludis.hh>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <set>
#include <time.h>
using namespace examples;
using std::cout;
using std::endl;
using std::left;
using std::setw;
namespace
{
class MaskInformationVisitor
{
public:
{
cout << left << setw(30) << " Class:" << " " << "UserMask" << endl;
}
{
cout << left << setw(30) << " Class:" << " " << "UnacceptedMask" << endl;
cout << left << setw(30) << " Unaccepted key:" << " " << mask.unaccepted_key_name() << endl;
}
{
cout << left << setw(30) << " Class:" << " " << "RepositoryMask" << endl;
cout << left << setw(30) << " Mask file:" << " " << mask.mask_file() << endl;
if (! mask.comment().empty())
cout << left << setw(30) << " Comment:" << " " << mask.comment() << endl;
if (! mask.token().empty())
cout << left << setw(30) << " Token:" << " " << mask.token() << endl;
}
{
cout << left << setw(30) << " Class:" << " " << "UnsupportedMask" << endl;
cout << left << setw(30) << " Explanation:" << " " << mask.explanation() << endl;
}
};
}
int main(int argc, char * argv[])
{
int exit_status(0);
try
{
"example_mask", "EXAMPLE_MASK_OPTIONS", "EXAMPLE_MASK_CMDLINE");
for (const auto & id : *ids)
{
cout << *id << ":" << endl;
for (const auto & mask : id->masks())
{
cout << left << setw(30) << " Key:" << " " << std::string(1, mask->key()) << endl;
cout << left << setw(30) << " Description:" << " " << mask->description() << endl;
MaskInformationVisitor v;
mask->accept(v);
cout << endl;
}
cout << endl;
}
}
{
cout << endl;
cout << "Unhandled exception:" << endl
return EXIT_FAILURE;
}
catch (const std::exception & e)
{
cout << endl;
cout << "Unhandled exception:" << endl
<< " * " << e.what() << endl;
return EXIT_FAILURE;
}
catch (...)
{
cout << endl;
cout << "Unhandled exception:" << endl
<< " * Unknown exception type. Ouch..." << endl;
return EXIT_FAILURE;
}
return exit_status;
}
Definition exception.hh:77
std::string backtrace(const std::string &delim) const
const char * what() const noexcept override
const std::string & message() const noexcept
static CommandLine * get_instance() PALUDIS_ATTRIBUTE((warn_unused_result))
Definition generator.hh:179
Definition selection.hh:172
Definition about_metadata-fwd.hh:24