Example #1
0
	std::string	Copy( const CComBSTR& bstr )
	{
		CStringA str( bstr );
		std::string strResult( str.GetBuffer( str.GetLength() ) );
		str.ReleaseBuffer();
		return strResult;
	}
Example #2
0
BSTR CDispSimple::Upper(LPCTSTR str)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());

	CString strResult(str);
	strResult.MakeUpper();

	return strResult.AllocSysString();
}
Example #3
0
CString CFileFind::GetFileURL() const
{
	ASSERT(m_hContext != NULL);
	ASSERT_VALID(this);

	CString strResult("file://");
	strResult += GetFilePath();
	return strResult;
}
Example #4
0
// Used to retrieve a value give the section and key
CString CIniReader::getKeyValue(CString strKey,CString strSection)
{
	char ac_Result[255];

	// Get the info from the .ini file	
	m_lRetValue = GetPrivateProfileString((LPCTSTR)strSection,(LPCTSTR)strKey,
		"",ac_Result, 255, (LPCTSTR)m_strFileName);	

	CString strResult(ac_Result);
	return strResult;
}
std::string MathLib::toString(T d)
{
    std::ostringstream result;
    result << d;
    std::string strResult(result.str());
    if (strResult == "-0"
        || strResult == "+0"
        || strResult == "-0."
        || strResult == "+0.")
        return std::string("0");
    return result.str();
}
Example #6
0
/******************************************************************************
Function Name  :  TSX_VerifyResponse
Input(s)       :
Output         :  HRESULT
Functionality  :
Member of      :  CTSExecutionCAN
Friend of      :  -
Author(s)      :  Venkatanarayana Makam
Date Created   :  25/04/2011
Modifications  :
Code Tag       :
******************************************************************************/
HRESULT CTSExecutionCAN::TSX_VerifyResponse(CBaseEntityTA* pEntity, CResultVerify& ouVerifyResult)
{
    m_pCurrentVerify = (CVerifyResponse*)pEntity;
    m_ouVerifyEvent.ResetEvent();
    m_ouVerifyResult = &ouVerifyResult;
    m_MsgVerifiedList.RemoveAll();
    m_nVerifyCount = 0;
    m_ouReadThread.m_unActionCode = INACTION;
    m_bTimeOver = FALSE;
    m_LastCanMsg = (UINT)-1;
    LARGE_INTEGER Tick1;

    QueryPerformanceCounter(&Tick1);
    //Wait For Specified duration
    HRESULT hResult = WaitForSingleObject(m_ouVerifyEvent, m_pCurrentVerify->m_ushDuration);

    m_ouReadThread.m_unActionCode = INVOKE_FUNCTION;

    EnterCriticalSection(&m_omCritSecTS);
    m_bTimeOver = TRUE;
    LeaveCriticalSection(&m_omCritSecTS);

    HRESULT hResultTC;
    if(hResult == WAIT_OBJECT_0)
    {
        CString strResult(_("SUCCESS"));
        TSX_DisplayResult(strResult);
        hResultTC = S_OK;
    }
    else
    {
        //time calculation
        LARGE_INTEGER Tickr;
        UINT64 tr;
        SYSTEMTIME sysTime;
        m_pouDIL_CAN->DILC_GetTimeModeMapping(sysTime, tr, Tickr);
        //UINT64 t2 = m_LastCanMsg;
        CString omStrCount;
        if(m_LastCanMsg != -1)
        {
            omStrCount.Format(_("SUCCESS COUNT %d"), m_MsgVerifiedList.GetCount());
        }
        else
        {
            omStrCount.Format(_("No Message  has Recieved"));
        }
        hResultTC = S_FALSE;
        TSX_DisplayResult(omStrCount);

    }
    return hResultTC;

}
Example #7
0
JNIEXPORT jstring JNICALL Java_testpackage_TestLaunch015_nativeTestMethod
  (JNIEnv *env, jobject pObj, jstring pParameter1)
{
	std::string strResult("FAILURE");

	const char *pszParameter1 = env->GetStringUTFChars(pParameter1,NULL);
	if( strcmp(pszParameter1,"TEST") == 0 )
	{
		strResult = "SUCCESS";
	}

	jstring pJstrResult = env->NewStringUTF(strResult.c_str());
	return pJstrResult;
}
Example #8
0
string MobiBookReader::GetText(const ATOM & _clsStartPos, const string _strSearchText, unsigned int & _uHighLightenStartPos, unsigned int & _uHighLightenEndPos)
{
    if (NULL == m_pBook)
    {
        DebugPrintf(DLC_ZHAIGH, "MobiBookReader::%s() m_pBook is Null", __FUNCTION__);
        return _strSearchText;
    }

    DebugPrintf(DLC_ZHAIGH, "MobiBookReader::%s() Start", __FUNCTION__);

    DK_WCHAR *pSearchText = EncodingUtil::CharToWChar(_strSearchText.c_str());
    if (NULL == pSearchText)
    {
        DebugPrintf(DLC_ZHAIGH, "MobiBookReader::%s() CharToWChar Fail", __FUNCTION__);
        return _strSearchText;
    }

    const DK_WCHAR *pEllipsis          = L"...";
    unsigned int    uSnippetLen        = 90;
    DK_WCHAR        pResultString[200] = {0};
    if(DK_FAILED(m_pBook->GetFindTextSnippet((unsigned int)(_clsStartPos.GetAtomIndex()), 
                                             pSearchText, 
                                             pEllipsis, 
                                             uSnippetLen, 
                                             pResultString, 
                                             &_uHighLightenStartPos, 
                                             &_uHighLightenEndPos)))
    {
        DebugPrintf(DLC_ZHAIGH, "MobiBookReader::%s() GetFindTextSnippet Fail", __FUNCTION__);
        DK_FREE(pSearchText);
        return _strSearchText;
    }

    DK_FREE(pSearchText);

    char *pResult = EncodingUtil::WCharToChar(pResultString);
    if (NULL == pResult)
    {
        DebugPrintf(DLC_ZHAIGH, "MobiBookReader::%s() WCharToChar Fail", __FUNCTION__);
        return _strSearchText;
    }

    string strResult(pResult);
    DK_FREE(pResult);

    DebugPrintf(DLC_ZHAIGH, "MobiBookReader::%s() Finish", __FUNCTION__);
    return strResult;
}
Example #9
0
// ---
WCHAR *CAvpFileFindW::GetFileTitle() const {
	CAPointer<WCHAR> strFullName = GetFileName();
	CPathStrW strResult(_MAX_PATH);

#if defined(_UNICODE)
	_tsplitpath(strFullName, NULL, NULL, strResult, NULL);
#else
	if ( g_bUnicodePlatform )
		_wsplitpath(strFullName, NULL, NULL, strResult, NULL);
	else {
		CAPointer<char> pConverted =::UnicodeToMbcs( strFullName );
		CPathStr strAResult(_MAX_PATH);
		_splitpath(pConverted, NULL, NULL, strAResult, NULL);
		::MbcsToUnicode( strAResult, strResult, _MAX_PATH );
	}
#endif
	
	return strResult.Relinquish();
}
    static inline bool GetSetFolderName(OTSettings & config, const std::string strKeyName,
                                              const std::string strDefaultName, OTString & ret_strName)
    {
        if (ret_strName.Exists()) return true;
        else
        {
            if (strKeyName.empty()    || strDefaultName.empty())    return false;
            if (3 > strKeyName.size() || 3 > strDefaultName.size()) return false;

            OTString strResult("");
            bool bIsNew(false);

            config.CheckSet_str("folders",strKeyName,strDefaultName,strResult,bIsNew);

            if (!bIsNew) ret_strName = strResult;
            else         ret_strName = strDefaultName.c_str();

            return true;
        }
    }
