예제 #1
0
파일: History.cpp 프로젝트: rrps/calculator
void CHistoryCollector::ClearHistoryLine(wstring_view errStr)
{
    if (errStr.empty()) // in case of error let the display stay as it is
    {
        if (nullptr != m_pCalcDisplay)
        {
            m_pCalcDisplay->SetExpressionDisplay(std::make_shared<CalculatorVector<std::pair<std::wstring, int>>>(), std::make_shared<CalculatorVector<std::shared_ptr<IExpressionCommand>>>());
        }
        m_iCurLineHistStart = -1; // It will get recomputed at the first Opnd
        ReinitHistory();
    }
}
예제 #2
0
	std::string wchar_utf8(wstring_view wide, error_code& ec)
	{
		// allocate space for worst-case
		std::string utf8;
		utf8.resize(wide.size() * 6);
		if (wide.empty()) return {};

		wchar_t const* src_start = wide.data();
		utf8_errors::error_code_enum const ret = convert_from_wide<sizeof(wchar_t)>::convert(
			&src_start, src_start + wide.size(), utf8);
		if (ret != utf8_errors::error_code_enum::conversion_ok)
			ec = make_error_code(ret);
		return utf8;
	}