当前位置: 首页>>代码示例>>C++>>正文


C++ SStringW类代码示例

本文整理汇总了C++中SStringW的典型用法代码示例。如果您正苦于以下问题:C++ SStringW类的具体用法?C++ SStringW怎么用?C++ SStringW使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了SStringW类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ParseValue

bool SColorParser::ParseValue(const SStringW & strValue, COLORREF & value)
{
	int r = 255, g = 255, b = 255, a = 255;
    int nSeg=0;
    SStringW strValueL = strValue;
    strValueL.MakeLower();
    if(strValueL.Left(1)==L"#")
    {
        nSeg = swscanf(strValueL,L"#%02x%02x%02x%02x",&r,&g,&b,&a);
    }else if(strValueL.Left(4).CompareNoCase(L"rgba")==0)
    {
        nSeg = swscanf(strValueL,L"rgba(%d,%d,%d,%d)",&r,&g,&b,&a);                
    }else if(strValueL.Left(3).CompareNoCase(L"rgb")==0)
    {
        nSeg = swscanf(strValueL,L"rgb(%d,%d,%d)",&r,&g,&b);                
    }
    if(nSeg!=3 && nSeg != 4)
    {
        SASSERT_FMT(FALSE,TEXT("ParseColor Failed with [%s]"),S_CW2T(strValue));
        return false;
    }else
    {
        value = RGBA(r,g,b,a);
        return true;
    }
}
开发者ID:,项目名称:,代码行数:26,代码来源:

示例2: ParseValue

    bool SPropertyItemColor::ParseValue(const SStringT & strValue, COLORREF & value)
	{
		int r,g,b,a=255;
		int nSeg=0;
		SStringW strValueL = strValue;
		strValueL.MakeLower();
		if(strValueL.Left(1)==L"#")
		{
			nSeg = swscanf(strValueL,L"#%02x%02x%02x%02x",&r,&g,&b,&a);
		}else if(strValueL.Left(4).CompareNoCase(L"rgba")==0)
		{
			nSeg = swscanf(strValueL,L"rgba(%d,%d,%d,%d)",&r,&g,&b,&a);                
		}else if(strValueL.Left(3).CompareNoCase(L"rgb")==0)
		{
			nSeg = swscanf(strValueL,L"rgb(%d,%d,%d)",&r,&g,&b); 
		}
		if(nSeg!=3 && nSeg != 4)
		{
			//SASSERT_FMT(FALSE,TEXT("解析颜色值失败 [%s]"),S_CW2T(strValue));
			value = CR_INVALID;
			return false;
		}else
		{
			value = RGBA(r,g,b,a);
			return true;
		}
	}
开发者ID:ming-hai,项目名称:soui,代码行数:27,代码来源:SPropertyItem-Color.cpp

示例3: fstream

bool San::FileIOStream::gloWriteFile(const SString &strFilePath, const SStringW &strData, const bool bCover)
{
	if (strFilePath.empty())
	{
		return false;
	}
	ios::openmode FileFlag = ios::binary | ios::out;
	if (bCover)
	{
		FileFlag = FileFlag | ios::trunc;
	}
	else
	{
		FileFlag = FileFlag | ios::ate;
	}
	fstream* pFile = new fstream(strFilePath, FileFlag, 0x40);
	if (pFile == nullptr)
	{
		return false;
	}
	pFile->write((const char*) strData.c_str(), sizeof(swchar) *strData.size());
	pFile->close();
	delete pFile;
	pFile = nullptr;
	return true;
}
开发者ID:zxyinz,项目名称:ArtificialIntelligence,代码行数:26,代码来源:SanFileIO.cpp

示例4: CRect

 LRESULT SSkinImgFrame2::OnAttrSrc(const SStringW & strValue,BOOL bLoading)
 {
     int iPos = strValue.Find(L'{');
     if(iPos==-1) return E_FAIL;
     m_strImgKey = strValue.Left(iPos);
     SStringW strRgn = strValue.Right(strValue.GetLength()-iPos);
     if(swscanf(strRgn,L"{%d,%d,%d,%d}",&m_rcImg.left,&m_rcImg.top,&m_rcImg.right,&m_rcImg.bottom)!=4)
     {
         CPoint pt;
         CSize sz;
         if(swscanf(strRgn,L"{%d,%d,@%d,@%d}",&pt.x,&pt.y,&sz.cx,&sz.cy)!=4)
             return E_FAIL;
         m_rcImg = CRect(pt,sz);
     }
     
     IMGPOOL::CPair * p = s_imgPool.Lookup(m_strImgKey);
     if(p)
     {
         SSkinImgFrame::SetImage(p->m_value);
         p->m_value->AddRef();
     }else
     {
         IBitmap *pImg=LOADIMAGE2(m_strImgKey);
         if(!pImg) return E_FAIL;
         s_imgPool[m_strImgKey]=pImg;
         SSkinImgFrame::SetImage(pImg);
     }
     return S_OK;
 }
