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


C++ CString::SpanIncluding方法代码示例

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


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

示例1: WriteProp

void CXTPSyntaxEditLexCfgFileReader::WriteProp(CFile& file, CString& csOffset, const XTP_EDIT_LEXPROPINFO& oldInfoProp, const XTP_EDIT_LEXPROPINFO& newInfoProp, const CStringArray& arBuffer)
{
	if (oldInfoProp.nLine < arBuffer.GetSize())
	{
		CString csBuffer = arBuffer[oldInfoProp.nLine];

		int iIndex = csBuffer.Find(_T("="));
		ASSERT(iIndex > 0);
		if (iIndex > 0)
		{
			csOffset = csBuffer.SpanIncluding(_T(" \t"));

			CString csSep = csBuffer.Mid(iIndex+1);
			csSep = csSep.SpanIncluding(_T(" \t"));
			iIndex += csSep.GetLength();

			CString csNewBuffer = csBuffer;
			csNewBuffer.Delete(iIndex+1, oldInfoProp.nPropertyLen);

			CString csPropValue = AfxMakeStrES(newInfoProp.arPropValue, _T(", "));
			csNewBuffer.Insert(iIndex+1, csPropValue);
			WriteString(file, csNewBuffer);
			return;
		}
	}
	else
	{
		ASSERT(FALSE);
	}

	WriteProp(file, csOffset, newInfoProp);
}
开发者ID:lai3d,项目名称:ThisIsASoftRenderer,代码行数:32,代码来源:XTPSyntaxEditLexCfgFileReader.cpp

示例2: ExtractFirstIntVersion

BOOL ICF_ifstream::ExtractFirstIntVersion(CString& string, int& number)
{
	const CString backup_string = string;
	CString substring;
	int pos;

	number = 0;

	if ((pos = string.FindOneOf("1234567890")) == -1)
	{
		ErrorMessage("File is improperly formatted.  Expected an "
			"integer value.");
		return FALSE;
	}

	// Cleave off everything before the first number.
	string = string.Right(string.GetLength() - pos);

	substring = string.SpanIncluding("1234567890"); // get the int as a string
	string = string.Right(string.GetLength() - substring.GetLength());

	number = atoi( (LPCTSTR)substring );

	// Prepare string for further processing.  Eat whitespace.
	string.TrimLeft();

	// If there's a trailing comma, eat it.
	if (!string.IsEmpty() && string.GetAt(0) == ',')
		string = string.Right(string.GetLength() - 1);

	// Eat any space following the comma.
	string.TrimLeft();

	return TRUE;
}
开发者ID:BackupTheBerlios,项目名称:iometer-svn,代码行数:35,代码来源:ICF_ifstream.cpp

示例3: ExtractFirstToken

//
// Extracts the first solid series of letters, numbers, underscores, and
// hyphens in a string.  Returns the substring, removes the token from the
// original string.
//
// If spaces parameter is TRUE, spaces are considered part of the token
// instead of delimiters.
//
// Error condition is not reported.  If returned string is empty (IsEmpty)
// and an empty string is not expected, the caller should report an error.
//
CString ICF_ifstream::ExtractFirstToken(CString& string, BOOL spaces/*=FALSE*/)
{
	CString substring;
	int pos;
	CString token_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
							"abcdefghijklmnopqrstuvwxyz"
							"1234567890"
							"`[email protected]#$%^&*()-_=+[]{}\\:;\"'./<>?";


	if (spaces)
		token_chars += " ";

	if ((pos = string.FindOneOf(token_chars)) == -1)
	{
		substring.Empty();
		return substring;
	}

	string = string.Right(string.GetLength() - pos);

	substring = string.SpanIncluding(token_chars);

	string = string.Right(string.GetLength() - substring.GetLength());
	string.TrimLeft();
	string.TrimRight();

	return substring;
}
开发者ID:BackupTheBerlios,项目名称:iometer-svn,代码行数:40,代码来源:ICF_ifstream.cpp

示例4: distroyEdit