Example #11
0
    static inline bool GetSetValue(OTSettings & config, const std::string strKeyName,
		                                 const int32_t nDefaultValue, const int32_t *& out_nValue)

	{
		if (strKeyName.empty())    return false;
		if (3 > strKeyName.size()) return false;

		OTString strResult("");
		bool bIsNew(false);

		{
			int64_t nValue = 0;
			config.CheckSet_long("crypto",strKeyName,nDefaultValue,nValue,bIsNew);

			if (NULL != out_nValue) { delete out_nValue; out_nValue = NULL; }

			out_nValue = new int32_t(bIsNew ? nDefaultValue : static_cast<int32_t>(nValue));
		}

		return true;
	}
Example #12
0
std::string HMI_Initial::GetUILibPath()
{
    const int iBuffLen = 512;
    char aPathBuff[iBuffLen];
    std::string strResult("");
#if defined(WIN32) || defined(WINCE)
    WCHAR wPathBuff[iBuffLen];
    int iRet = GetModuleFileName(NULL,wPathBuff,iBuffLen);
    //GetCurrentDirectory(iBuffLen,wPathBuff);
    int len = WideCharToMultiByte(CP_ACP,0,wPathBuff,wcslen(wPathBuff),aPathBuff,iBuffLen,NULL,NULL);
    strResult = aPathBuff;
    int pos = strResult.find_last_of('\\',strResult.size()-1);
    strResult.erase(pos,strResult.size()-1);
    strResult += "\\UILib\\";

#elif defined(__ANDROID__)
    getcwd(aPathBuff,iBuffLen);
    strResult = aPathBuff;
    strResult += "/../lib/";
#endif
    return strResult;
}
Example #13
0
CString CFilesHashDlg::ResultFind(CString strFile, CString strHash)
{
	CString strResult(MAINDLG_FIND_IN_RESULT);
	strResult.Append(_T("\r\n"));
	strResult.Append(HASHVALUE_STRING);
	strResult.Append(_T(" "));
	strResult.Append(strHash);
	strResult.Append(_T("\r\n\r\n"));
	strResult.Append(MAINDLG_RESULT);
	strResult.Append(_T("\r\n\r\n"));

	strHash.MakeUpper();
	strFile.MakeLower();

	size_t count = 0;
	CString strPathLower;
	ResultList::iterator itr = m_thrdData.resultList.begin();
	for(; itr != m_thrdData.resultList.end(); ++itr)
	{
		strPathLower = itr->strPath;
		strPathLower.MakeLower();
		if(strPathLower.Find(strFile) >= 0 && 
			(itr->strMD5.Find(strHash) >= 0 ||
			itr->strSHA1.Find(strHash) >= 0 ||
			itr->strSHA256.Find(strHash) >= 0 ||
			itr->strCRC32.Find(strHash) >= 0 ))
		{
			++count;

			AppendResult(*itr, strResult);
		}
	}

	if(count == 0)
		strResult.Append(MAINDLG_NORESULT);

	return strResult;
}
Example #14
0
 QString CQTOpenGLMainWindow::GetCameraXMLData() {
    QString strResult("<camera>\n");
    /* Get a reference to the camera */
    CQTOpenGLCamera& cCamera = m_pcOpenGLWidget->GetCamera();
    for(UInt32 i = 0; i < 12; ++i) {
       /* Get its position and target */
       const CQTOpenGLCamera::SSettings& sSettings = cCamera.GetSetting(i);
       const CVector3& cPos = sSettings.Position;
       const CVector3& cLookAt = sSettings.Target;
       strResult.append(
          QString("   <placement idx=\"%1\" position=\"%2,%3,%4\" look_at=\"%5,%6,%7\" lens_focal_length=\"%8\" />\n")
          .arg(i)
          .arg(cPos.GetX())
          .arg(cPos.GetY())
          .arg(cPos.GetZ())
          .arg(cLookAt.GetX())
          .arg(cLookAt.GetY())
          .arg(cLookAt.GetZ())
          .arg(sSettings.LensFocalLength * 1000.0f));
    }
    strResult.append("</camera>\n");
    return strResult;
 }
