#include "arg.ih"

    // when called *d_arg points at a long option
    //
    // if it's not in d_longMap return false with NO_LONG_OPTION
    // 
    // * if it has a char equivalent, replace the option and an appending =
    //                              by the equivalen char option and
    //                              reduce d_arg, so that option is
    //                              handled -> true -> continue
    // if it has no value then store the option in the long-option map
    //      with an empty value element -> true -> continue
    // if it has a value then
    //      if there is an appending '=': 
    //              if there is an appending value store the value in the
    //                              map -> true
    //              else set NO_ARGUMENT and return false
    //      else use the next argument: 
    //          if the's no next argument set NO_ARGUMENT and return false
    //          else store the next argument as value, shift, 
    //                                                 and return true

    
bool Arg__::longOption()
{
        // if d_option is not in d_longMap return false with NO_LONG_OPTION

    LongMapIter iter = d_longMap.find(d_option);

    if (iter == d_longMap.end())
    {
        d_optionType = NO_LONG_OPTION;
        return false;
    }

    d_nextChar = charOf(iter);
    return (this->*s_longHandler[typeOf(iter)])();
}
