Covellite++  Version: 2.3.0 Revision: ??? Platform: x64 Build: 23:13 04.01.2025
Кроссплатформенный фреймворк для разработки приложений на С++
Загрузка...
Поиск...
Не найдено
Log.hpp
1
2#pragma once
3#include <cstdarg>
4
5namespace mock
6{
7
8class AndroidLogProxy :
9 public ::alicorn::extension::testing::Proxy<AndroidLogProxy>
10{
11public:
12 MOCK_METHOD3(Print, int(int, ::std::string, ::std::string));
13 MOCK_METHOD1(Arg, void(::std::string));
14};
15
16} // namespace mock
17
18# pragma warning(push)
19# pragma warning(disable: 4505)
20
21static int __android_log_print(int _Priority, ::std::string _Name,
22 const char * _Format, va_list _Args)
23{
24 const auto Result =
25 ::mock::AndroidLogProxy::GetInstance()->Print(_Priority, _Name, _Format);
26
27 size_t Index = 0;
28 size_t Offset = 0;
29
30 while (true)
31 {
32 const auto ArgPosition = ::std::string{ _Format }.find('%', Offset);
33 if (ArgPosition == ::std::string::npos) break;
34
35 auto * Arg = va_arg(_Args, const char *);
36 ::mock::AndroidLogProxy::GetInstance()->Arg(Arg);
37
38 Offset = ArgPosition + 1;
39 Index++;
40 }
41
42 return Result;
43}
44
45#pragma warning(pop)
46
47enum android_LogPriority
48{
49 ANDROID_LOG_ERROR = 1710151250,
50 ANDROID_LOG_INFO = 1710151251,
51};