开发者ID:3rdexp,项目名称:soui,代码行数:29,代码来源:SSkinImgFrame2.cpp

示例5: SetMins

void STimeEdit::SetMins(int nMins)
{
    m_nMins = nMins;

    SStringW strText;
    strText.Format(L"%02d:%02d", m_nHours, m_nMins);
    SetWindowText(strText);
}
开发者ID:wugh7125,项目名称:ui,代码行数:8,代码来源:SDateTimeEdit.cpp

示例6: XMLEscape

//////////////////////////////////////////////////////////////////////////
// xml helpers
SStringW XMLEscape(SStringW& strXML)
{
    strXML.Replace(L"&", L"&");
    strXML.Replace(L"<", L"&lt;");
    strXML.Replace(L">", L"&gt;");
    strXML.Replace(L"'", L"&apos;");
    strXML.Replace(L"\"", L"&quot;");
    return strXML;
}
开发者ID:435420057,项目名称:soui,代码行数:11,代码来源:utils.cpp

示例7: while

void SMenu::BuildMenu( HMENU menuPopup,pugi::xml_node xmlNode )
{
    pugi::xml_node xmlItem=xmlNode.first_child();

    while(xmlItem)
    {
        if(wcscmp(L"item",xmlItem.name())==0)
        {
            SMenuItemData *pdmmi=new SMenuItemData;
            pdmmi->hMenu=menuPopup;
            pdmmi->itemInfo.iIcon=xmlItem.attribute(L"icon").as_int(-1);
            SStringW strText = xmlItem.text().get();
            strText.TrimBlank();
            InitMenuItemData(pdmmi->itemInfo,strText);

            int nID=xmlItem.attribute(L"id").as_int(0);
            BOOL bCheck=xmlItem.attribute(L"check").as_bool(false);
            BOOL bRadio=xmlItem.attribute(L"radio").as_bool(false);
            BOOL bDisable=xmlItem.attribute(L"disable").as_bool(false);


            pugi::xml_writer_buff writer;
            xmlItem.print(writer,L"\t",pugi::format_default,pugi::encoding_utf16);
            SStringW str(writer.buffer(),writer.size());

            pugi::xml_node xmlChild=xmlItem.first_child();
            while(xmlChild && xmlChild.type()==pugi::node_pcdata) xmlChild=xmlChild.next_sibling();


            if(!xmlChild)
            {
                pdmmi->nID=nID;
                UINT uFlag=MF_OWNERDRAW;
                if(bCheck) uFlag|=MF_CHECKED;
                if(bDisable) uFlag |= MF_GRAYED;
                if(bRadio) uFlag |= MFT_RADIOCHECK|MF_CHECKED;
                AppendMenu(menuPopup,uFlag,(UINT_PTR)pdmmi->nID,(LPCTSTR)pdmmi);
            }
            else
            {
                HMENU hSubMenu=::CreatePopupMenu();
                pdmmi->nID=(UINT_PTR)hSubMenu;
                UINT uFlag=MF_OWNERDRAW|MF_POPUP;
                if(bDisable) uFlag |= MF_GRAYED;
                AppendMenu(menuPopup,uFlag,(UINT_PTR)hSubMenu,(LPCTSTR)pdmmi);
                BuildMenu(hSubMenu,xmlItem);//build sub menu
            }
            m_arrDmmi.Add(pdmmi);
        }
        else if(wcscmp(L"sep",xmlItem.name())==0)
        {
            AppendMenu(menuPopup,MF_SEPARATOR|MF_OWNERDRAW,(UINT_PTR)0,(LPCTSTR)NULL);
        }
        xmlItem=xmlItem.next_sibling();
    }
}
开发者ID:3rdexp,项目名称:soui,代码行数:56,代码来源:SMenu.cpp

示例8:

