Esempio n. 1
0
BOOL CRemote::CheckCookie()
{
	const CString strToken = L"envyremote=";
	const int nToken = strToken.GetLength();

	for ( INT_PTR nHeader = 0; nHeader < m_pHeaderName.GetSize(); nHeader ++ )
	{
		if ( m_pHeaderName.GetAt( nHeader ).CompareNoCase( L"Cookie" ) == 0 )
		{
			CString strValue( m_pHeaderValue.GetAt( nHeader ) );
			ToLower( strValue );

			int nPos = strValue.Find( strToken );

			if ( nPos >= 0 )
			{
				int nCookie = 0;
				_stscanf( strValue.Mid( nPos + nToken ), L"%i", &nCookie );
				if ( m_pCookies.Find( nCookie ) != NULL ) return FALSE;
			}
		}
	}

	m_sRedirect = L"/remote/";
	return TRUE;
}
Esempio n. 2
0
std::wstring CXmlUtil::GetField(const XMLDOMElementPtr& ele,
                                const wchar_t* filename,
                                const wchar_t* defaultText)
{
    NL(defaultText);
    std::wstring strValue (defaultText);
    LocalHResult hr;

    XMLDOMNodePtr pRet = NULL;
    GetChildIndex(ele, filename, 0, pRet);
    if (pRet != NULL)
    {
        BSTR bstr = NULL;
        hr = pRet->get_text(&bstr);
        if (bstr != NULL)
        {
            strValue = bstr;
            ::SysFreeString(bstr);
        }

        VARIANT_BOOL bHasChild;
        if (strValue.empty()
            && SUCCEEDED(hr = pRet->hasChildNodes(&bHasChild)) && bHasChild)
        {
            strValue = GetFieldCDATA(ele, filename, defaultText);
        }
    }

    return strValue;
}
Esempio n. 3
0
std::wstring CXmlUtil::GetTextCDATA(const XMLDOMElementPtr& ele, const wchar_t* defaultText)
{
    NL(defaultText);
    std::wstring strValue (defaultText);
    XMLDOMNodePtr pCDATA;
    LocalHResult hr;

    if (ele != NULL)
    {
        hr = ele->get_firstChild(&pCDATA);
        if (pCDATA != NULL)
        {
            XMLDOMNodeType type;
            if (SUCCEEDED(hr = pCDATA->get_nodeType(&type))
                && type == XML::NODE_CDATA_SECTION)
            {
                BSTR bstr = NULL;
                hr = pCDATA->get_text(&bstr);
                if (bstr != NULL)
                {
                    strValue = bstr;
                    ::SysFreeString(bstr);
                }
            }
        }
    }

    return strValue;
}
//----------------------------------------------------------------------------------------
// SetColumnText
//----------------------------------------------------------------------------------------
void
CZPTasksTVNodeWidgetMgr::SetColumnText(
	WidgetID					widgetID,
	const PMString &			inValue) const
{
	do {
		InterfacePtr<const IPanelControlData> selfPanelControlData(this, UseDefaultIID());
		ASSERT(selfPanelControlData);
		if(selfPanelControlData==nil) {
			break;
		}
		
		IControlView* controlView = selfPanelControlData->FindWidget( widgetID );
		ASSERT(controlView);
		if (controlView==nil)
			break;

		InterfacePtr<ITextControlData> textControlData( controlView, UseDefaultIID() );
		ASSERT(textControlData);

		PMString strValue(inValue);
		strValue.SetTranslatable(kFalse);
		
		textControlData->SetString(strValue);

	} while (kFalse);
}
Esempio n. 5
0
// Determines what session ID is currently being used by the logged in user and removes it from the cookie list.
BOOL CRemote::RemoveCookie()
{
	const CString strToken = L"envyremote=";
	const int nToken = strToken.GetLength();

	for ( INT_PTR nHeader = 0; nHeader < m_pHeaderName.GetSize(); nHeader ++ )
	{
		if ( m_pHeaderName.GetAt( nHeader ).CompareNoCase( L"Cookie" ) == 0 )
		{
			CString strValue( m_pHeaderValue.GetAt( nHeader ) );
			ToLower( strValue );

			int nPos = strValue.Find( strToken );

			if ( nPos >= 0 )
			{
				int nCookie = 0;
				_stscanf( strValue.Mid( nPos + nToken ), L"%i", &nCookie );		// APP_LENGTH LETTERCOUNT + 7
				POSITION pos = m_pCookies.Find( nCookie );
				if ( pos != NULL )
				{
					m_pCookies.RemoveAt( pos );
					return FALSE;
				}
			}
		}
	}

	return TRUE;
}
Esempio n. 6
0
//------------------------------------------------------------------------
//! Converts a font setting value into a delimited string
//!
//! @param font The setting value
//! @return The delimited string
//------------------------------------------------------------------------
CString CViewConfigSection::ConvertLogFontSetting(const LOGFONT& font) const
{
	CSimpleArray<CString> strArray;

	CString strValue(font.lfFaceName, sizeof(font.lfFaceName) / sizeof(TCHAR));
	strArray.Add(strValue);
	strValue.Format(_T("%d"), font.lfHeight);
	strArray.Add(strValue);
	strValue.Format(_T("%d"), font.lfWidth);
	strArray.Add(strValue);
	strValue.Format(_T("%d"), font.lfEscapement);
	strArray.Add(strValue);
	strValue.Format(_T("%d"), font.lfOrientation);
	strArray.Add(strValue);
	strValue.Format(_T("%d"), font.lfWeight);
	strArray.Add(strValue);
	strValue.Format(_T("%u"), font.lfItalic);
	strArray.Add(strValue);
	strValue.Format(_T("%u"), font.lfUnderline);
	strArray.Add(strValue);
	strValue.Format(_T("%u"), font.lfStrikeOut);
	strArray.Add(strValue);
	strValue.Format(_T("%u"), font.lfCharSet);
	strArray.Add(strValue);
	strValue.Format(_T("%u"), font.lfOutPrecision);
	strArray.Add(strValue);
	strValue.Format(_T("%u"), font.lfQuality);
	strArray.Add(strValue);
	strValue.Format(_T("%u"), font.lfPitchAndFamily);
	strArray.Add(strValue);

	return ConvertArraySetting(strArray);
}
Esempio n. 7
0
void printResult(const DataStore::IQueryResult& result)
{
  DataStore::IFieldDescriptorConstListConstPtrH fields = result.getFieldDescriptors();

  for (DataStore::IQueryResult::const_iterator row = result.cbegin();
    row != result.cend(); ++row)
  {
    DataStore::IFieldDescriptorConstList::const_iterator field = fields->cbegin();

    if (!fields->empty())
    {
      while (field != fields->cend())
      {
        DataStore::ValueConstPtrH v = (*row)->getValue(*(field->get()));

        mStd::mString strValue("");
        if (v)
          v->getValue().convertTo(&strValue);

        std::cout << strValue.c_str();

        ++field;
        if (field != fields->cend())
        {
          std::cout << ",";
        }
      }

      std::cout << std::endl;
    }
  }
}
Esempio n. 8
0
const wxString ecConfigItem::StringValue (CdlValueSource source /* = CdlValueSource_Current */ ) const
{
    //	wxASSERT (!IsPackage()); // not a package item
    const CdlValuable valuable = GetCdlValuable();
    wxASSERT (valuable);
    wxString strValue (wxT(""));
    
    switch (valuable->get_flavor ())
    {
    case CdlValueFlavor_Data:
    case CdlValueFlavor_BoolData:
    case CdlValueFlavor_None: // a package
        if (m_optionType == ecLong)
            strValue = ecUtils::IntToStr (Value (), wxGetApp().GetSettings().m_bHex);
        else if (m_optionType == ecDouble)
            strValue = ecUtils::DoubleToStr (DoubleValue ());
        else
            strValue = valuable->get_value (source).c_str ();
        break;
        
    default:
        wxASSERT (0); // specified flavor not supported
    }
    
    return strValue;
}
Esempio n. 9
0
string GetElementAttribute(TiXmlElement* element,const string& attribute)
{
	if (element == NULL) return string("");

	string strValue("");
	element->QueryValueAttribute(attribute,&strValue);
	return strValue;
}
Esempio n. 10
0
bool XmlTools::chkEntry(std::string section, std::string variable)
{
    coConfigString strValue(config, QString(variable.c_str()), QString(section.c_str()));
    if (strValue.hasValidValue())
        return true;
    else
        return false;
}
BOOL CDlgDcamAbout::OnInitDialog() 
{
	CDialog::OnInitDialog();

	CenterWindow( GetParentFrame() );

	m_lvStrings.InsertColumn( 0, _T("Kind"), 0, 128 );
	m_lvStrings.InsertColumn( 1, _T("Text") );

	LPCTSTR	p;
	for( p = m_strStrings; *p; )
	{
		LPCTSTR	q;
		// find end of line
		for( q = p; *q; q++ )
		{
			if( *q == cr || *q == lf )
				break;
		}

		// find tab
		LPCTSTR	r;
		for( r = p; r < q; r++ )
		{
			if( *r == tab )
				break;
		}

		if( *q && r < q )
		{
			CString	strTitle( p, int(r-p) );

			r++;
			CString	strValue( r, int(q-r) );

			int	nItem = m_lvStrings.InsertItem( m_lvStrings.GetItemCount(), strTitle );
			m_lvStrings.SetItemText( nItem, 1, strValue );
		}
		else
			ASSERT( 0 );

		// prepare next line
		if( *q == cr )	q++;
		if( *q == lf )	q++;
		p = q;
	}

	if( m_lvStrings.GetItemCount() > 0 )
	{
		m_lvStrings.SetColumnWidth( 0, LVSCW_AUTOSIZE );
		m_lvStrings.SetColumnWidth( 1, LVSCW_AUTOSIZE );
	}

	GetDlgItem( IDC_DLGDCAMABOUT_BTNCOPY )->EnableWindow( m_bCopy );

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Esempio n. 12
0
std::string CHttpHeader::GetMimeType(void) const
{
  std::string strValue(GetValueRaw("content-type"));

  std::string mimeType(strValue, 0, strValue.find(';'));
  StringUtils::TrimRight(mimeType, m_whitespaceChars);

  return mimeType;
}
Esempio n. 13
0
BOOL CPropertiesWnd::IsComboType()
{
	CMFCPropertyGridProperty *pProp = m_wndPropList.FindItemByData(PROP_DATA_TYPE);
	if (pProp)
	{
		CString strValue(pProp->GetValue());
		return strValue.CompareNoCase(_T("Combo")) == 0;
	}
	return FALSE;
}
Esempio n. 14
0
std::string Option::getString() const
{
	void* out_val = av_malloc( 128 );
	int error = av_opt_get( _avContext, getName().c_str(), AV_OPT_SEARCH_CHILDREN, (uint8_t**)&out_val );

	std::string strValue( out_val ? reinterpret_cast<const char*>( out_val ) : "" );

	av_free( out_val );

	checkFFmpegGetOption( error );

	return strValue;
}
Esempio n. 15
0
std::string CHttpHeader::GetCharset(void) const
{
  std::string strValue(GetValueRaw("content-type"));
  if (strValue.empty())
    return strValue;

  StringUtils::ToUpper(strValue);
  const size_t len = strValue.length();

  // extract charset value from 'contenttype/contentsubtype;pram1=param1Val ; charset=XXXX\t;param2=param2Val'
  // most common form: 'text/html; charset=XXXX'
  // charset value can be in double quotes: 'text/xml; charset="XXX XX"'

  size_t pos = strValue.find(';');
  while (pos < len)
  {
    // move to the next non-whitespace character
    pos = strValue.find_first_not_of(m_whitespaceChars, pos + 1);

    if (pos != std::string::npos)
    {
      if (strValue.compare(pos, 8, "CHARSET=", 8) == 0)
      {
        pos += 8; // move position to char after 'CHARSET='
        size_t len = strValue.find(';', pos);
        if (len != std::string::npos)
          len -= pos;
        std::string charset(strValue, pos, len);  // intentionally ignoring possible ';' inside quoted string
                                                  // as we don't support any charset with ';' in name
        StringUtils::Trim(charset, m_whitespaceChars);
        if (!charset.empty())
        {
          if (charset[0] != '"')
            return charset;
          else
          { // charset contains quoted string (allowed according to RFC 2616)
            StringUtils::Replace(charset, "\\", ""); // unescape chars, ignoring possible '\"' and '\\'
            const size_t closingQ = charset.find('"', 1);
            if (closingQ == std::string::npos)
              return ""; // no closing quote

            return charset.substr(1, closingQ - 1);
          }
        }
      }
      pos = strValue.find(';', pos); // find next parameter
    }
  }

  return ""; // no charset is detected
}
Esempio n. 16
0
void CPlayerView::OnInitialUpdate() 
{
	CFormView::OnInitialUpdate();
    CUStringConvert strCnv;
	
	OnUpdate( NULL, WM_CDEX_INITIAL_UPDATE, NULL );

	CPaintDC dc(this);

	m_cVolumeBitmap.Create(&dc,IDB_VOLUME );


	// Allow Drag and dropping of files
	DragAcceptFiles();

	AddMultiPlayerFiles( strCnv.ToT( ((CCDexApp*)AfxGetApp())->GetCommandLineParams() ) );

	// Do we have to debug this stuff?
	m_Volume.Init(	MIXERLINE_COMPONENTTYPE_DST_SPEAKERS,
					NO_SOURCE,
					MIXERCONTROL_CONTROLTYPE_VOLUME,
					CMixerFader::MAIN);

	m_pThread = NULL;
	m_nTotalTime=0;
	m_nCurrentTime=0;

	BOOL	m_bAbortThread = FALSE;
	BOOL	m_bAbortCurrent = FALSE;

	m_nStatus = IDLE;

	SetControls();

	InitWinAmpPlugins( GetSafeHwnd() );

	// Set timer
	SetTimer(TIMERID,TIMERSLOT,NULL);

	CString strValue( g_language.GetString( IDS_CDEX_PLAYER_VERSION ) );
	AfxGetApp()->m_pMainWnd->SetWindowText( strValue + strCnv.ToT(  g_config.GetVersion() ) );


	PlaceControls();

	UpdateData( FALSE );
	Invalidate( FALSE );

	((CCDexApp*)AfxGetApp())->SetInitialized();

}
Esempio n. 17
0
STDMETHODIMP NetworkAdapter::SetProperty(IN_BSTR aKey, IN_BSTR aValue)
{
    LogFlowThisFunc(("\n"));

    AutoCaller autoCaller(this);
    if (FAILED(autoCaller.rc())) return autoCaller.rc();

    /* The machine needs to be mutable. */
    AutoMutableStateDependency adep(mParent);
    if (FAILED(adep.rc())) return adep.rc();

    Bstr key = aKey;

    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);

    bool fGenericChange = (mData->mAttachmentType == NetworkAttachmentType_Generic);

    /* Generic properties processing.
     * Look up the old value first; if nothing's changed then do nothing.
     */
    Utf8Str strValue(aValue);
    Utf8Str strKey(aKey);
    Utf8Str strOldValue;

    settings::StringsMap::const_iterator it = mData->mGenericProperties.find(strKey);
    if (it != mData->mGenericProperties.end())
        strOldValue = it->second;

    if (strOldValue != strValue)
    {
        if (strValue.isEmpty())
            mData->mGenericProperties.erase(strKey);
        else
            mData->mGenericProperties[strKey] = strValue;

        /* leave the lock before informing callbacks */
        alock.release();

        AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS);
        mParent->setModified(Machine::IsModified_NetworkAdapters);
        mlock.release();

        /* Avoid deadlock when the event triggers a call to a method of this
         * interface. */
        adep.release();

        mParent->onNetworkAdapterChange(this, fGenericChange);
    }

    return S_OK;
}
Esempio n. 18
0
wstring GetIniValue(const wchar_t* strKey,const wchar_t* strFile)
{
	wchar_t ch[255];
	const int i = 255;

	GetPrivateProfileString(L"WNPD",strKey,L"",ch,i,strFile);
	wstring strValue(ch);

	size_t pos = strValue.find_last_of(L"=");
	if( pos != wstring::npos)
		strValue = strValue.substr(pos+1,strValue.length());
	return strValue;

}
Esempio n. 19
0
/*!
  \brief Get string property

  \param escape true to escape characters for SQL

  \return string buffer
*/
const char *VFKProperty::GetValueS( bool escape ) const
{
    if( !escape )
        return m_strValue.c_str();

    CPLString strValue(m_strValue);
    size_t ipos = 0;
    while (std::string::npos != (ipos = strValue.find("'", ipos))) {
        strValue.replace(ipos, 1, "\'\'", 2);
        ipos += 2;
    }

    return CPLSPrintf("%s", strValue.c_str());
}
bool WCSerializeableObject::GetBoolAttrib(xercesc::DOMElement *element, const std::string &name) {
	//Get attribute and node for the name
	XMLCh* attribName = xercesc::XMLString::transcode( name.c_str() );
	//Get the value of the attribute
	const XMLCh* attribValue = element->getAttribute(attribName);
	xercesc::XMLString::release(&attribName);
	//Convert to std::string
	char *str = xercesc::XMLString::transcode(attribValue);
	std::string strValue(str);
	delete str;
	//Return the value
	if (strValue == "false") return false;
	else return true;
}
//------------------------------------------
EXPORT_C bool skTreeNodeObject::equals(const skiExecutable * o) const
//------------------------------------------
{
  bool equals=false;
  // is the other a TreeNodeObject?
  if (o->executableType()==executableType() && m_Node){
    skTreeNode * other=((skTreeNodeObject *)o)->getNode();
    if (other)
      // do a deep comparison on the nodes
      equals=(*m_Node==*other);
  }else
    // otherwise just check the string value
    equals=(strValue()==o->strValue());
  return equals;
}
Esempio n. 22
0
//file name can not include keybuff character,get the position of the key word
int checkIfIncludeKeyWords(char* buff)
{
	CString strValue(buff);
	int nPos = -1;
	int nCount = sizeof(keyBuff)/sizeof(char);
	for (int i = 0; i < nCount; i++)
	{
		nPos = strValue.Find(keyBuff[i]);
		if (nPos != -1)
		{
			return nPos;
		}
	}
	return -1;
}
CString CBCGPPlannerViewMulti::GetAccName() const
{
	CString strValue(CBCGPPlannerViewDay::GetAccName());

	const CBCGPAppointmentBaseMultiStorage* pStorage = 
		DYNAMIC_DOWNCAST(CBCGPAppointmentBaseMultiStorage, GetPlanner ()->GetStorage ());

	const CBCGPAppointmentBaseResourceInfo* pInfo = pStorage->GetResourceInfo (GetCurrentResourceID ());
	if (pInfo != NULL && !pInfo->GetDescription ().IsEmpty ())
	{
		strValue = pInfo->GetDescription () + _T(". ") + strValue;
	}

	return strValue;
}
Esempio n. 24
0
string GetElementAttributeByTagName(TiXmlElement* root,const string& name,
		const string& attribute)
{
	if (root == NULL) return string("");

	string strValue("");

	TiXmlElement* toFind = GetElementByTagName(root,name);

	if (toFind != NULL)
	{
		toFind->QueryValueAttribute(attribute,&strValue);
	}

	return strValue;
}
Esempio n. 25
0
int RegistersModel::value(int idx)
{
    QString stringVal;
    int intVal;
    bool ok;

    qDebug()<<  "RegistersModel : value - row " << idx;

    //Get Value
    stringVal = strValue(idx);
    intVal = stringVal.toInt(&ok,m_base);
    if (ok)
        return intVal;
    else
        return -1;

}
Esempio n. 26
0
bool wxDatabaseConfig::AddEntry(dbentry& parent, const wxString& name, const wxString* value)
{
	if (name.empty()) return false;
	wxASSERT_MSG(!wxStrchr(name, wxCONFIG_PATH_SEPARATOR), wxT("AddEntry(): paths are not supported")); 

	m_pStatementSqlAddEntry->SetParamInt(1, parent.id);
	m_pStatementSqlAddEntry->SetParamString(2, name);
	if (value == NULL)
	{
		m_pStatementSqlAddEntry->SetParamNull(3);
	}
	else
	{
		wxString strValue(*value);
		m_pStatementSqlAddEntry->SetParamString(3, strValue);
	}
	m_self->ExecuteStatement(m_pStatementSqlAddEntry);
	return true;
}
Esempio n. 27
0
void CMDXMaterialPage::UpdateAllData()
{
	CString strValue("");
	GetDlgItem(IDC_EDIT_MAX_MELT_TEMPERATURE)->GetWindowText(strValue);
	SetMaxMeltTemperature(atof(strValue) );
	GetDlgItem(IDC_EDIT_MIN_MELT_TEMPERATURE)->GetWindowText(strValue);
	SetMinMeltTemperature(atof(strValue) );
	GetDlgItem(IDC_EDIT_MAX_MOLD_TEMPERATURE)->GetWindowText(strValue);
	SetMaxMoldTemperature(atof(strValue) );
	GetDlgItem(IDC_EDIT_MIN_MOLD_TEMPERATURE)->GetWindowText(strValue);
	SetMinMoldTemperature(atof(strValue) );
	GetDlgItem(IDC_EDIT_MELT_TEMPERATURE)->GetWindowText(strValue);
	SetMoldTemperature(atof(strValue) );
	GetDlgItem(IDC_EDIT_MOLD_TEMPERATURE)->GetWindowText(strValue);
	SetMoldTemperature(atof(strValue) );

	//push material selection to data center
	DataCenter::getInstance().SetMaterialSel(m_iMaterialSel);
}
Esempio n. 28
0
std::string CHTTPRequest::GetField(const char* pszKey)
{
	// 正真的字段应该是从换行开始,: 结束.
	std::string strKey("\r\n");
	strKey += pszKey; strKey += "; "; //冒号后面有个空格.
	std::string strValue("");

	// 找到字段的开始
	const char* pszStart = strstr(m_pData, strKey.c_str());
	if(pszStart == NULL) return strValue;
	pszStart += strKey.size();

	// 找到字段结束
	const char* pszEnd = strstr(pszStart, "\r\n");
	if(pszEnd == NULL) return strValue;

	strValue.assign(pszStart, pszEnd - pszStart);
	return strValue;
}
CDlgDcamAbout::CDlgDcamAbout( HDCAM hdcam, CWnd* pParent )
	: CDialog(CDlgDcamAbout::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDlgDcamAbout)
	//}}AFX_DATA_INIT

	m_strStrings.Empty();

	if( hdcam != NULL )
	{
		DCAMERR err;

		long	i;
		for( i = 0; strings[i].id != 0; i++ )
		{
			char	buf[ 256 ] = {'\0'};
			DCAMDEV_STRING param;
			param.size = sizeof(param);
			param.text = buf;
			param.textbytes = 256;
			param.iString = strings[i].id;

			err = dcamdev_getstring( hdcam, &param );
			if( failed(err) || buf[0] == '\0' )
			{
				// this string id is not supported in this camera.
				continue;
			}

			CString	strTitle = strings[i].title;
			CString	strValue( buf );

			CString	str;
			str.Format( _T("%s") TAB _T("%s") CRLF, strTitle, strValue );

			m_strStrings += str;
		}
	}

	m_bCopy = ! m_strStrings.IsEmpty();
}
Esempio n. 30
0
std::string CHttpHeader::GetCharset(void) const
{
  std::string strValue(GetValueRaw("content-type"));
  if (strValue.empty())
    return strValue;

  const size_t semicolonPos = strValue.find(';');
  if (semicolonPos == std::string::npos)
    return "";

  StringUtils::ToUpper(strValue);
  size_t posCharset;
  if ((posCharset = strValue.find("; CHARSET=", semicolonPos)) != std::string::npos)
    posCharset += 10;
  else if ((posCharset = strValue.find(";CHARSET=", semicolonPos)) != std::string::npos)
    posCharset += 9;
  else
    return "";

  return strValue.substr(posCharset, strValue.find(';', posCharset) - posCharset);
}