//销毁编辑框//
void COldConfigGraChiDlg::distroyEdit(CListCtrl *list, CEdit* distroyedit, int &Item, int &SubItem)
{
	CString strEditData;
	distroyedit->GetWindowText(strEditData);
	strEditData = strEditData.Trim();

	if (strEditData.IsEmpty())             //如果输入为空,则销毁编辑框//
	{
		distroyedit->DestroyWindow();
		if (m_vectConfigPara[Item].m_DefaultValue!=-3001)
		{
			m_vectConfigPara[Item].m_DefaultValue = -3001;
			m_bIsParaValueChange = true;
		}
		list->SetItemText(Item, 3, _T(""));
		return;
	}
	if (strEditData == strEditData.SpanIncluding(_T("0123456789.")))
	{
		float tempfloat = (float)_wtof(strEditData);
		strEditData.Format(_T("%.2f"), tempfloat);
		list->SetItemText(Item, 3, strEditData);                 //将修改写入列表框//
		if (tempfloat != m_vectConfigPara[Item].m_DefaultValue)  //判断值是否发生了变化//
		{
			m_vectConfigPara[Item].m_DefaultValue = tempfloat;    //将修改后的值存入容器//
			m_bIsParaValueChange = true;
		}
		
	}
	else
		AfxMessageBox(_T("非法操作,请输入数字!"));
	distroyedit->DestroyWindow();                          //销毁对象//
}
开发者ID:zhouyu0615,项目名称:Teaproducton-IMS-Modbus,代码行数:34,代码来源:OldConfigGraChiDlg.cpp

示例5: OnCreate

int CPopupEdit::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{	
	ASSERT(NULL != lpCreateStruct);

	if (-1 == CEdit::OnCreate(lpCreateStruct))
		return -1;

	if (m_bIsEmbeddedIntoListCtrl) {
		CWnd *Parent = GetParent();
		ASSERT_VALID(Parent);

		CFont *Font = Parent->GetFont();
		ASSERT_VALID(Font);

		SetFont(Font);
		SetWindowText(m_sInitText);
		SetFocus();

		CString Temp = m_sInitText.Right(1);
		if ((Temp.SpanIncluding("kKmMgG")).IsEmpty())
			SetSel(0, -1);
		else
			SetSel(0, m_sInitText.GetLength() - 1);
	}

	return 0;	
}
开发者ID:HPCKP,项目名称:gridengine,代码行数:27,代码来源:PopupEdit.cpp

示例6: Validate

bool CFloatEdit::Validate() {
    CString text;
    this->GetWindowTextA(text);
    text.Trim();
    // empty string
    if(text.IsEmpty()) {
        return false;
    }
    // there is at least one number
    if(text.FindOneOf("0123456789") == -1) {
        return false;
    }
    // character besides digits or period?
    if(text.SpanIncluding("0123456789.-") != text) {
        return false;
    }
    // minus sign is not only in the first spot. implies only one minus sign
    if(text.ReverseFind('-') > 0) {
        return false;
    }
    // more than one period?
    if(text.Remove('.') > 1) {
        return false;
    }
    return true;
}
开发者ID:fabulousfeng,项目名称:3DSSPP,代码行数:26,代码来源:FloatEdit.cpp

示例7: distroyEdit