BOOL RichEditBkImg::ParsePosition34(POSITION_ITEM* pPosItem, const SStringW & strPos3, const SStringW &strPos4 )
{
    if(strPos3.IsEmpty() || strPos4.IsEmpty()) return FALSE;
    POSITION_ITEM pos3,pos4;
    if(!StrPos2ItemPos(strPos3,pos3) || !StrPos2ItemPos(strPos4,pos4) ) return FALSE;

    pPosItem [PI_RIGHT] = pos3;
    pPosItem [PI_BOTTOM] = pos4;
    return TRUE;
}
开发者ID:435420057,项目名称:soui,代码行数:10,代码来源:RichEditObj.cpp

示例9: OnAttrWidth

    HRESULT SLinearLayoutParam::OnAttrWidth(const SStringW & strValue,BOOL bLoading)
    {
        if(strValue.CompareNoCase(L"matchParent") == 0)
			width.setMatchParent();
        else if(strValue.CompareNoCase(L"wrapContent") == 0)
			width.setWrapContent();
        else
			width = GETLAYOUTSIZE(strValue);
        return S_OK;
    }
开发者ID:,项目名称:,代码行数:10,代码来源:

示例10: InitMenuItemData

void SMenu::InitMenuItemData(SMenuItemInfo & itemInfo, const SStringW & strTextW)
{
    itemInfo.strText=S_CW2T(TR(strTextW,m_menuAttr.m_strTrCtx));

    //查找快捷键
    int iHotKey = strTextW.Find(L"&");
    if(iHotKey != -1 && iHotKey < strTextW.GetLength()-1)
    {
        itemInfo.vHotKey = tolower(strTextW[iHotKey+1]);
    }else
    {
        itemInfo.vHotKey = 0;
    }
}
开发者ID:3rdexp,项目名称:soui,代码行数:14,代码来源:SMenu.cpp

示例11: switch

BOOL RichEditBkImg::StrPos2ItemPos(const SStringW &strPos, POSITION_ITEM & pos)
{
    if(strPos.IsEmpty()) return FALSE;

    LPCWSTR pszPos = strPos;
    switch(pszPos[0])
    {
    //case POSFLAG_REFCENTER: pos.pit=PIT_CENTER,pszPos++;break;
    //case POSFLAG_PERCENT: pos.pit=PIT_PERCENT,pszPos++;break;
    case POSFLAG_REFPREV_NEAR: pos.pit=PIT_PREV_NEAR,pszPos++;break;
    case POSFLAG_REFNEXT_NEAR: pos.pit=PIT_NEXT_NEAR,pszPos++;break;
    case POSFLAG_REFPREV_FAR: pos.pit=PIT_PREV_FAR,pszPos++;break;
    case POSFLAG_REFNEXT_FAR: pos.pit=PIT_NEXT_FAR,pszPos++;break;
    case POSFLAG_SIZE:pos.pit=PIT_SIZE,pszPos++;break;
    default: pos.pit=PIT_NORMAL;break;
    }

    pos.nRefID = -1;//not ref sibling using id
    if(pszPos [0] == L'-')
    {
        pos.cMinus = -1;
        pszPos ++;
    }else
    {
        pos.cMinus = 1;
    }
    pos.nPos=(float)_wtof(pszPos);

    return TRUE;
}
开发者ID:435420057,项目名称:soui,代码行数:30,代码来源:RichEditObj.cpp

示例12: SStringW

	SStringW SLayoutSize::toString() const
	{
		SStringW strValue = SStringW().Format(L"%f",fSize);
		//去掉sprintf("%f")生成的小数点最后无效的0
		LPCWSTR pszData = strValue;
		for(int i=strValue.GetLength()-1;i>=0;i--)
		{
			if(pszData[i]!=L'0')
			{
				if(pszData[i]==L'.') i--;
				strValue = strValue.Left(i+1);
				break;
			}
		}
		return SStringW().Format(L"%s%s",strValue,s_pszUnit[unit]);
	}
开发者ID:,项目名称:,代码行数:16,代码来源:

示例13: parseString

	void SLayoutSize::parseString(const SStringW & strSize)
	{
		if(strSize.IsEmpty()) return;
		SStringW strUnit = strSize.Right(2);
		strUnit.MakeLower();
		unit = px;
		for(int i=0; i< ARRAYSIZE(s_pszUnit);i++)
		{
			if(strUnit.Compare(s_pszUnit[i]) == 0)
			{
				unit = (Unit)i;
				break;
			}
		}
		fSize = (float)_wtof(strSize);
	}
