area.cpp
/*
  Set a name for the Area in a specific language.

  @param lang
    A three-letter (alphabetical) language code in ISO 639-3 format,
    e.g. cym or eng, which should be converted to lowercase

  @param name
    The name of the Area in `lang`

  @throws
    std::invalid_argument if lang is not a three letter alphabetic code

  @example
    Area area("W06000023");
    std::string langCodeEnglish  = "eng";
    std::string langValueEnglish = "Powys";
    area.setName(langCodeEnglish, langValueEnglish);

    std::string langCodeWelsh  = "cym";
    std::string langValueWelsh = "Powys";
    area.setName(langCodeWelsh, langValueWelsh);
*/
Set a name for the Area in a specific language.
Set a name for the Area in a specific language .
void Area::setName(std::string lang, std::string name){
    if(lang.size() != 3){
        throw std::invalid_argument("Area::setName: Language code must be three alphabetical letters only");
    }
    for(char& c : lang) {
        if(!isalpha(c))
            throw std::invalid_argument("Area::setName: Language code must be three alphabetical letters only");
    }
    this->names.insert( std::pair<std::string, std::string>(BethYw::convertToLower(lang),name));
}
void Area :: setName ( std :: string lang , std :: string name ) { if ( lang . size ( ) != 3 ) { throw std :: invalid_argument ( " " ) ; } for ( char & c : lang ) { if ( ! isalpha ( c ) ) throw std :: invalid_argument ( " " ) ; } this -> names . insert ( std :: pair < std :: string , std :: string > ( BethYw :: convertToLower ( lang ) , name ) ) ; }
Set a name for the Area in a specific language.
Set a name for the Area in a specific language .