//-------------------------------------------------------------------------- void VeLog::Output(Type eType, const VeChar8* pcTag, const VeChar8* pcContent) noexcept { if (m_funcTarget) { # ifdef VE_RELEASE if (VeUInt32(eType) < VeUInt32(m_eLevel)) return; # endif m_funcTarget(eType, pcTag, pcContent); } }
//-------------------------------------------------------------------------- VeParallel::VeParallel() noexcept { m_stThreadNum = VeCPUInfo::GetCount(); m_pkLoopEventArray = VeAlloc(VeThread::Event, m_stThreadNum); for (VeSizeT i(0); i < m_stThreadNum; ++i) { new(m_pkLoopEventArray + i)VeThread::Event(); } m_pkThreadArray = VeAlloc(std::thread, m_stThreadNum); for (VeSizeT i(0); i < m_stThreadNum; ++i) { new(m_pkThreadArray + i)std::thread([this,i]() noexcept { do { m_pkLoopEventArray[i].Wait(); if (m_kTask) { m_kTask(VeUInt32(i)); } m_pkLoopEventArray[i].Reset(); m_kEvent.Set(); } while (m_bLoop); }); } }
//-------------------------------------------------------------------------- void VeParallel::Do(std::function<void(VeUInt32)> funcTask) noexcept { m_kTask = funcTask; m_kEvent.Reset(VeUInt32(m_stThreadNum)); for (VeSizeT i(0); i < m_stThreadNum; ++i) { m_pkLoopEventArray[i].Set(); } m_kEvent.Wait(); m_kTask = nullptr; }
//-------------------------------------------------------------------------- bool VeWindows::IMEHandleMessage(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM& lParam) { bool bRes(false); switch(uMessage) { case WM_INPUTLANGCHANGE: break; case WM_IME_SETCONTEXT: //lParam = 0; break; case WM_IME_COMPOSITION: { HIMC hImc = ImmGetContext(hWnd); if(hImc) { LONG lRet; VeChar16 szCompStr[VE_UINT8_MAX]; if(lParam & GCS_RESULTSTR) { lRet = ImmGetCompositionStringW(hImc, GCS_RESULTSTR, szCompStr, VE_UINT8_MAX) / sizeof(VeChar16); szCompStr[lRet] = 0; m_kInputMethodEvent.Callback(szCompStr, VeUInt32(lRet)); bRes = true; } ImmReleaseContext(hWnd, hImc); } } break; case WM_CHAR: { VeChar16 acChar[2] = { (VeChar16)wParam, L'\0' }; m_kInputMethodEvent.Callback(acChar, 1); bRes = true; } break; default: break; } return bRes; }