//销毁编辑框//
void CNewConfigGraChiDlg::distroyEdit(CListCtrl *list, CEdit* distroyedit, int &Item, int &SubItem)
{
    CString strEditData;
    float tempfloat;
    int nTempData;
    distroyedit->GetWindowText(strEditData);
    strEditData = strEditData.Trim();
    if (strEditData.IsEmpty())             //如果输入为空,则销毁编辑框//
    {
        distroyedit->DestroyWindow();
        m_vectList2[Item].m_fSetValue = -3001;
        list->SetItemText(Item, 3, _T(""));
        return;
    }
    if (m_vectList2[Item].m_ValueType == 0 && (strEditData != _T("0") && strEditData != _T("1")))
    {
        AfxMessageBox(_T("非法操作,该参数值只能为“0”或“1”!"));
        distroyedit->DestroyWindow();                          //销毁对象//
        return;
    }
    if (strEditData == strEditData.SpanIncluding(_T("0123456789.")))
    {
        switch (m_vectList2[Item].m_ValueType)
        {
        case 0:
            if (strEditData==_T("0"))
            {
                m_vectList2[Item].m_fSetValue = 0;
                list->SetItemText(Item, 3, _T("0"));
            }
            else
            {
                m_vectList2[Item].m_fSetValue = 1;
                list->SetItemText(Item, 3, _T("1"));
            }
            break;
        case 1:
        case 2:
        case 3:
            nTempData = (float)_wtof(strEditData);
            m_vectList2[Item].m_fSetValue = nTempData;    //将修改后的值存入容器//
            strEditData.Format(_T("%d"), nTempData);
            list->SetItemText(Item, 3, strEditData);      //将修改写入列表框//
            break;
        case 4:
        case 5:
            tempfloat = (float)_wtof(strEditData);
            strEditData.Format(_T("%.2f"), tempfloat);
            list->SetItemText(Item, 3, strEditData);      //将修改写入列表框//
            m_vectList2[Item].m_fSetValue = tempfloat;    //将修改后的值存入容器//
            break;
        default:
            break;
        }
    }
    else
        AfxMessageBox(_T("非法操作,请输入数字!"));
    distroyedit->DestroyWindow();                          //销毁对象//
}
开发者ID:zhouyu0615,项目名称:TeaproductionIMS,代码行数:60,代码来源:NewConfigGraChiDlg.cpp

示例8: OnKillFocus

void CPopupEdit::OnKillFocus(CWnd* pNewWnd) 
{
	CEdit::OnKillFocus(pNewWnd);

	CString Text;
	GetWindowText(Text);

	if (Text != "INFINITY") {
		if (!atoi(Text)) {
			SetWindowText(m_sInitText);
			GetWindowText(Text);
		}

		Text.Format("%d", atoi(Text));

		CString Temp;
		GetWindowText(Temp);
		Temp = Temp.Right(1);
				
		if (!Temp.SpanIncluding("kKmMgG").IsEmpty())
			Text.Format("%s%s", LPCTSTR(Text), LPCTSTR(Temp));

		CString OldText;
		GetWindowText(OldText) ;
		if (GetModify() || OldText != Text)
			SetWindowText(Text);
	}

	if (m_bIsEmbeddedIntoListCtrl) {
		CWnd *Parent = GetParent();
		ASSERT_VALID(Parent);

		CString str;
		GetWindowText(str);

		LV_DISPINFO dispinfo;
		dispinfo.hdr.hwndFrom  = Parent->m_hWnd;
		dispinfo.hdr.idFrom    = GetDlgCtrlID();
		dispinfo.hdr.code      = LVN_ENDLABELEDIT;

		dispinfo.item.mask     = LVIF_TEXT;
		dispinfo.item.iItem    = m_iItem;
		dispinfo.item.iSubItem = m_iSubItem;

		if (m_bESC) {
			dispinfo.item.pszText    = NULL;
			dispinfo.item.cchTextMax = 0;
		}
		else {
			dispinfo.item.pszText    = const_cast<LPTSTR>((LPCTSTR) str);
			dispinfo.item.cchTextMax = str.GetLength();
		}

		CWnd *ParentParent = Parent->GetParent();
		ASSERT_VALID(ParentParent);
		ParentParent->SendMessage(WM_NOTIFY, Parent->GetDlgCtrlID(), LPARAM(&dispinfo));
		DestroyWindow();
	}
}
开发者ID:HPCKP,项目名称:gridengine,代码行数:59,代码来源:PopupEdit.cpp

示例9: IsValidFilename

//
// See if every character in the filename is a valid filename character.
//
BOOL CGalileoCmdLine::IsValidFilename(const CString & instring)
{
	const CString legal = "abcdefghijklmnopqrstuvwxyz1234567890_-=+!&%@#$.,;:'[]{}()\\ ";
	CString teststring = instring;

	teststring.MakeLower();

	return instring.GetLength() == teststring.SpanIncluding(legal).GetLength();
}
开发者ID:blusjune,项目名称:.bsrc,代码行数:12,代码来源:GalileoCmdLine.cpp

