61 lines
1.6 KiB
C++
61 lines
1.6 KiB
C++
#include "inform/text_service.h"
|
|
#include "code/return.h"
|
|
#include <string>
|
|
|
|
text_service_t::text_service_t(
|
|
text_service_t::configuration_t* configuration_p
|
|
) {
|
|
configuration_m = configuration_p;
|
|
}
|
|
|
|
void text_service_t::update(
|
|
text_service_t::text_t text_p,
|
|
std::string string_p
|
|
) {
|
|
text_to_string[text_p] = string_p;
|
|
}
|
|
|
|
void_t<text_service_t::error_t> text_service_t::initialize(
|
|
) {
|
|
text_service_t::language_t language_l = configuration_m->language_m;
|
|
switch (language_l) {
|
|
case text_service_t::language_t::english:
|
|
update(text_service_t::text_t::window_title, "Fortuitous Frogs");
|
|
break;
|
|
}
|
|
void_t<text_service_t::error_t> void_l;
|
|
void_l.error_m = text_service_t::error_t::none;
|
|
return void_l;
|
|
}
|
|
|
|
return_t<text_service_t::error_t, std::string> text_service_t::get_text(
|
|
text_service_t::text_t text_p
|
|
) {
|
|
std::string string_l = text_to_string[text_p];
|
|
return_t<text_service_t::error_t, std::string> return_l;
|
|
return_l.error_m = text_service_t::error_t::none;
|
|
return_l.value_m = string_l;
|
|
return return_l;
|
|
}
|
|
|
|
return_t<text_service_t::error_t, text_service_t*> text_service_factory_t::create(
|
|
text_service_t::configuration_t* configuration_p
|
|
) {
|
|
text_service_t* text_service_l = new text_service_t(
|
|
configuration_p
|
|
);
|
|
return_t<text_service_t::error_t, text_service_t*> return_l;
|
|
return_l.error_m = text_service_t::error_t::none;
|
|
return_l.value_m = text_service_l;
|
|
return return_l;
|
|
}
|
|
|
|
void_t<text_service_t::error_t> text_service_factory_t::dispose(
|
|
text_service_t* text_service_p
|
|
) {
|
|
delete text_service_p;
|
|
void_t<text_service_t::error_t> void_l;
|
|
void_l.error_m = text_service_t::error_t::none;
|
|
return void_l;
|
|
}
|