本文整理汇总了C++中GetPlatform函数的典型用法代码示例。如果您正苦于以下问题:C++ GetPlatform函数的具体用法?C++ GetPlatform怎么用?C++ GetPlatform使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetPlatform函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: work
// This will return as soon as a message is posted
S32 work(Thread::MessageQueue& messageQueue)
{
U32 start = GetPlatform()->getRealMilliseconds();
Thread::MessageRef msg;
messageQueue.waitOnMessageToThread(msg, true);
return GetPlatform()->getRealMilliseconds() - start;
}
示例2: LogMessageFile
void LogMessageFile(my::LogLevel level, my::SrcPoint const & srcPoint, string const & msg)
{
static mutex mtx;
static unique_ptr<FileWriter> file;
string recordType;
switch (level)
{
case LINFO: recordType.assign("INFO "); break;
case LDEBUG: recordType.assign("DEBUG "); break;
case LWARNING: recordType.assign("WARN "); break;
case LERROR: recordType.assign("ERROR "); break;
case LCRITICAL: recordType.assign("FATAL "); break;
}
lock_guard<mutex> lock(mtx);
if (file == nullptr)
{
if (GetPlatform().WritableDir().empty())
return;
tm * curTimeTM = GetLocalTime();
stringstream fileName;
fileName << "logging_" << curTimeTM->tm_year + 1900 << "_" << curTimeTM->tm_mon + 1 << "_" << curTimeTM->tm_mday << "_"
<< curTimeTM->tm_hour << "_" << curTimeTM->tm_min << "_" << curTimeTM->tm_sec << ".log";
file.reset(new FileWriter(GetPlatform().WritablePathForFile(fileName.str())));
}
string srcString = recordType + DebugPrint(srcPoint) + " " + msg + "\n";
file->Write(srcString.c_str(), srcString.size());
file->Flush();
}
示例3: rect
Rect HierarchyTreeScreenNode::GetRect() const
{
Rect rect(0, 0, GetPlatform()->GetWidth(), GetPlatform()->GetHeight());
CombineRectWithChild(rect);
return rect;
}
示例4: TEST
TEST(Thread, DeleteTermination)
{
AutoPtr<Thread> t(new Thread(MakeDelegate(&work)));
U32 time = GetPlatform()->getRealMilliseconds();
t->start();
t = NULL;
time = GetPlatform()->getRealMilliseconds() - time;
//, "Thread deletion did not immediately terminate the thread");
EXPECT_TRUE(time < 1000);
}
示例5: m_writableDirBeforeTest
WritableDirChanger::WritableDirChanger(string const & testDir)
: m_writableDirBeforeTest(GetPlatform().WritableDir())
, m_testDirFullPath(m_writableDirBeforeTest + testDir)
{
Platform & platform = GetPlatform();
platform.RmDirRecursively(m_testDirFullPath);
TEST(!platform.IsFileExistsByFullPath(m_testDirFullPath), ());
TEST_EQUAL(Platform::ERR_OK, platform.MkDir(m_testDirFullPath), ());
platform.SetWritableDirForTests(m_testDirFullPath);
settings::Clear();
}
示例6: main
int main(int argc, char * argv[])
{
// Our double parsing code (base/string_utils.hpp) needs dots as a floating point delimiters, not commas.
// TODO: Refactor our doubles parsing code to use locale-independent delimiters.
// For example, https://github.com/google/double-conversion can be used.
// See http://dbaron.org/log/20121222-locale for more details.
(void)::setenv("LC_NUMERIC", "C", 1);
InitializeFinalize mainGuard;
UNUSED_VALUE(mainGuard);
QApplication a(argc, argv);
#ifdef DEBUG
alohalytics::Stats::Instance().SetDebugMode(true);
#endif
GetPlatform().SetupMeasurementSystem();
// display EULA if needed
char const * settingsEULA = "EulaAccepted";
bool eulaAccepted = false;
if (!Settings::Get(settingsEULA, eulaAccepted) || !eulaAccepted)
{
QStringList buttons;
buttons << "Accept" << "Decline";
string buffer;
{
ReaderPtr<Reader> reader = GetPlatform().GetReader("eula.html");
reader.ReadAsString(buffer);
}
qt::InfoDialog eulaDialog("MAPS.ME End User Licensing Agreement", buffer.c_str(), NULL, buttons);
eulaAccepted = (eulaDialog.exec() == 1);
Settings::Set(settingsEULA, eulaAccepted);
}
int returnCode = -1;
if (eulaAccepted) // User has accepted EULA
{
qt::MainWindow w;
w.show();
returnCode = a.exec();
}
dbg::ObjectTracker::PrintLeaks();
LOG_SHORT(LINFO, ("MapsWithMe finished with code", returnCode));
return returnCode;
}
示例7: Name
const wxString wxProcessKiller::Name(int pid)
{
wxString str;
str.Printf(_T("id=%d"),pid);
#ifdef _DEBUG
#ifdef _WIN32
if(VER_PLATFORM_WIN32_NT==GetPlatform() && hInstLib1){
static BOOL (WINAPI *lpfEnumProcessModules)( HANDLE, HMODULE *, DWORD, LPDWORD ) =
(BOOL(WINAPI *)(HANDLE, HMODULE *, DWORD, LPDWORD)) GetProcAddress( (HINSTANCE) hInstLib1,"EnumProcessModules" ) ;
static DWORD (WINAPI *lpfGetModuleFileNameEx)( HANDLE, HMODULE, LPTSTR, DWORD )=
(DWORD (WINAPI *)(HANDLE, HMODULE,LPTSTR, DWORD )) GetProcAddress( (HINSTANCE) hInstLib1,"GetModuleFileNameExA" ) ;
if( lpfEnumProcessModules && lpfGetModuleFileNameEx ) {
HANDLE hProcess=::OpenProcess(PROCESS_ALL_ACCESS,false,pid);
if(hProcess) {
HMODULE hMod;
DWORD dwSize;
if(lpfEnumProcessModules( hProcess, &hMod, sizeof(HMODULE), &dwSize ) ){
// Get Full pathname:
TCHAR buf[1+MAX_PATH];
lpfGetModuleFileNameEx( hProcess, hMod, buf, MAX_PATH);
str+=_TCHAR(' ');
str+=buf;
}
CloseHandle(hProcess);
}
}
}
#endif
#endif
return str;
}
示例8: m_platform
TestSearchEngine::TestSearchEngine(unique_ptr<::search::SearchQueryFactory> factory,
Engine::Params const & params)
: m_platform(GetPlatform())
, m_infoGetter(storage::CountryInfoReader::CreateCountryInfoReader(m_platform))
, m_engine(*this, GetDefaultCategories(), *m_infoGetter, move(factory), params)
{
}
示例9: m_platform
TestSearchEngine::TestSearchEngine(std::string const & locale)
: m_platform(GetPlatform()),
m_engine(this, m_platform.GetReader(SEARCH_CATEGORIES_FILE_NAME),
m_platform.GetReader(PACKED_POLYGONS_FILE), m_platform.GetReader(COUNTRIES_FILE),
locale, make_unique<TestSearchQueryFactory>())
{
}
示例10: Load
void Load()
{
LOG(LDEBUG, ("Reading of classificator started"));
Platform & p = GetPlatform();
MapStyle const originMapStyle = GetStyleReader().GetCurrentStyle();
for (size_t i = 0; i < MapStyleCount; ++i)
{
MapStyle const mapStyle = static_cast<MapStyle>(i);
// Read the merged style only if it was requested.
if (mapStyle != MapStyleMerged || originMapStyle == MapStyleMerged)
{
GetStyleReader().SetCurrentStyle(mapStyle);
ReadCommon(p.GetReader("classificator.txt"),
p.GetReader("types.txt"));
drule::LoadRules();
}
}
GetStyleReader().SetCurrentStyle(originMapStyle);
LOG(LDEBUG, ("Reading of classificator finished"));
}
示例11: primaryRC
void Framework::InitRenderPolicy(bool needApiPin, m2::PointD const & apiPinPoint,
bool needMyLoc, m2::PointD const & myLocPoint)
{
shared_ptr<RenderContext> primaryRC(new RenderContext());
graphics::ResourceManager::Params rmParams;
rmParams.m_texFormat = graphics::Data4Bpp;
rmParams.m_texRtFormat = graphics::Data4Bpp;
rmParams.m_videoMemoryLimit = GetPlatform().VideoMemoryLimit();
RenderPolicy::Params rpParams;
rpParams.m_videoTimer = &m_timer;
rpParams.m_useDefaultFB = true;
rpParams.m_rmParams = rmParams;
rpParams.m_primaryRC = primaryRC;
rpParams.m_density = graphics::EDensityMDPI;
rpParams.m_skinName = "basic.skn";
rpParams.m_screenWidth = m_width;
rpParams.m_screenHeight = m_height;
YopmeRP * rp = new YopmeRP(rpParams);
m_framework.SetRenderPolicy(rp);
m_framework.InitGuiSubsystem();
rp->SetDrawingApiPin(needApiPin, m_framework.GtoP(apiPinPoint));
rp->SetDrawingMyLocation(needMyLoc, m_framework.GtoP(myLocPoint));
}
示例12: Java_com_mapswithme_maps_uber_Uber_nativeRequestUberProducts
JNIEXPORT void JNICALL Java_com_mapswithme_maps_uber_Uber_nativeRequestUberProducts(
JNIEnv * env, jclass clazz, jdouble srcLat, jdouble srcLon, jdouble dstLat, jdouble dstLon)
{
PrepareClassRefs(env);
ms::LatLon const from(srcLat, srcLon);
ms::LatLon const to(dstLat, dstLon);
g_lastRequestId = g_framework->RequestUberProducts(
from, to, [](vector<uber::Product> const & products, uint64_t const requestId) {
GetPlatform().RunOnGuiThread([=]() {
if (g_lastRequestId != requestId)
return;
JNIEnv * env = jni::GetEnv();
auto uberProducts = jni::ToJavaArray(
env, g_productClass, products, [](JNIEnv * env, uber::Product const & item) {
return env->NewObject(
g_productClass, g_productConstructor, jni::ToJavaString(env, item.m_productId),
jni::ToJavaString(env, item.m_name), jni::ToJavaString(env, item.m_time),
jni::ToJavaString(env, item.m_price));
});
jobject const routingControllerInstance =
env->CallStaticObjectMethod(g_routingControllerClass, g_routingControllerGetMethod);
env->CallVoidMethod(routingControllerInstance, g_uberInfoCallbackMethod,
env->NewObject(g_uberInfoClass, g_uberInfoConstructor, uberProducts));
});
});
}
示例13: watch
S32 watch(Thread::MessageQueue& messageQueue)
{
worker = new Thread(MakeDelegate(&work));
worker->start();
while(worker->isRunning())
GetPlatform()->sleep(1);
return 0;
}
示例14: OpenRecord
GMPErr
OpenRecord(const char* aName,
uint32_t aNameLength,
GMPRecord** aOutRecord,
GMPRecordClient* aClient)
{
return GetPlatform()->createrecord(aName, aNameLength, aOutRecord, aClient);
}
示例15: GetPlatform
WritableDirChanger::~WritableDirChanger()
{
settings::Clear();
Platform & platform = GetPlatform();
string const writableDirForTest = platform.WritableDir();
platform.SetWritableDirForTests(m_writableDirBeforeTest);
platform.RmDirRecursively(writableDirForTest);
}