53 lines
1.0 KiB
C++
53 lines
1.0 KiB
C++
#ifndef INTEGRATE_TEXT_SERVICE
|
|
#define INTEGRATE_TEXT_SERVICE
|
|
#include "allocate/factory.h"
|
|
#include "code/return.h"
|
|
#include <string>
|
|
#include <map>
|
|
class text_service_t {
|
|
friend class text_service_factory_t;
|
|
public:
|
|
enum status_t {
|
|
ok,
|
|
error
|
|
};
|
|
enum error_t {
|
|
none,
|
|
unknown
|
|
};
|
|
enum language_t {
|
|
english
|
|
};
|
|
enum text_t {
|
|
window_title
|
|
};
|
|
struct configuration_t {
|
|
language_t language_m;
|
|
};
|
|
return_t<error_t, std::string> get_text(
|
|
text_t text_p
|
|
);
|
|
void_t<error_t> initialize(
|
|
);
|
|
private:
|
|
text_service_t(
|
|
configuration_t* configuration_p
|
|
);
|
|
configuration_t* configuration_m;
|
|
std::map<text_t, std::string> text_to_string;
|
|
void update(
|
|
text_t text_p,
|
|
std::string string_p
|
|
);
|
|
};
|
|
class text_service_factory_t : public factory_t<text_service_t::configuration_t, text_service_t, text_service_t::error_t> {
|
|
public:
|
|
return_t<text_service_t::error_t, text_service_t*> create(
|
|
text_service_t::configuration_t* configuration_p
|
|
);
|
|
void_t<text_service_t::error_t> dispose(
|
|
text_service_t* text_service_p
|
|
);
|
|
};
|
|
#endif
|