コード例 #1
0
ファイル: viewhtml.cpp プロジェクト: Rupan/winscp
void CHtmlView::PutProperty(LPCTSTR lpszProperty, const VARIANT& vtValue)
{
	ASSERT(m_pBrowserApp != NULL);

	CString strProp(lpszProperty);
	BSTR bstrProp = strProp.AllocSysString();
	m_pBrowserApp->PutProperty(bstrProp, vtValue);
	::SysFreeString(bstrProp);
}
コード例 #2
0
ファイル: menu_manager.cpp プロジェクト: m2osw/turnwatcher
/** \brief Merge a prop array containing menu information into a destination array
 *
 * This recursive method takes a property array and peruses it, adding its
 * contents to the source array. This allows you to add a menu to another menu.
 * Menu weights are respected.
 *
 * \param[in] dest Merge the \p source array of menu items to this property array
 * \param[in] source The source of menu items to merge
 *
 * \sa MergeMenu
 */
void moMenuManager::MergeMenu( moPropArrayRef dest, moPropArrayRef source )
{
	unsigned long idx = 0;
	const unsigned long end = source.CountIndexes();

	for( ; idx < end; idx++ )
	{
		const int		item_no		= source.ItemNoAtIndex( idx );
		moPropSPtr		sourceProp	= source.Get( item_no );
		moProp::prop_type_t	type		= sourceProp->GetType();
		moName			name		= sourceProp->GetName();

		switch( type )
		{
		case moProp::MO_PROP_TYPE_PROP_BAG:
		    {
			    moPropBagRef	sourceRef(name);
			    sourceRef.NewProp();
			    sourceRef.GetProperty()->Copy(*sourceProp);

			    moPropBagRef	destRef(name);
			    destRef.NewProp();
			    moProp*	prop = dest.Get( item_no );
			    if( prop )
			    {
			    	destRef = *((moPropBag*)prop);
			    }

			    MergeMenu( destRef, sourceRef );
			    dest.Set( item_no, destRef );
		    }
		    break;
		
		case moProp::MO_PROP_TYPE_STRING:
		    {
			moPropStringRef	strProp(name);
			strProp.NewProp();
			strProp.GetProperty()->Copy( *sourceProp );
			dest.Set( item_no, strProp );
		    }
		    break;

		default:
			// TODO: Message needed here
			// to indicate we have an unsupported type for this structure
			std::cerr << "Unsupported property type for this structure!" << std::endl;
		}
	}
}