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


C++ tstring::find_first_of方法代码示例

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


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

示例1: ParseLink

bool CDDELink::ParseLink(const tstring& link, tstring& service, tstring& topic, tstring& item)
{
	size_t serviceBegin = 0;
	size_t serviceEnd = link.find_first_of('|', serviceBegin);

	if ( (serviceEnd == tstring::npos) || (serviceEnd == serviceBegin) )
		return false;

	size_t topicBegin = serviceEnd + 1;
	size_t topicEnd = link.find_first_of('!', topicBegin);

	if ( (topicEnd == tstring::npos) || (topicEnd == topicBegin) )
		return false;

	size_t itemBegin = topicEnd + 1;
	size_t itemEnd = link.length();

	if (itemEnd == itemBegin)
		return false;

	service = link.substr(serviceBegin, serviceEnd - serviceBegin);
	topic   = link.substr(topicBegin,   topicEnd   - topicBegin);
	item    = link.substr(itemBegin,    itemEnd    - itemBegin);

	ASSERT(service.length() != 0);
	ASSERT(topic.length() != 0);
	ASSERT(item.length() != 0);

	return true;
}
开发者ID:chrisoldwood,项目名称:NCL,代码行数:30,代码来源:DDELink.cpp

示例2: Tokenize

void Tokenize( const tstring& str, std::vector< T >& tokens, const tstring& delimiters )
{
    // Skip delimiters at beginning.
    tstring::size_type lastPos = str.find_first_not_of( delimiters, 0 );
    // Find first "non-delimiter".
    tstring::size_type pos     = str.find_first_of( delimiters, lastPos );

    I temp;
    while ( tstring::npos != pos || tstring::npos != lastPos )
    {
        // Found a token, convert it to the proper type for our vector
        tstringstream stream (str.substr( lastPos, pos - lastPos ));
        stream >> temp; // NOTE: Stream operator stops at spaces!
        if ( !stream.fail() )
        {
            // Add the token to the vector
            tokens.push_back( (T)temp );
        }
        else
        {
            HELIUM_BREAK();
        }
        // Skip delimiters.  Note the "not_of"
        lastPos = str.find_first_not_of( delimiters, pos );
        // Find next "non-delimiter"
        pos = str.find_first_of( delimiters, lastPos );
    }
}
开发者ID:,项目名称:,代码行数:28,代码来源:

示例3: parseBool

// -----------------------------------------------------------------------------------------
bool CPepeEngineConverter::parseBool(const tstring& str)
{
    if (
        (str.find_first_of(_T("true")) == 0) ||
        (str.find_first_of(_T("yes")) == 0) ||
        (str.find_first_of(_T("1")) == 0)
    ) {
        return true;
    } else {
        return false;
    }
}
开发者ID:pepewuzzhere,项目名称:PepeEngine,代码行数:13,代码来源:CPepeEngineConverter.cpp

示例4: ensureDirectory

void File::ensureDirectory(const tstring& aFile) noexcept
{
	dcassert(!aFile.empty());
	// Skip the first dir...
	tstring::size_type start = aFile.find_first_of(_T("\\/"));
	if (start == tstring::npos)
		return;
	start++;
	while ((start = aFile.find_first_of(_T("\\/"), start)) != tstring::npos)
	{
		::CreateDirectory((formatPath(aFile.substr(0, start + 1))).c_str(), NULL); //TODO Crash r501 sp1
		start++;
	}
}
开发者ID:snarkus,项目名称:flylinkdc-r5xx,代码行数:14,代码来源:File.cpp

示例5: exclude

void dir_reader::exclude(const tstring& spec) {
  if (spec.find_first_of(_T("?*")) != tstring::npos) {
    m_wildcard_excluded.insert(spec);
  } else {
    m_excluded.insert(spec);
  }
}
开发者ID:kichik,项目名称:nsis,代码行数:7,代码来源:dirreader.cpp

示例6:

CTokenizer::CTokenizer(const tstring& p_Str, const tstring& p_Delimiters)
{
	const tstring::size_type len = p_Str.length();
	tstring::size_type i = 0;

	while(i < len)
	{
		// eat leading whitespace
		i = p_Str.find_first_not_of(p_Delimiters, i);
		if(i == tstring::npos)
			return;   // nothing left but white space

		// find the end of the token
		tstring::size_type j = p_Str.find_first_of(p_Delimiters, i);

		// push token
		if(j == tstring::npos) 
		{
			m_Tokens.push_back(p_Str.substr(i));
			return;
		} else
			m_Tokens.push_back(p_Str.substr(i, j - i));

		// set up for next loop
		i = j + 1;
	}
}
开发者ID:Ocerus,项目名称:Ocerus,代码行数:27,代码来源:Utils.cpp

示例7: CreateDirectory

    bool CreateDirectory(const tstring& path)
    {
        size_t  pos   = 0;
        int     index = 0;
        tstring subPath;

        while((pos = path.find_first_of(_T("\\/"), pos)) != tstring::npos)
        {
            index++;
            pos++;
            if (index == 1)
            {
                continue;
            }
            subPath = path.substr(0, pos - 1);
            if (!DirectoryExists(subPath))
            {
                if (::CreateDirectory(subPath.c_str(), NULL) == FALSE)
                {
                    return false;
                }
            }
        }
        if (!DirectoryExists(path))
        {
            return ::CreateDirectory(path.c_str(), NULL) != FALSE;
        }
        return true;
    }
开发者ID:yellowbigbird,项目名称:bird-self-lib,代码行数:29,代码来源:UtilsFile.cpp

示例8: hkSession

