#define XERR
#include "ordertxt.ih"

void OrderTxt::setType(Element &element)
{
                                                // store the actual extension
    s_lastExtension->second = fs::path{ element.name }.extension().c_str();

    auto iter =                                 // define its type
            find_if(s_extension, s_lastExtension + 1,
                [&](Extension const &ext)
                {
                    return ext.second == s_lastExtension->second;
                }
            );

    if (iter != s_lastExtension)
        element.type = iter->first;
    else
        errIdx(iter - s_extension) << element.name << 
                                            ": invalid extension\n";
}
