21 lines
409 B
C++
21 lines
409 B
C++
|
#include "shops.hpp"
|
||
|
#include <stdexcept>
|
||
|
|
||
|
namespace oro {
|
||
|
|
||
|
ShopTypeWrapper::ShopTypeWrapper (const std::string& str) {
|
||
|
*this = str;
|
||
|
}
|
||
|
|
||
|
ShopTypeWrapper& ShopTypeWrapper::operator= (const std::string& str) {
|
||
|
if ("V" == str)
|
||
|
value = ShopType::Vending;
|
||
|
else if ("B" == str)
|
||
|
value = ShopType::Buying;
|
||
|
else
|
||
|
throw std::runtime_error("Unknown shop type '" + str + "'");
|
||
|
return *this;
|
||
|
}
|
||
|
|
||
|
} //namespace oro
|