开发者ID:,项目名称:,代码行数:16,代码来源:

示例14: InsertSingleInfo

void CMainDlg::InsertSingleInfo(tagMusicInfo pMusicInfo, int nNum)
{
	/*---------------------------------------------- listboxex动态插入 beg -----------------------------------------------------*/
	//m_SeleInfoMap.clear();
	SListBoxEx *pMusicLbe=FindChildByName2<SListBoxEx>(L"music_lbe");
	if(pMusicLbe)
	{
		SStringW m_sTemp;     //信息
		SStringW StrTotleTime;//时间
		DWORD dwTotleTime = pMusicInfo.dwTime;
		StrTotleTime.Format(L"%u:%02u",dwTotleTime/60,dwTotleTime%60);
		if (nNum%2)
		{
			m_sTemp.Format(L"<item>\
							  <img skin=\"_skin.logo.skin\" pos=\"5,5,55,55\" />\
							  <text pos=\"70,5\"  valign=\"middle\" align=\"left\" colorText=\"#CDD7E1\" >歌曲:%s </text>\
							  <text pos=\"70,20\" valign=\"middle\" align=\"left\" colorText=\"#CDD7E1\" >歌手:%s </text>\
							  <text pos=\"70,35\" valign=\"middle\" align=\"left\" colorText=\"#CDD7E1\" >时长:%s 交流群:229313785 </text>\
							 </item>",pMusicInfo.szTitle,pMusicInfo.szArtist,StrTotleTime);	
		}else
		{
开发者ID:435420057,项目名称:soui,代码行数:21,代码来源:MainDlg.cpp

示例15: SSendMessage

    SStringW SChatEdit::GetFormatText()
    {
        SStringW strTxt;


        TEXTRANGE  txtRng;
        txtRng.chrg.cpMin =0;
        txtRng.chrg.cpMax = SSendMessage(WM_GETTEXTLENGTH);
        txtRng.lpstrText = (LPTSTR)strTxt.GetBufferSetLength(txtRng.chrg.cpMax);
        
        SSendMessage(EM_GETTEXTRANGE,0,(LPARAM)&txtRng);
        strTxt.ReleaseBuffer();

        SComPtr<IRichEditOle> ole;
        SSendMessage(EM_GETOLEINTERFACE,0,(LPARAM)(void**)&ole);
        
        SStringW strMsg;
        int iPlainTxtBegin = 0;
        for(int i=0;i<strTxt.GetLength();i++)
        {
            if(strTxt[i] == 0xfffc)
            {//找到一个OLE对象
                strMsg += strTxt.Mid(iPlainTxtBegin,i-iPlainTxtBegin);
                iPlainTxtBegin = i+1;

                REOBJECT reobj={sizeof(reobj),0};
                reobj.cp = i;
                HRESULT hr = ole->GetObject( REO_IOB_USE_CP , &reobj, REO_GETOBJ_POLEOBJ);
                if(SUCCEEDED(hr) && reobj.poleobj)
                {
                    if(reobj.clsid == CLSID_CSoSmileyCtrl)
                    {
                        SComPtr<ISoSmileyCtrl> smiley;
                        hr = reobj.poleobj->QueryInterface(__uuidof(ISoSmileyCtrl), (void**)&smiley);
                        if(SUCCEEDED(hr))
                        {
                            SComPtr<ISmileySource> source;
                            hr = smiley->GetSource(&source);
                            SASSERT(SUCCEEDED(hr));
                            UINT uID = -1;
                            SStringW strSmiley = L"<smiley";
                            if(SUCCEEDED(source->GetID(&uID)))
                            {
                                strSmiley += SStringW().Format(L" id=\"%d\"",uID);
                            }

                            BSTR strFile;
                            if(SUCCEEDED(source->GetFile(&strFile)))
                            {
                                strSmiley += SStringW().Format(L" path=\"%s\"",strFile);
                                ::SysFreeString(strFile);
                            }
                            strSmiley += L"/>";

                            strMsg += strSmiley;

                        }
                    }
                    reobj.poleobj->Release();
                }
            }
        }
        if(iPlainTxtBegin<strTxt.GetLength())
        {
            strMsg += strTxt.Right(strTxt.GetLength()-iPlainTxtBegin);
        }
        return strMsg;
    }
开发者ID:435420057,项目名称:soui,代码行数:68,代码来源:SChatEdit.cpp


注:本文中的SStringW类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。