示例10: distroyEdit

//销毁编辑框//
void CNewConfigGraChiDlg::distroyEdit(CListCtrl *list, CEdit* distroyedit, int &Item, int &SubItem)
{
	CString strEditData;
	distroyedit->GetWindowText(strEditData);
	strEditData = strEditData.Trim();
	if (strEditData.IsEmpty())             //如果输入为空,则销毁编辑框//
	{
		distroyedit->DestroyWindow();
		m_vectList2[Item].m_fSetValue = -3001;
		list->SetItemText(Item, 3, _T(""));
		return;
	}
	if (strEditData == strEditData.SpanIncluding(_T("0123456789.")))
	{
		list->SetItemText(Item, 3, strEditData);      //将修改写入列表框//
		float tempfloat = (float)_wtof(strEditData);
		m_vectList2[Item].m_fSetValue = tempfloat;    //将修改后的值存入容器//
	}
	else
		AfxMessageBox(_T("非法操作,请输入数字!"));
	distroyedit->DestroyWindow();                          //销毁对象//
}
开发者ID:zhouyu0615,项目名称:Teaproducton-IMS-Modbus,代码行数:23,代码来源:NewConfigGraChiDlg.cpp

示例11: distroyEdit

void CDeviceChiDlg::distroyEdit(CListCtrl *list, CEdit* distroyedit, int &Item, int &SubItem)
{
	CString strEditData;
	distroyedit->GetWindowText(strEditData);
	strEditData = strEditData.Trim();
	if (strEditData.IsEmpty())             //如果输入为空,则销毁编辑框//
	{
		AfxMessageBox(_T("非法操作,输入不能为空!"));
		distroyedit->DestroyWindow();
		return;
	}
	if (strEditData == strEditData.SpanIncluding(_T("0123456789.")))
	{
		if(IDYES==MessageBox(_T("是否保存该修改?"), _T("提示"), MB_ICONQUESTION | MB_YESNO))
		{
			list->SetItemText(Item, 4, strEditData);      //将修改写入列表框//
			//待添加,将修改写入PLC//

		}
	}             
	else
		AfxMessageBox(_T("非法操作,请输入数字!"));
	distroyedit->DestroyWindow();                          //销毁对象//
}
开发者ID:zhouyu0615,项目名称:Teaproducton-IMS-Modbus,代码行数:24,代码来源:DeviceChiDlg.cpp

示例12: IsValidInteger

//
// See if every character in the filename is valid as part of an integer.
//
BOOL CGalileoCmdLine::IsValidInteger(const CString & instring)
{
	const CString legal = "1234567890";

	return instring.GetLength() == instring.SpanIncluding(legal).GetLength();
}
开发者ID:blusjune,项目名称:.bsrc,代码行数:9,代码来源:GalileoCmdLine.cpp

示例13: distroyEdit

