bethyw.cpp
/*
  Load the areas.csv file from the directory `dir`. Parse the file and
  create the appropriate Area objects inside the Areas object passed to
  the function in the `areas` argument.

  areas.csv is guaranteed to be formatted as:
    Local authority code,Name (eng),Name (cym)

  Hint: To implement this function. First you will need create an InputFile 
  object with the filename of the areas file, open it, and then pass reference 
  to the stream to the Areas::populate() function.

  Hint 2: you can retrieve the specific filename for a dataset, e.g. for the 
  areas.csv file, from the InputFileSource's FILE member variable

  @param areas
    An Areas instance that should be modified (i.e. the populate() function
    in the instance should be called)

  @param dir
    Directory where the areas.csv file is

  @param areasFilter
    An unordered set of areas to filter, or empty to import all areas

  @return
    void

  @example
    Areas areas();

    BethYw::loadAreas(areas, "data", BethYw::parseAreasArg(args));
*/
Load the areas.csv file from the directory `dir`. Parse the file and
create the appropriate Area objects inside the Areas object passed to
the function in the `areas` argument.

areas.csv is guaranteed to be formatted as:
Local authority code,Name (eng),Name (cym)

To implement this function. First you will need create an InputFile
object with the filename of the areas file, open it, and then pass reference
to the stream to the Areas::populate() function.

Hint 2: you can retrieve the specific filename for a dataset, e.g. for the
areas.csv file, from the InputFileSource's FILE member variable
Load the areas . csv file from the directory ` dir ` . Parse the file and create the appropriate Area objects inside the Areas object passed to the function in the ` areas ` argument . areas . csv is guaranteed to be formatted as : Local authority code Name ( eng ) Name ( cym ) To implement this function . First you will need create an InputFile object with the filename of the areas file open it and then pass reference to the stream to the Areas :: populate () function . Hint 2 : you can retrieve the specific filename for a dataset e . g . for the areas . csv file from the InputFileSource ' s FILE member variable
void BethYw::loadAreas(Areas &areas, std::string dir, std::unordered_set<std::string> areasFilter){
    InputFile areasFile(dir + InputFiles::AREAS.FILE);
    auto fileNameCSV = InputFiles::AREAS.FILE;
    auto cols = InputFiles::AREAS.COLS;
    auto type = InputFiles::AREAS.PARSER;
    try {
        areas.populate(areasFile.open(), type, cols, &areasFilter, nullptr, nullptr);
    }catch(const std::runtime_error& error){
        std::cerr << "Error importing dataset: " << std::endl << error.what();
        exit(0);
    }
}
void BethYw :: loadAreas ( Areas & areas , std :: string dir , std :: unordered_set < std :: string > areasFilter ) { InputFile areasFile ( dir + InputFiles :: AREAS . FILE ) ; auto fileNameCSV = InputFiles :: AREAS . FILE ; auto cols = InputFiles :: AREAS . COLS ; auto type = InputFiles :: AREAS . PARSER ; try { areas . populate ( areasFile . open ( ) , type , cols , & areasFilter , nullptr , nullptr ) ; } catch ( const std :: runtime_error & error ) { std :: cerr << " " << std :: endl << error . what ( ) ; exit ( 0 ) ; } }
Load the areas.csv file from the directory `dir`.
Load the areas . csv file from the directory ` dir ` .