Example #15
0
// ---
WCHAR *CAvpFileFindW::GetFileURL() const {
	CPathStrW strResult( L"file://" );
	strResult += CAPointer<WCHAR>(GetFilePath());
	return strResult.Relinquish();
}
CString CInsertGraphicDialog::GetProperties()
{
	///////////////////////////////////////////////////////////////////
	// statics
	CString strResult(_T("\\includegraphics"));

	///////////////////////////////////////////////////////////////////
	// is scaled?
	if (m_bScale && ((m_unScale != 100) || (m_bScaleToText)))
	{
		CString strScale;
		if (m_bScaleToText)
		{
			//Scale to \textwidth
			strScale.Format(_T("[width=%.2f\\textwidth]"),m_unScale / 100.0);
		}
		else
		{
			//Normal Scale
			strScale.Format(_T("[scale=%.2f]"),m_unScale / 100.0);
		}

		strScale.Replace(_T(','),_T('.'));
		strResult += strScale;
	}

	///////////////////////////////////////////////////////////////////
	// statics
	strResult += _T('{');
	strResult += m_strFile;
	strResult += _T("}\r");

	///////////////////////////////////////////////////////////////////
	// is centered?
	if (m_bHCenter)
	{
		if (m_bFloat)
			strResult = _T("\\centering\r\t\t") + strResult;
		else
			strResult = _T("\\begin{center}\r\t") + strResult + _T("\\end{center}");
	}

	///////////////////////////////////////////////////////////////////
	// is floating?
	if (m_bFloat)
	{
		CString strPreResult = strResult;
		strResult = CInsertFloatObjectDialog::GetProperties();

		int nPos = strResult.Find(_T('\001'));
		strResult.Delete(nPos);
		strResult.Insert(nPos,strPreResult);
	}
	else
		strResult.Insert(0,_T('\r'));


	///////////////////////////////////////////////////////////////////
	// Empty Lines?
	strResult.Replace(_T("\r\r"),_T("\r"));

	return strResult;
}
Example #17
0
bool wxLuaDebugTarget::EvaluateExpr(int exprRef, const wxString &strExpr) // FIXME - check this code
{
    wxString strResult(wxT("Error"));
    int      nReference = LUA_NOREF;

    EnterLuaCriticalSection();
    {
        lua_State* L = m_wxlState.GetLuaState();

        if (wxStrpbrk(strExpr.c_str(), wxT(" ~=<>+-*/%(){}[]:;,.\"'")) != NULL)
        {
            // an expression
            int nOldTop = lua_gettop(L);

            wxLuaCharBuffer charbuf(strExpr);
            int nResult = luaL_loadbuffer(L, charbuf.GetData(), charbuf.Length(), "debug");

            if (nResult == 0)
                nResult = lua_pcall(L, 0, LUA_MULTRET, 0);  // call main

            if (nResult != 0)
                wxlua_pushwxString(L, wxlua_LUA_ERR_msg(nResult));

            else if (lua_gettop(L) == nOldTop)
                lua_pushliteral(L, "OK");

            nReference = m_wxlState.wxluaR_Ref(-1, &wxlua_lreg_refs_key);
            lua_settop(L, nOldTop); // throw out all return values
        }
        else
        {
             lua_Debug ar = INIT_LUA_DEBUG;
             int       iLevel = 0;
             bool      fFound = false;

             while (lua_getstack(L, iLevel++, &ar) != 0)
             {
                int       iIndex = 0;
                wxString name = lua2wx(lua_getlocal(L, &ar, ++iIndex));
                if (!name.IsEmpty())
                {
                    if (strExpr == name)
                    {
                        nReference = m_wxlState.wxluaR_Ref(-1, &wxlua_lreg_refs_key);
                        fFound = true;
                        break;
                    }

                    lua_pop(L, 1);
                }

                if (fFound)
                    break;

                name = lua2wx(lua_getlocal(L, &ar, ++iIndex));
             }

             if (!fFound)
             {
                  int nOldTop = lua_gettop(L);
                  lua_pushvalue(L, LUA_GLOBALSINDEX);
                  lua_pushnil(L);
                  while (lua_next(L, -2) != 0)
                  {
                      if (lua_type(L, -2) == LUA_TSTRING)
                      {
                          wxString name = lua2wx(lua_tostring(L, -2));
                          if (strExpr == name)
                          {
                              nReference = m_wxlState.wxluaR_Ref(-1, &wxlua_lreg_refs_key); // reference value
                              lua_pop(L, 2);    // pop key and value
                              fFound = true;
                              break;
                          }
                      }

                      lua_pop(L, 1);  // removes 'value';
                  }
                  lua_settop(L, nOldTop); // the table of globals.
             }
        }

        if (m_wxlState.wxluaR_GetRef(nReference, &wxlua_lreg_refs_key))
        {
            m_wxlState.wxluaR_Unref(nReference, &wxlua_lreg_refs_key);

            int wxl_type = 0;
            wxString value;
            wxLuaDebugData::GetTypeValue(L, -1, &wxl_type, value);

            strResult.Printf(wxT("%s : %s"), wxluaT_typename(L, wxl_type).c_str(), value.c_str());

            lua_pop(L, 1);
        }
    }
    LeaveLuaCriticalSection();

    return NotifyEvaluateExpr(exprRef, strResult);
}
Example #18
0
// ---
WCHAR *CAvpFileFindW::GetFilePath() const {
	CPathStrW strResult( m_strRoot );
	strResult ^= CAPointer<WCHAR>(GetFileName());
	return strResult.Relinquish();
}
Example #19
0
BSTR Com3DSSPP::Hello()
{
    CString strResult( "Hello there." );
    return strResult.AllocSysString();
}