1
0
Fork 0
mirror of https://github.com/TheLartians/ModernCppStarter.git synced 2025-08-30 21:51:12 +02:00
ModernCppStarter/source/greeter.cpp

21 lines
529 B
C++

#include <greeter/greeter.h>
#include <fmt/format.h>
using namespace greeter;
Greeter::Greeter(std::string _name) : name(std::move(_name)) {}
std::string Greeter::greet(LanguageCode lang) const {
switch (lang) {
default:
case LanguageCode::EN:
return fmt::format("Hello, {}!", name);
case LanguageCode::DE:
return fmt::format("Hallo {}!", name);
case LanguageCode::ES:
return fmt::format("¡Hola {}!", name);
case LanguageCode::FR:
return fmt::format("Bonjour {}!", name);
}
}