void CProfileReader::LoadRouteInfo() { m_ptList.clear(); m_AntiPtList.clear(); char szKey[10] = ""; char szTemp[100] = ""; int nPtNum = GetPrivateProfileInt("GENERAL","ClockPointNum", 0, m_szRoadFile); int i; for (i = 0; i < nPtNum; i++) { D3DXVECTOR3 vPos; sprintf(szKey, "pt_%d", i+1); GetPrivateProfileString("CLOCK_POINTS", szKey, TEXT("(0,0,0)"), szTemp, sizeof(szTemp), m_szRoadFile); StringToVector(szTemp, &vPos); m_ptList.insert(m_ptList.end(), vPos); } nPtNum = GetPrivateProfileInt("GENERAL","AntiClockPointNum", 0, m_szRoadFile); for (i = 0; i < nPtNum; i++) { D3DXVECTOR3 vPos; sprintf(szKey, "pt_%d", i+1); GetPrivateProfileString("ANTI_CLOCK_POINTS", szKey, TEXT("(0,0,0)"), szTemp, sizeof(szTemp), m_szRoadFile); StringToVector(szTemp, &vPos); m_AntiPtList.insert(m_AntiPtList.end(), vPos); } PtList::iterator iPt; int j = 0; for (iPt=m_ptList.begin(); iPt!=m_ptList.end(); ++iPt ) { route_node node; node.pPos = &(*iPt); node.mode2Next = (j%2 == 0)?linear_mode:curve_mode; m_ClockRouteList.AppendNode(node); j++; } j = 0; for (iPt=m_AntiPtList.begin(); iPt!=m_AntiPtList.end(); ++iPt ) { route_node node; node.pPos = &(*iPt); node.mode2Next = (j%2 == 0)?linear_mode:curve_mode; m_AntiClkRouteList.AppendNode(node); j++; } }
void StringToCurve::UpdateCurve() { // Remove any existing curves while ( !m_OutCurveList->getCurveList().empty() ) { delete m_OutCurveList->getCurveList().back(); m_OutCurveList->getCurveList().pop_back(); } std::string dataString = f_CurveString->getStringValue(); dataString.append( f_CurveSeparator->getStringValue() ); std::string indexString = f_IndexString->getStringValue(); std::vector< float > indexValues; if (indexString.length() != 0 ){ StringToVector(indexString, indexValues ); } if ( dataString.length() > 0 ){ // Split string into curves std::vector<std::string> curves; boost::split(curves, dataString, boost::is_any_of(f_CurveSeparator->getStringValue() )); // Iterate over curves std::vector<std::string>::iterator stringIt = curves.begin(); for (;stringIt < curves.end(); ++stringIt ){ std::string curCurve = *stringIt; if (curCurve.length() == 0) {continue;} // Remove leading and trailing spaces boost::trim( curCurve ); std::vector< MLfloat > curveValues; StringToVector( curCurve, curveValues ); CurveData *outputCurve = new CurveData; outputCurve->setY( curveValues.size(),&curveValues[0], 1 ); if ( f_IndexString->getStringValue().length() != 0 ){ outputCurve->setX( indexValues.size(),&indexValues[0], 1 ); } m_OutCurveList->getCurveList().push_back( outputCurve ); } } }
int32 StringToValue<CGUIVector2>( const CGUIString& rString, CGUIVector2& rValue) { //string should have format as "x,y" std::vector<CGUIString> aListString= StringToVector(rString); if( aListString.size() != 2 ) { GUI_THROW( GUI_FORMAT( "[StringToValue[StringToValue]]: string value format is wrong! <%s>", rString.c_str())); return -1; } StringToValue(aListString[0], rValue.x); StringToValue(aListString[1], rValue.y); return 0; }
int32 StringToValue<CGUIIntSize>( const CGUIString& rString, CGUIIntSize& rValue) { //string should have format as "width,height" std::vector<CGUIString> aListString= StringToVector(rString); if( aListString.size() != 2 ) { GUI_THROW( GUI_FORMAT( "[StringToValue[CGUIIntSize]]: string value format is wrong! <%s>", rString.c_str())); return -1; } StringToValue( aListString[0], rValue.m_uWidth ); StringToValue( aListString[1], rValue.m_uHeight ); return 0; }
int32 StringToValue<CGUIRotator>( const CGUIString& rString, CGUIRotator& rValue) { //string should have format as "pitch,yaw,roll" std::vector<CGUIString> aListString= StringToVector(rString); if( aListString.size() != 3 ) { GUI_THROW( GUI_FORMAT( "[StringToValue[StringToValue]]: string value format is wrong! <%s>", rString.c_str())); return -1; } StringToValue(aListString[0], rValue.Pitch); StringToValue(aListString[1], rValue.Yaw); StringToValue(aListString[2], rValue.Roll); return 0; }
int32 StringToValue<CGUIRect>( const CGUIString& rString, CGUIRect& rValue) { //string should have format as "left, top, right,bottom" std::vector<CGUIString> aListString= StringToVector(rString); if( aListString.size() != 4 ) { GUI_THROW( GUI_FORMAT( "[StringToValue[CGUIRect]]: string value format is wrong! <%s>", rString.c_str())); return -1; } StringToValue( aListString[0], rValue.m_fLeft ); StringToValue( aListString[1], rValue.m_fTop ); StringToValue( aListString[2], rValue.m_fRight ); StringToValue( aListString[3], rValue.m_fBottom ); return 0; }
int32 StringToValue<CGUIColor>( const CGUIString& rString, CGUIColor& rValue) { //string should have format as "r,g,b,a" std::vector<CGUIString> aListString= StringToVector(rString); if( aListString.size() != 4 ) { GUI_THROW( GUI_FORMAT( "[StringToValue[CGUIColor]]: string value format is wrong! <%s>", rString.c_str())); return -1; } uint8 nColor; StringToValue(aListString[0], nColor ); rValue.SetRed( nColor / 255.0f ); StringToValue(aListString[1], nColor ); rValue.SetGreen( nColor / 255.0f ); StringToValue(aListString[2], nColor ); rValue.SetBlue( nColor / 255.0f ); StringToValue(aListString[3], nColor ); rValue.SetAlpha( nColor / 255.0f ); return 0; }
void JSONImage::setYn(string yn_string) { this->yn = StringToVector(yn_string); }
void JSONImage::setXn(string xn_string) { this->xn = StringToVector(xn_string); }
BSTR CMUSHclientDoc::Menu(LPCTSTR Items, LPCTSTR Default) { CString strResult; CSendView* pmyView = NULL; for(POSITION pos=GetFirstViewPosition();pos!=NULL;) { CView* pView = GetNextView(pos); if (pView->IsKindOf(RUNTIME_CLASS(CSendView))) { pmyView = (CSendView*)pView; break; } // end of being a CSendView } if (!pmyView) return strResult.AllocSysString(); CEdit * ctlEdit = & pmyView->GetEditCtrl(); int nStartChar, nEndChar; // find the selection range ctlEdit->GetSel(nStartChar, nEndChar); if (nEndChar < 0) nEndChar = nStartChar; vector<string> v; StringToVector (Items, v, "|"); int iCount = v.size (); // must have at least one item if (iCount < 1) return strResult.AllocSysString(); CCompleteWordDlg dlg; set<string> extraItems; for (vector<string>::const_iterator i = v.begin (); i != v.end (); i++) extraItems.insert (*i); dlg.m_extraItems = &extraItems; dlg.m_strDefault = Default; dlg.m_bFunctions = false; dlg.m_pt = ctlEdit->PosFromChar (nEndChar - 1); // strangely doesn't work at end of line ctlEdit->ClientToScreen(&dlg.m_pt); if (dlg.DoModal () == IDOK) strResult = dlg.m_strResult; return strResult.AllocSysString(); } // end of CMUSHclientDoc::Menu