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


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

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


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

示例1: OnChangeModparamsSaveLoc

void CHHMRModParam::OnChangeModparamsSaveLoc() 
{
	CString Text;
	GetDlgItemText(IDC_HHMRMODPARAMS_SAVELOC,Text);
	if (!Text.IsEmpty())
	{
		int posStart, posEnd;
		((CEdit*)GetDlgItem(IDC_HHMRMODPARAMS_SAVELOC))->GetSel(posStart,posEnd);
		if (Text.FindOneOf(INVALIDCHARSSUB) != -1)
		{
			((CEdit*)GetDlgItem(IDC_HHMRMODPARAMS_SAVELOC))->Undo();
			posStart--;
			posEnd--;
		}
		((CEdit*)GetDlgItem(IDC_HHMRMODPARAMS_SAVELOC))->SetModify(FALSE);
		((CEdit*)GetDlgItem(IDC_HHMRMODPARAMS_SAVELOC))->EmptyUndoBuffer();
		((CEdit*)GetDlgItem(IDC_HHMRMODPARAMS_SAVELOC))->SetSel(posStart,posEnd);
	}

	if (m_pPS)m_pPS->SetToClose(0);

	if (!m_bCollectingParametersForNewISO)
	{
		m_bChange = true;
		m_pApplyButton->EnableWindow(TRUE);
	}
}
开发者ID:hnordquist,项目名称:MIC,代码行数:27,代码来源:HHMRModParam.cpp

示例2: 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

示例3: DoSave