//销毁编辑框//
void COldConfigGraChiDlg::distroyEdit(CListCtrl *list, CEdit* distroyedit, int &Item, int &SubItem)
{
    CString strEditData;
    float tempfloat;
    int tempValue;
    distroyedit->GetWindowText(strEditData);
    strEditData = strEditData.Trim();
    int nDataType = m_pDataProvider->searchModuleParaType(m_vectConfigPara[Item].m_ProcessParaId);
    if (strEditData.IsEmpty())             //如果输入为空,则销毁编辑框//
    {
        distroyedit->DestroyWindow();
        if (m_vectConfigPara[Item].m_DefaultValue!=-3001)
        {
            m_vectConfigPara[Item].m_DefaultValue = -3001;
            m_bIsParaValueChange = true;
        }
        list->SetItemText(Item, 3, _T(""));
        return;
    }
    if ( nDataType== 0 && (strEditData != _T("0") && strEditData != _T("1")))
    {
        AfxMessageBox(_T("非法操作,该参数值只能为“0”或“1”!"));
        distroyedit->DestroyWindow();                          //销毁对象//
        return;
    }

    if (strEditData == strEditData.SpanIncluding(_T("0123456789.")))
    {
        switch (nDataType)
        {
        case 0:
            if (strEditData == _T("0"))
            {
                list->SetItemText(Item, 3, _T("0"));                 //将修改写入列表框//
                if (m_vectConfigPara[Item].m_DefaultValue != 0)
                {
                    m_vectConfigPara[Item].m_DefaultValue = 0;
                    m_bIsParaValueChange = true;
                }
            }
            else
            {
                list->SetItemText(Item, 3, _T("1"));                 //将修改写入列表框//
                if (m_vectConfigPara[Item].m_DefaultValue != 1)
                {
                    m_vectConfigPara[Item].m_DefaultValue = 1;
                    m_bIsParaValueChange = true;
                }
            }
            break;
        case 1:
        case 2:
        case 3:
            tempValue = (float)_wtof(strEditData);
            strEditData.Format(_T("%d"), tempValue);
            list->SetItemText(Item, 3, strEditData);
            if (tempValue != ((int)m_vectConfigPara[Item].m_DefaultValue))
            {
                m_vectConfigPara[Item].m_DefaultValue = tempValue;
                m_bIsParaValueChange = true;
            }
            break;
        case 4:
        case 5:
            tempfloat = (float)_wtof(strEditData);
            strEditData.Format(_T("%.2f"), tempfloat);
            list->SetItemText(Item, 3, strEditData);
            if (tempfloat != m_vectConfigPara[Item].m_DefaultValue)  //判断值是否发生了变化//
            {
                m_vectConfigPara[Item].m_DefaultValue = tempfloat;    //将修改后的值存入容器//
                m_bIsParaValueChange = true;
            }
            break;
        default:
            break;
        }
    }
    else
        AfxMessageBox(_T("非法操作,请输入数字!"));
    distroyedit->DestroyWindow();                          //销毁对象//
}
开发者ID:zhouyu0615,项目名称:TeaproductionIMS,代码行数:82,代码来源:OldConfigGraChiDlg.cpp

示例14: OnBnClickedBtbSave

void CDialog_Check::OnBnClickedBtbSave()
{
	// TODO: 在此添加控件通知处理程序代码
	m_date.m_material = m_allMaterial.at(m_mName_ctrl.GetCurSel());
	if(m_date.m_material.GetId().empty())
	{
		CRuntimeMessageBox::RunMessageBox("请选择正确的材料");

		return;
	}
	CString tmp;
	m_mNum_ctrl.GetWindowText(tmp);
	if(tmp.IsEmpty() || tmp.SpanIncluding(_T("1234567890")) != tmp)
	{
		CRuntimeMessageBox::RunMessageBox("请输入正确的数目!");

		return;
	}
	else
	{
		m_date.m_num = atoi((const char *)tmp.GetBuffer(tmp.GetLength()));
		double price = atof(m_dateChange.CStringtostring(m_date.m_material.m_price).c_str());
		tmp.Format(_T("%.2lf"),m_date.m_num * price);
		m_total_ctrl.SetWindowText(tmp);
		m_date.m_total = price;
	}
	m_wName_ctrl.GetWindowText(m_date.m_operateWare);
	if(m_date.m_operateWare.IsEmpty())
	{
		CRuntimeMessageBox::RunMessageBox("请输入正确的仓库");

		return;
	}

	m_date.m_class = m_allClass.at(m_cName_ctrl.GetCurSel());
	if(m_date.m_class.GetId().empty())
	{
		CRuntimeMessageBox::RunMessageBox("请选择正确的部门名称");

		return;
	}
	m_date.m_userInfo = m_allUser.at(m_pName_ctrl.GetCurSel());
	if(m_date.m_userInfo.GetId().empty())
	{
		if(m_checkModal)
			CRuntimeMessageBox::RunMessageBox("请输入正确的入库人员");
		else
			CRuntimeMessageBox::RunMessageBox("请输入正确的出库人员");

		return;
	}
	m_telPhone_ctrl.GetWindowText(m_date.m_tellPhone);
	if(m_date.m_tellPhone.IsEmpty())
	{
		CRuntimeMessageBox::RunMessageBox("请输入正确的电话号码");

		return;
	}
	m_detail_ctrl.GetWindowText(m_date.m_detail);

	m_date.m_checkModal = m_checkModal;

	CControl_check tmpc;

	int haveNum = tmpc.VerCheckMaterial(m_date.m_material.GetId()) ;
	if( !m_checkModal && haveNum < m_date.m_num)
	{
		CRuntimeMessageBox::RunMessageBox("保存失败:此材料库存不足,无法出库!");

		return;
	}
	else if( !m_checkModal)
	{
		m_date.m_num -= haveNum;
	}
	else
	{
		m_date.m_num += haveNum;
	}

	tmpc.SetData(&m_date);
	if (tmpc.Save())
	{
		CRuntimeMessageBox::RunMessageBox("保存成功!");

		OnOK();
	}
	else
	{
		CRuntimeMessageBox::RunMessageBox("保存失败!");
	}
}
开发者ID:uwitec,项目名称:wavehouser,代码行数:92,代码来源:CDialog_Check.cpp

