/*
 * This file is part of the Owl Positioning System (OwlPS) project.
 * It is subject to the copyright notice and license terms in the
 * COPYRIGHT.t2t file found in the top-level directory of this
 * distribution and at
 *   https://code.lm7.fr/mcy/owlps/src/master/COPYRIGHT.t2t
 * No part of the OwlPS Project, including this file, may be copied,
 * modified, propagated, or distributed except according to the terms
 * contained in the COPYRIGHT.t2t file; the COPYRIGHT.t2t file must be
 * distributed along with this file, either separately or by replacing
 * this notice by the COPYRIGHT.t2t file's contents.
 */


#include "csvfilereader.hh"
#include "point3d.hh"

#include <iostream>

using namespace std ;



/* *** Operations *** */


/**
 * Note that this function is not called by the constructor, so you
 * must manually call it prior to use read_field().
 * @returns `false` in case of error (EOF, etc.), `true` else.
 */
bool CSVFileReader::next_line()
{
  if (! read_nonblank_line(current_line))
    return false ;

  set_str(current_line) ;

  return true ;
}


void CSVFileReader::print_error_cast() const
{
  cerr
      << "Bad value \""
      << *token_iterator << "\" at line "
      << current_line_nb << ", field #"
      << current_field_nb << ", of input file \""
      << file_name << "\"!" << endl ;
}
