#include "ordertxt.ih"

void OrderTxt::visit(VectConstIterPair const &pair) const
{
    auto hdrIter = pair.second;
    bool sawH = false;
    auto ihIter = pair.second;
    bool sawIH = false;
    bool sawINL = false;

    for (auto iter = pair.first; iter != pair.second; ++iter)
    {
        Element const &element = **iter;
        switch (element.type)               // the type of the read file
        {                                   // (-> types/types.h: Type)

            default:    // for ERR, TXT and SKIP, but these don't
            break;      // occur after Cluster::inspect

            case HDR:
                sawH = inspectHdr(&hdrIter, sawH, iter, pair.second);
            break;

            case IH:
                sawIH = inspectIH(&sawINL, &ihIter, sawIH, hdrIter, 
                                  iter, pair);
            break;

            case INL:
                sawINL = inspectINL(&hdrIter, &ihIter, sawINL, iter,
                                    pair.second);
            break;

            case SRC:
                inspectMain(iter, pair.second);
            break;
        }
    }
}