示例15: OnGetControl

LRESULT CObjectProperty::OnGetControl (WPARAM wParam, LPARAM lParam )
{


    sItem* pEdit = ( sItem* ) lParam;

    if ( pEdit->iGroup >= (int)m_pGroups.size ( ) )
        return 0;

    CBCGProp*  pProp = m_pGroups [ pEdit->iGroup ].pProperty;

    if ( !pProp )
        return 0;

    if ( pEdit->iControl >= pProp->GetSubItemsCount() )
        return 0;

    CBCGProp* pControl = pProp->GetSubItem ( pEdit->iControl );

    if ( !pControl )
        return 0;

    if ( wParam == 0 )
    {
        // name
        pEdit->name = pControl->m_strName;
    }
    else if ( wParam == 1 )
    {
        CString string = ( LPCTSTR ) ( _bstr_t ) pControl->m_varValue;

        // contents
        pEdit->contents = string;

        if ( pControl->IsKindOf ( RUNTIME_CLASS ( CBCGColorProp ) ) )
        {
            CBCGColorProp* pColor = ( CBCGColorProp* ) pControl;

            COLORREF color = pColor->GetColor ( );

            TCHAR test [ 256 ] = _T("");

            int iRed   = GetRValue ( color );
            int iGreen = GetGValue ( color );
            int iBlue  = GetBValue ( color );

            wsprintf ( test, _T ( "%d %d %d" ),iRed, iGreen, iBlue );

            pEdit->contents = test;
        }

        else if ( pControl->IsKindOf ( RUNTIME_CLASS ( CBCGFileProp ) ) )
        {

            CBCGFileProp* pFileEx = ( CBCGFileProp* ) pControl;

            char szContentsANSI [ 255 ]	= "";
            char szDirANSI      [ 255 ]	= "";
            char szExcludeANSI  [ 255 ]	= "";

            CString a = string.SpanIncluding( pControl->m_FPSCDir );

            if ( a.GetLength ( ) >= pControl->m_FPSCDir.GetLength ( ) )
            {


                int a =  pControl->m_FPSCDir.GetLength ( );
                int b =  string.GetLength ( );

                CString strBang = string.Right( b - a );


                ConvertWideToANSI ( NULL, &string,              szContentsANSI );
                ConvertWideToANSI ( NULL, &pControl->m_FPSCDir, szDirANSI );
                ConvertWideToANSI ( NULL, &strBang, szExcludeANSI );

                int c = 0;

                //if ( !strBang.IsEmpty ( ) )
                {
                    pControl->SetValue((_variant_t)strBang);
                }


                pEdit->contents = strBang;

            }
        }

    }
    else if ( wParam == 2 )
    {
        // description
        pEdit->description = pControl->m_strDescr;
    }
    else
    {
        // failure
    }
    return 0;
//.........这里部分代码省略.........
开发者ID:LeeBamberTGC,项目名称:FPS-Creator-Classic,代码行数:101,代码来源:ObjectProperty.cpp


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