BOOL CDocument::DoSave(LPCTSTR lpszPathName, BOOL bReplace)
	// Save the document data to a file
	// lpszPathName = path name where to save document file
	// if lpszPathName is NULL then the user will be prompted (SaveAs)
	// note: lpszPathName can be different than 'm_strPathName'
	// if 'bReplace' is TRUE will change file name if successful (SaveAs)
	// if 'bReplace' is FALSE will not change path name (SaveCopyAs)
{
	CString newName = lpszPathName;
	if (newName.IsEmpty())
	{
		CDocTemplate* pTemplate = GetDocTemplate();
		ASSERT(pTemplate != NULL);

		newName = m_strPathName;
		if (bReplace && newName.IsEmpty())
		{
			newName = m_strTitle;
			// check for dubious filename
			int iBad = newName.FindOneOf(_T(":/\\"));
			if (iBad != -1)
				newName.ReleaseBuffer(iBad);

			// append the default suffix if there is one
			CString strExt;
			if (pTemplate->GetDocString(strExt, CDocTemplate::filterExt) &&
			  !strExt.IsEmpty())
			{
				ASSERT(strExt[0] == '.');
				int iStart = 0;
				newName += strExt.Tokenize(_T(";"), iStart);
			}
		}

		if (!AfxGetApp()->DoPromptFileName(newName,
		  bReplace ? AFX_IDS_SAVEFILE : AFX_IDS_SAVEFILECOPY,
		  OFN_HIDEREADONLY | OFN_PATHMUSTEXIST, FALSE, pTemplate))
			return FALSE;       // don't even attempt to save
	}

	CWaitCursor wait;

	if (!OnSaveDocument(newName))
	{
		if (lpszPathName == NULL)
		{
			// be sure to delete the file
			TRY
			{
				CFile::Remove(newName);
			}
			CATCH_ALL(e)
			{
				TRACE(traceAppMsg, 0, "Warning: failed to delete file after failed SaveAs.\n");
				DELETE_EXCEPTION(e);
			}
			END_CATCH_ALL
		}
		return FALSE;
	}
开发者ID:pixelspark,项目名称:corespark,代码行数:60,代码来源:doccore.cpp

示例4: SplitString

static void SplitString(const CString & str, CMediaInfoList & list)
{
  int tokenPos = 0;
  CString token;
  while (!(token = str.Tokenize(L"\n", tokenPos)).IsEmpty()) {
    CMediaInfo info;

    int colon = token.Find(':');
    if (colon < 0)
      info = token;
    else {
      info = token.Left(colon);

      int equal = token.FindOneOf(L"#=");
      if (equal < 0)
        info.m_options[token.Mid(colon+1)] = CMediaInfo::OptionInfo();
      else
        info.m_options[token.Mid(colon+1, equal-colon-1)] = CMediaInfo::OptionInfo(token.Mid(equal+1), token[equal] == '#');
    }

    CMediaInfoList::iterator iter = std::find(list.begin(), list.end(), info);
    if (iter == list.end())
      list.push_back(info);
    else if (!info.m_options.empty())
      iter->m_options[info.m_options.begin()->first] = info.m_options.begin()->second;
  }
}
开发者ID:Binauric,项目名称:opal,代码行数:27,代码来源:OptionsCodecs.cpp

示例5: ValidateProfileName

// Static Routines
static void ValidateProfileName(const CString& profileName, CDataExchange* pDX)
{
    USES_CONVERSION;

    nsresult rv;
    PRBool exists = FALSE;

    {
        nsCOMPtr<nsIProfile> profileService = 
                 do_GetService(NS_PROFILE_CONTRACTID, &rv);
        rv = profileService->ProfileExists(T2CW(profileName), &exists);
    }

    if (NS_SUCCEEDED(rv) && exists)
    {
        CString errMsg;
        errMsg.Format(_T("Error: A profile named \"%s\" already exists."), profileName);
        AfxMessageBox( errMsg, MB_ICONEXCLAMATION );
        errMsg.Empty();
        pDX->Fail();
    }

    if (profileName.FindOneOf(_T("\\/")) != -1)
    {
        AfxMessageBox( _T("Error: A profile name cannot contain the characters \"\\\" or \"/\"."), MB_ICONEXCLAMATION );
        pDX->Fail();
    }
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:29,代码来源:ProfilesDlg.cpp

示例6: Compare

//************************************************************************************
BOOL CBCGPOutlineParser::Compare (const CString& strBuffer, const int nBufferOffset,
								  const CString& strCompareWith, int& nEndOffset) const
{
	// Returns equal chars num:
	const int nLength = strCompareWith.GetLength ();
	const int nBufLength = strBuffer.GetLength ();
	int i = 0;

	for (i = 0; i < nLength && nBufferOffset + i < nBufLength; i++)
	{
		if (m_bCaseSensitive ? 
			(strCompareWith [i] != strBuffer [nBufferOffset + i]) :
			(_tcsnicmp (((LPCTSTR) strCompareWith) + i, 
						((LPCTSTR) strBuffer) + nBufferOffset + i, 1) != 0))
		{
			nEndOffset = nBufferOffset;
			return FALSE;
		}
	}

	if (m_bWholeWords && strCompareWith.FindOneOf (m_strDelimiters) == -1)
	{
		if ((nBufferOffset > 0 &&
			 m_strDelimiters.Find (strBuffer [nBufferOffset - 1]) == -1) ||
			(nBufferOffset + i < nBufLength &&
			 m_strDelimiters.Find (strBuffer [nBufferOffset + i]) == -1))
		{
			nEndOffset = nBufferOffset;
			return FALSE;
		}
	}

	nEndOffset = nBufferOffset + i - 1;
	return (i > 0) && (i == nLength);
}
开发者ID:cugxiangzhenwei,项目名称:WorkPlatForm,代码行数:36,代码来源:BCGPOutlineParser.cpp

示例7: 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

示例8: get_attr

// Get a attribute value from an attribute name
bool CNetList::get_attr( int file_name_index, int sheet, CNetListSymbol &symbol, CString attr, CString &r )
{
	CDrawMethod* pMethod = symbol.m_pMethod;
	if (attr.CompareNoCase( _T("refnum") ) == 0)
	{
		// Use the reference number (minus the reference character)
		CString s = pMethod->GetRefSheet(m_prefix_references,m_prefix_import,file_name_index,sheet+1);
		int b = s.FindOneOf(_T("0123456789"));
		if (b != 1)
		{
			r = s;
			return true;
		}
		else
		{
			r = s.Mid(b);
			return true;
		}
	}
	else
	{
		for (int j = 0; j < pMethod->GetFieldCount(); j++)
		{
			if (pMethod->GetFieldName(j).CompareNoCase(attr) == 0)
			{
				r = pMethod->GetField(j);
				return true;
			}
		}
	}

	return false;
}
开发者ID:saranyan,项目名称:tinycad_graph_matching,代码行数:34,代码来源:NetList.cpp

示例9: ExamineArchive

//=========================================================
// DTVの可能性のあるファイルかどうか直接確認する
//=========================================================
bool CArchiverJACK::ExamineArchive(LPCTSTR ArcFileName,CConfigManager& ConfMan,bool,bool &bInFolder,bool &bSafeArchive,CString &BaseDir,CString &strErr)
{
	bInFolder=false;
	bSafeArchive=false;

	CString strFileName;

	//ファイルを読んで格納ファイル名を取得
	if(!GetContainedFileName(ArcFileName,strFileName))return false;
	if(-1==strFileName.FindOneOf(_T(":\\/"))){//パス指定の文字が含まれていないので安全
		bSafeArchive=true;
	}

/*
	このコードでは解凍するファイル、一つしかファイル内容を確認していない。
	これでも問題がない理由は、JACK32.dllは展開時に出力ファイル名の一貫性をチェックしている模様だからである。
	[流れ]
	・n-1番目までのファイルには細工がされていない
		・n番目のファイルも細工されていない
			→正常解凍、n++
		・n番目のファイルが細工されている
			・n-1番目までのファイルをLhaForgeに与えた
				→安全だとして解凍を始めたものの、JAKの同一性チェックにかかる
			・n番目のファイルをLhaForgeに与えた
				→LhaForgeのDTVチェックにかかる

	[注意点]
	現在のコードでは、上書き確認機能を使うとき、同じJAKファイルを2回読むことになる。
	効率を求めるなら、ここのコードを無効化して、Extract()内部で安全かどうかチェックするようにすればよい。
	いまのところは、効率よりも見通しの良さを優先している。
*/

	return true;
}
开发者ID:Claybird,项目名称:lhaforge,代码行数:37,代码来源:ArchiverJACK.cpp

示例10: GetString

/// Funktion gibt einen String zurück, der in einer StringTable steht.
CString CLoc::GetString(const CString& key, BOOLEAN forceBigStarting, const CString& subString1, const CString& subString2)
{
	CString returnString;
	if (!m_StringTable.Lookup(key, returnString))
		return key + " is missing";

	// Haben wir subStrings übergeben, so müssen wir die § Zeichen ersetzen
	if (subString1 != "")
	{
		// hier ein bisl umständlich, aber sonst würde er alle "§" Zeichen ersetzen
		int pos = returnString.FindOneOf("§");
		if (pos != -1)
		{
			returnString.Delete(pos);
			returnString.Insert(pos,subString1);
			if (subString2 != "")
				returnString.Replace("§",subString2);
		}
	}
	if (forceBigStarting)
	{
		CString upper = (CString)returnString.GetAt(0);
		returnString.SetAt(0, upper.MakeUpper().GetAt(0));
	}
	return returnString;
}
开发者ID:IcyX,项目名称:bote,代码行数:27,代码来源:Loc.cpp

示例11: 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

示例12: DataIntegrateForCheck

PRGINTERFACE_API void  DataIntegrateForCheck(CMapStringToString &mstr, int indexmax, bool colormark)
{
	CString perrecord;
	CString jherr("");
	int ipos = indexmax;

	zero = 0.0;
	if(mstr.Lookup(_T("Z19"),perrecord) && (perrecord.FindOneOf("0123456789") >= 0)){
		zero = atof(perrecord);
	}
	z14 = 0;
	if(mstr.Lookup(_T("Z14"),perrecord) && (perrecord.FindOneOf("0123456789") >= 0)){
		z14 = atoi(perrecord);
	}
	while(ipos-- > 0)
	{
		CString sid;
		double accuracy;
		sid.Format("Z%d",ipos);
		if(mstr.Lookup(sid,perrecord) && (perrecord.FindOneOf("0123456789") >= 0))
		{
			if(perrecord.Find("--") >= 0)
				continue;
			sid.Format("jhsel%d",INDEX2GROUP(ipos));
			if(!mstr.Lookup(sid,sid) || (sid.FindOneOf("0123456789") < 0) )		continue;//retrieve the jhsel
						
			accuracy = atof(sid)/100.0;
			
			int iid = CheckPrecious(sid);
			if(iid < 0)		continue;//translate the jhsel//translate the jhsel
			perrecord = DataIntergrate(ipos,atof(perrecord),g_PrecBase[iid].iDigipos-2,g_PrecBase[iid].iMantissa);
			if((!CheckData(ipos,atof(perrecord),accuracy)))
			{
				//add the a message to the error
				CString stmp;
				stmp.Format("%s盘第%d点不合格;\n",Panhao[INDEX2GROUP(ipos)],INDEX2REST(ipos));
				jherr += stmp;
				if(colormark)
					perrecord = "<font color='red'>"+perrecord+"</font>";
			}
			sid.Format("Z%d",ipos);
			mstr.SetAt(sid,perrecord);
		}

	}
	mstr.SetAt("jdjg",jherr);//检定结果
}
开发者ID:Biotron,项目名称:kpgweigher,代码行数:47,代码来源:PrgInterface3.cpp

示例13: DoSave

BOOL CKSFileDialog::DoSave(LPCTSTR lpszPathName, BOOL bReplace)
{
	if (m_pDoc==NULL){ASSERT (FALSE);return FALSE;}
	CString newName = lpszPathName;
	if (newName.IsEmpty())
	{
		CDocTemplate* pTemplate = m_pDoc->GetDocTemplate();
		ASSERT(pTemplate != NULL);

		newName = m_pDoc->GetPathName();
		if (bReplace && newName.IsEmpty())
		{
			newName = m_pDoc->GetTitle();
			// check for dubious filename
			int iBad = newName.FindOneOf(_T(" #%;/\\"));
			if (iBad != -1)
				newName.ReleaseBuffer(iBad);

			// append the default suffix if there is one
			CString strExt;
			if (pTemplate->GetDocString(strExt, CDocTemplate::filterExt) &&
			  !strExt.IsEmpty())
			{
				ASSERT(strExt[0] == '.');
				newName += strExt;
			}
		}

		if (DoPromptFileName(newName,bReplace ? AFX_IDS_SAVEFILE : AFX_IDS_SAVEFILECOPY,
		  OFN_HIDEREADONLY | OFN_PATHMUSTEXIST, FALSE, pTemplate))
			return FALSE;       // don't even attempt to save
	}

	CWaitCursor wait;

	if (!m_pDoc->OnSaveDocument(newName))
	{
		if (lpszPathName == NULL)
		{
			// be sure to delete the file
			try
			{
				CFile::Remove(newName);
			}
			catch( CException * e)
			{
				TRACE0("Warning: failed to delete file after failed SaveAs.\n");
				do { e->Delete(); } while (0);
			}
		}
		return FALSE;
	}

	// reset the title and change the document name
	if (bReplace)
		m_pDoc->SetPathName(newName);

	return TRUE;        // success
}
开发者ID:amikey,项目名称:tradingstrategyking,代码行数:59,代码来源:XFDialog.cpp

示例14: SearchFiles

static bool SearchFiles(CString mask, CAtlList<CString>& sl)
{
    if (mask.Find(_T("://")) >= 0) {
        return false;
    }

    mask.Trim();
    sl.RemoveAll();

    CMediaFormats& mf = AfxGetAppSettings().m_Formats;

    WIN32_FILE_ATTRIBUTE_DATA fad;
    bool fFilterKnownExts = (GetFileAttributesEx(mask, GetFileExInfoStandard, &fad)
                             && (fad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY));
    if (fFilterKnownExts) {
        mask = CString(mask).TrimRight(_T("\\/")) + _T("\\*.*");
    }

    {
        CString dir = mask.Left(max(mask.ReverseFind('\\'), mask.ReverseFind('/')) + 1);

        WIN32_FIND_DATA fd;
        HANDLE h = FindFirstFile(mask, &fd);
        if (h != INVALID_HANDLE_VALUE) {
            do {
                if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
                    continue;
                }

                CString fn = fd.cFileName;
                //CString ext = fn.Mid(fn.ReverseFind('.')+1).MakeLower();
                CString ext = fn.Mid(fn.ReverseFind('.')).MakeLower();
                CString path = dir + fd.cFileName;

                if (!fFilterKnownExts || mf.FindExt(ext)) {
                    for (size_t i = 0; i < mf.GetCount(); i++) {
                        CMediaFormatCategory& mfc = mf.GetAt(i);
                        /* playlist files are skipped when playing the contents of an entire directory */
                        if ((mfc.FindExt(ext)) && (mf[i].GetLabel().CompareNoCase(_T("pls")) != 0)) {
                            sl.AddTail(path);
                            break;
                        }
                    }
                }

            } while (FindNextFile(h, &fd));

            FindClose(h);

            if (sl.GetCount() == 0 && mask.Find(_T(":\\")) == 1) {
                GetCDROMType(mask[0], sl);
            }
        }
    }

    return (sl.GetCount() > 1
            || sl.GetCount() == 1 && sl.GetHead().CompareNoCase(mask)
            || sl.GetCount() == 0 && mask.FindOneOf(_T("?*")) >= 0);
}
开发者ID:Azpidatziak,项目名称:mpc-hc,代码行数:59,代码来源:PlayerPlaylistBar.cpp

示例15: GetAttribute

CString CSimpleSAH::GetAttribute(LPCSTR lpAttriName)
{
	CString tmp;
	CString tag(strCurTagBuf);
	tag.MakeLower();
	CString attri(lpAttriName);
	attri.MakeLower();

	try{

	CString s;
	int i=0, j=0;
	BOOL found = FALSE;
	while(!found)
	{
		i = tag.Find(attri, i);
		if(i<0)
			break;

		j = tag.Find('=', i);
		s = tag.Mid(i+attri.GetLength(), j-i-attri.GetLength());
		s.TrimLeft();
		if(s.IsEmpty())
		{
			found=TRUE;
			tmp = strCurTagBuf.Mid(j+1);
			if(tmp.GetAt(0) == '\"' || tmp.GetAt(0) == '\'') //quoted string
			{
				tmp = tmp.Right(tmp.GetLength()-1);
				i = tmp.FindOneOf("\'\"\r\n>");
			}
			else
				i = tmp.FindOneOf(" \r\n>\'\"");
			tmp = tmp.Left(i);
			tmp.TrimLeft();
			tmp.TrimRight();
		}
		i += attri.GetLength();
	}
	}
	catch(...)
	{
	}

	return tmp;
}
开发者ID:vicentdsmin,项目名称:myie,代码行数:46,代码来源:SimpleSAH.cpp


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