RegWrap::RegWrap( const tstring& sKey, REGSAM samDesired ) :
    hkSession( 0 )
{
    // Parse the key

    unsigned long iFirstSlash = sKey.find_first_of( _T("\\") );

    if ( iFirstSlash == tstring::npos )
        return;

    tstring sRootKey = sKey.substr( 0, iFirstSlash );
    tstring sSubKey = sKey.substr( iFirstSlash+1 );

    // Get the root key by its name

    HKEY hRootKey = (HKEY)-1;

    for ( unsigned long i = 0; rkam[i].szName != 0; ++i )
        if ( sRootKey == rkam[i].szName )
            hRootKey = rkam[i].hRootKey;

    if ( hRootKey == (HKEY)-1 )
        return;

    Init( hRootKey, sSubKey, samDesired );
}
开发者ID:mspline,项目名称:farvcs,代码行数:26,代码来源:regwrap.cpp

示例9: while

inline void Tokenize<tstring, tstring>( const tstring& str, std::vector< tstring >& tokens, const tstring& delimiters )
{
    // Skip delimiters at beginning.
    tstring::size_type lastPos = str.find_first_not_of( delimiters, 0 );
    // Find first "non-delimiter".
    tstring::size_type pos     = str.find_first_of( delimiters, lastPos );

    while ( tstring::npos != pos || tstring::npos != lastPos )
    {
        // Add the token to the vector
        tokens.push_back( str.substr( lastPos, pos - lastPos ) );
        // Skip delimiters.  Note the "not_of"
        lastPos = str.find_first_not_of( delimiters, pos );
        // Find next "non-delimiter"
        pos = str.find_first_of( delimiters, lastPos );
    }
}
开发者ID:,项目名称:,代码行数:17,代码来源:

示例10: ShowPm

void PopupManager::ShowPm(const tstring& nick, const tstring& msg, HWND owner){
	int pos = msg.find_first_of(_T(">"))+1;
	if(pos == tstring::npos )
		pos = 0;

	tstring s = TSTRING(POPUP_NEW_PM) + _T(" ") + nick + _T(" ") + TSTRING(POPUP_MSG) + msg.substr(pos);
	Show(s, owner);
}
开发者ID:BackupTheBerlios,项目名称:fuldc-svn,代码行数:8,代码来源:PopupManager.cpp

示例11: maybe_have_delim

int lazy_protocol::maybe_have_delim(tstring const& input)
{
    size_t pos =  input.find_first_of(waiter_delim_.data(), waiter_delim_.size());
    if( pos == tstring::npos ) {
        again();
        return 0;
    }
    return call(waiter_method_, tstring(input.data(), pos));
}
开发者ID:zbigg,项目名称:tinfra,代码行数:9,代码来源:lazy_protocol.cpp

示例12: ShowMC

void PopupManager::ShowMC(const tstring& msg, HWND owner){
	int pos1 = msg.find_first_of(_T("<"));
	int pos2 = msg.find_first_of(_T(">"));
	
	//something wrong with the string, return
	if(pos1 == tstring::npos || pos2 == tstring::npos)
		return;

	ShowMC(msg.substr(pos1+1, pos2-pos1-1), msg.substr(pos2+1), owner);
	
}
开发者ID:BackupTheBerlios,项目名称:fuldc-svn,代码行数:11,代码来源:PopupManager.cpp

示例13: rtfEscape

tstring ChatCtrl::rtfEscape(tstring str) {
	tstring::size_type i = 0;
	while((i = str.find_first_of(_T("{}\\\n"), i)) != tstring::npos) {
		switch(str[i]) {
			// no need to process \r handled elsewhere
			case '\n': str.replace(i, 1, _T("\\line\n")); i+=6; break;
			default: str.insert(i, _T("\\")); i+=2;
		}
	}
	return str;
}
开发者ID:Dimetro83,项目名称:DC_DDD,代码行数:11,代码来源:ChatCtrl.cpp

示例14: containsLatePropertyVariables

bool PropertyValueVariables::containsLatePropertyVariables(const tstring& strProperty)
{
	bool latePropertyVariableExist = false;
	try
	{
		int indexStartOfVariable = 0;
		for( ;; )
		{
			indexStartOfVariable = strProperty.find_first_of( _T("${"), indexStartOfVariable);
			if( indexStartOfVariable == -1 )
			{
				return latePropertyVariableExist;
			}

			int indexEndOfVariable = strProperty.find_first_of( _T("}"), indexStartOfVariable );
			if( indexEndOfVariable == -1 )
			{
				return latePropertyVariableExist;
			}

			tstring variable = strProperty.substr(indexStartOfVariable+2, indexEndOfVariable - indexStartOfVariable - 2);
			LocalUtilities::trim(variable);
			DEBUG_SHOW( _T("containsLatePropertyVariables variable=") + variable);
			
			// compare late property value variables here
			// future - put late property value variables in a vector
			if( variable.compare( FOUND_JAVA_HOME ) == 0 )
			{
				return true;
			}

			indexStartOfVariable = indexEndOfVariable;
		}
	}
	catch(...)
	{
		DEBUG_SHOW( _T("Exception in containsLatePropertyVariables") );
		ErrHandler::severeError( _T("Error while determining if property contains late variables.") );
	}
	return latePropertyVariableExist;
}
开发者ID:b23prodtm,项目名称:JANEL,代码行数:41,代码来源:PropertyValueVariables.cpp

示例15: remove_all_extensions

std::string remove_all_extensions(tstring const& filename)
{
	const size_t last_slash = filename.find_last_of("\\/");
	const size_t last_dot = filename.find_first_of('.', last_slash);
	if( ( last_dot == tstring::npos ) ||
		( last_dot == filename.size() - 1 ) ) 
	{
		return filename.str();
	} else {
		tstring result = filename.substr(0, last_dot);
		return result.str();
	}
}
开发者ID:zbigg,项目名称:tinfra,代码行数:13,代码来源:path.cpp


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