Covellite++  Version: 2.3.0 Revision: ??? Platform: x64 Build: 23:13 04.01.2025
Кроссплатформенный фреймворк для разработки приложений на С++
Загрузка...
Поиск...
Не найдено
System.cpp
1
2#include "stdafx.h"
3#include <Covellite\Gui\System.hpp>
4#ifndef __USING_GTEST
5#include <alicorn\logger.hpp>
6#endif
7
8namespace covellite
9{
10
11namespace gui
12{
13
14System::System(const StringTranslatorPtr_t & _pStringTranslator) :
15 m_pStringTranslator(_pStringTranslator)
16{
17 if (_pStringTranslator == nullptr)
18 {
19 throw STD_EXCEPTION << "String translator null pointer.";
20 }
21}
22
27int System::TranslateString(String_t & _Translated,
28 const String_t & _Source) /*override*/
29{
30 _Translated = m_pStringTranslator->Translate(CovelliteGuiStringToUtf8(_Source)).c_str();
31 return 0;
32}
33
39bool System::LogMessage(CovelliteGui::Log::Type _Type,
40 const String_t & _Message) /*override*/
41{
42 if (_Type == CovelliteGui::Log::LT_ERROR)
43 {
44 LOGGER(Error) << CovelliteGuiStringToUtf8(_Message);
45 }
46 else if (_Type == CovelliteGui::Log::LT_WARNING)
47 {
48 LOGGER(Warning) << CovelliteGuiStringToUtf8(_Message);
49 }
50 else if (_Type == CovelliteGui::Log::LT_INFO)
51 {
52 LOGGER(Info) << CovelliteGuiStringToUtf8(_Message);
53 }
54 else if (_Type == CovelliteGui::Log::LT_ASSERT ||
55 _Type == CovelliteGui::Log::LT_ALWAYS)
56 {
57 LOGGER(Trace) << CovelliteGuiStringToUtf8(_Message);
58 }
59 else if (_Type == CovelliteGui::Log::LT_DEBUG)
60 {
61 LOGGER_DEBUG(Trace) << CovelliteGuiStringToUtf8(_Message);
62 }
63
64 return true;
65}
66
67} // namespace gui
68
69} // namespace covallite