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


C++ StringVector::begin方法代码示例

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


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

示例1: setCommandLine

void OgreApp::setCommandLine(const Ogre::String &commandLine)
{
	String configFile;
	mCommandLine = commandLine;
	
	if(!commandLine.empty())
	{

		// splits command line in a vector without spliting text between quotes
		StringVector quoteSplit = Ogre::StringUtil::split(commandLine, "\"");

		// if the first char was a quote, split() ignored it.
		if(commandLine[0] == '\"')
			quoteSplit.insert(quoteSplit.begin(), " "); // insert a space in the list to reflect the presence of the first quote
		// insert a space instead of an empty string because the next split() will ingore the space but not the empty string
		// split(" ")->{} / split("")->{""}

		for(unsigned int i = 0; i < quoteSplit.size(); i++)
		{
			if(i&1) // odd elements : between quotes
			{
				mCommandLineArgs.push_back(quoteSplit[i]);
			}
			else // even elements : outside quotes
			{
				StringVector spaceSplit = Ogre::StringUtil::split(quoteSplit[i]);
				mCommandLineArgs.insert(mCommandLineArgs.end(), spaceSplit.begin(), spaceSplit.end());
			}
		}
	}
}
开发者ID:aufheben1,项目名称:visual-experiments,代码行数:31,代码来源:OgreApp.cpp

示例2: CountTally

/*!
* Counts keywords in string.
*
* \param base string to search
* \param container set of keywords
* \param count number of keywords found
* \param mode allowable leading/trailing character mode (1=exclude keywords surrounded by exclude characters, 2=include only keywords preceded by include1 characters and followed by include2 characters)
* \param exclude list of characters that may not surround keywords found (if mode=1)
* \param include1 list of characters that must precede keywords found (if mode=2)
* \param include2 list of characters that must follow keywords found (if mode=2)
* \param counter_container stores list of individual keyword counts (if specified)
* \param casesensitive language is case sensitive?
*/
void CUtil::CountTally(const string &base, StringVector &container, unsigned int &count, int mode, const string &exclude,
                       const string &include1, const string &include2, UIntVector* counter_container, bool casesensitive)
{
    string::size_type idx;
    string base1;
    StringVector::iterator vit;
    UIntVector::iterator cit;
    unsigned int single_count = 0;
    base1 = " " + base + " ";

    if (counter_container)
        cit = counter_container->begin();

    if (casesensitive == false)
    {
        base1 = CUtil::ToLower(base1);
        for (vit = container.begin(); vit != container.end(); vit++)
            (*vit) = CUtil::ToLower((*vit));
    }

    if (mode == 1)
    {
        // exclude mode
        for (vit = container.begin(); vit != container.end(); vit++)
        {
            idx = base1.find((*vit));
            while (idx != string::npos)
            {
                if ((exclude.find(base1[idx+((*vit).size())]) == string::npos) &&
                        (exclude.find(base1[idx-1]) == string::npos))
                {
                    count++;
                    single_count++;
                }
                idx = base1.find((*vit), idx + ((*vit).size()));
            }
            if (counter_container)
            {
                (*cit) += single_count;
                single_count = 0;
                cit++;
            }
        }
    }
    else if (mode == 2)
    {
        // include mode
        for (vit = container.begin(); vit != container.end(); vit++)
        {
            idx = base1.find((*vit));
            while (idx != string::npos)
            {
                if ((include1.find(base1[idx-1]) != string::npos) &&
                        (include2.find(base1[idx+((*vit).size())]) != string::npos))
                    count++;
                idx = base1.find((*vit), idx + ((*vit).size()));
            }
        }
    }
}
开发者ID:geminijun,项目名称:DR,代码行数:73,代码来源:CUtil.cpp

示例3: model

 std::vector<std::string> SimulationControl_Impl::annualSimulationEnvironmentPeriods() const {
   StringVector result;
   OptionalSqlFile oSqlFile = model().sqlFile();
   if (oSqlFile && runSimulationforWeatherFileRunPeriods()) {
     RunPeriodVector runPeriods = this->runPeriods();
     StringVector environmentPeriods = oSqlFile->availableEnvPeriods();
     for (const RunPeriod& runPeriod : runPeriods) {
       if (runPeriod.isAnnual() && !runPeriod.isRepeated()) {
         std::string rpName = runPeriod.name().get();
         StringVector::const_iterator it = std::find_if(environmentPeriods.begin(),environmentPeriods.end(),std::bind(istringEqual,rpName,std::placeholders::_1));
         if (it != environmentPeriods.end()) {
           result.push_back(*it);
         }
       }
     }
     if (result.empty()) {
       // try environment name from WeatherFile
       OptionalWeatherFile oWeatherFile = model().getOptionalUniqueModelObject<WeatherFile>();
       if (oWeatherFile) {
         OptionalString os = oWeatherFile->environmentName();
         if (os) {
           std::string candidate = *os;
           StringVector::const_iterator it = std::find_if(environmentPeriods.begin(),environmentPeriods.end(),std::bind(istringEqual,candidate,std::placeholders::_1));
           if (it != environmentPeriods.end()) {
             result.push_back(*it);
           }
         }
       }
     }
   }
   return result;
 }
开发者ID:jamiebull1,项目名称:OpenStudio,代码行数:32,代码来源:SimulationControl.cpp

示例4: doTest

	bool TestLexer::doTest( )
	{

		StringVector files = _getFileNames();
		
		report( "Scanning the following files:\n " 
			<< hydrazine::toString( files.begin(), files.end(), "\n " )  );
		
		for( StringVector::iterator fi = files.begin(); 
			fi != files.end(); ++fi )
		{
		
			ptxFile = *fi;
		
			if(  !_testScan( ) )
			{
		
				status << "For file " << ptxFile 
					<< ", Test Point 1 (Scan): Failed\n";
				return false;
		
			}
		
			status << "For file " << ptxFile 
				<< ", Test Point 1 (Scan): Passed\n";
			
		}
			
		return true;
	
	}
开发者ID:AlexanderStohr,项目名称:gpuocelot,代码行数:31,代码来源:TestLexer.cpp

示例5: keyFrameSubstitute

  void
  FrameStoreInit::addXmlFrames(Miro::ConfigDocument& xmlConfig)
  {
    // get all frames defined in the config file
    xmlConfig.setSection("Frames");
    typedef Miro::ConfigDocument::StringVector StringVector;
    StringVector frames = xmlConfig.getInstances("rapid::FrameRpyParameters");

    // add all frames specified in RPY
    StringVector::iterator first, last = frames.end();
    for (first = frames.begin(); first != last; ++first) {
      FrameRpyParameters frame;
      xmlConfig.getType("rapid::FrameRpyParameters", *first, frame);
      keyFrameSubstitute(frame.parent); 
      addRpyFrame(keyFrameSubstitute(*first), frame);
    }

    // add all frames specified in Quaternios
    frames = xmlConfig.getInstances("rapid::FrameQParameters");
    last = frames.end();
    for (first = frames.begin(); first != last; ++first) {
      FrameQParameters frame;
      xmlConfig.getType("rapid::FrameQParameters", *first, frame);
      keyFrameSubstitute(frame.parent); 
      addQFrame(keyFrameSubstitute(*first), frame);
    }
  }
开发者ID:gpkehoe,项目名称:soraCore,代码行数:27,代码来源:FrameStoreInit.cpp

示例6: AddComponentGlyphs

EStatusCode Type1ToCFFEmbeddedFontWriter::AddDependentGlyphs(StringVector& ioSubsetGlyphIDs)
{
	EStatusCode status = PDFHummus::eSuccess;
	StringSet glyphsSet;
	StringVector::iterator it = ioSubsetGlyphIDs.begin();
	bool hasCompositeGlyphs = false;

	for(;it != ioSubsetGlyphIDs.end() && PDFHummus::eSuccess == status; ++it)
	{
		bool localHasCompositeGlyphs;
		status = AddComponentGlyphs(*it,glyphsSet,localHasCompositeGlyphs);
		hasCompositeGlyphs |= localHasCompositeGlyphs;
	}

	if(hasCompositeGlyphs)
	{
		StringSet::iterator itNewGlyphs;

		for(it = ioSubsetGlyphIDs.begin();it != ioSubsetGlyphIDs.end(); ++it)
			glyphsSet.insert(*it);

		ioSubsetGlyphIDs.clear();
		for(itNewGlyphs = glyphsSet.begin(); itNewGlyphs != glyphsSet.end(); ++itNewGlyphs)
			ioSubsetGlyphIDs.push_back(*itNewGlyphs);
		
		sort(ioSubsetGlyphIDs.begin(),ioSubsetGlyphIDs.end());
	}	
	return status;	
}
开发者ID:CornerZhang,项目名称:PDF-Writer,代码行数:29,代码来源:Type1ToCFFEmbeddedFontWriter.cpp

示例7: getAllSymbolsUsedByKernel

ModuleLinkerPass::StringVector ModuleLinkerPass::getAllSymbolsUsedByKernel(
	const std::string& kernelName) const
{
	StringSet usedSymbols;

	usedSymbols.insert(kernelName);

	StringVector unprocessedSymbols = getAllSymbolsUsedByThisKernel(
		kernelName, _linkedModule);
	
	while(!unprocessedSymbols.empty())
	{
		StringVector newSymbols;
	
		for(auto symbol = unprocessedSymbols.begin();
			symbol != unprocessedSymbols.end(); ++symbol)
		{
			if(!usedSymbols.insert(*symbol).second) continue;
		
			if(!isKernelSymbol(_linkedModule, *symbol)) continue;
		
			StringVector kernelSymbols = getAllSymbolsUsedByThisKernel(
				*symbol, _linkedModule);
				
			newSymbols.insert(newSymbols.end(), kernelSymbols.begin(),
				kernelSymbols.end());
		}
		
		unprocessedSymbols = std::move(newSymbols);
	}
	
	return StringVector(usedSymbols.begin(), usedSymbols.end());
}
开发者ID:dougct,项目名称:ocelot-ufmg,代码行数:33,代码来源:ModuleLinkerPass.cpp

示例8: shouldFilterByShortcut

int RuleMap::shouldFilterByShortcut(const Url & mainURL,const Url & url,FilterType t)
{
	int iRet = 0;
	StringVector shortcuts;
	collectShortcuts(url.GetString(), shortcuts);
	this->m_ShortcutFilterRules.prepareStartFind();
	for (StringVector::iterator it = shortcuts.begin(); it != shortcuts.end(); ++it) 
	{
		iRet = m_ShortcutWhiteRules.doFilter(mainURL, *it, url, t);
		if (iRet != 0)
			return 0;
	}
	for (FilterRuleVector::iterator it =
		this->m_UnshortcutWhiteRules.begin(); it
		!= this->m_UnshortcutWhiteRules.end(); ++it) 
	{
			iRet = (*it)->shouldFilter(mainURL, url, t);
			if (iRet != 0)
				return 0;
	}
	for (StringVector::iterator it = shortcuts.begin(); it != shortcuts.end(); ++it)
	{
		iRet = this->m_ShortcutFilterRules.doFilter(mainURL, *it, url, t);
		if (iRet != 0)
			return iRet;
	}
	for (FilterRuleVector::iterator it = this->m_UnshortcutFilterRules.begin(); it != this->m_UnshortcutFilterRules.end(); ++it) 
	{
		iRet = (*it)->shouldFilter(mainURL, url, t);
		if (iRet != 0)
			return iRet;
	}
	return iRet;
}
开发者ID:fanliaokeji,项目名称:lvdun,代码行数:34,代码来源:FilterManager.cpp

示例9: AppendFileArray

	void CDirectoryManagerBase::AppendFileArray(const std::string& path, const std::string& fileExt, StringVector& fileArray)const
	{
		std::string filter = path + "*" + fileExt;

		StringVector tmp = WBSF::GetFilesList(filter, m_nameType);
		fileArray.insert(fileArray.begin(), tmp.begin(), tmp.end());
	}
开发者ID:RNCan,项目名称:WeatherBasedSimulationFramework,代码行数:7,代码来源:DirectoryManager.cpp

示例10: GetExtensionsAndLanguages

/*!
* 1.Function Description:
*	 Changes a given string to have a sorted list of File Extensions with related Language names (1 file Extension per line)
*
* 2.Parameters:
*    eachLangCounters    IN      reference to struct holding pointers to Language specific parser classes
*    extensionsAndLangs  IN/OUT  reference to string to hold file Extensions and related Language names
*
* 3.Creation Time And Owner:
*	 Version 2015.12
*/
void GetExtensionsAndLanguages( CounterForEachLangType & eachLangCounters, string & extensionsAndLangs, bool & multipleLangs )
{
	CounterForEachLangType::iterator iter = eachLangCounters.begin();
	CounterForEachLangType::iterator end  = eachLangCounters.end();

	StringVector extensions;
	string		oneLine;
	for ( ; iter != end; iter++ )
	{
		if ( iter->second->language_name == "UNDEF" )
			continue;	// skip 1st placeholder and Web as User can't change them

		StringVector::iterator itExt = iter->second->file_extension.begin();
		for ( ; itExt != iter->second->file_extension.end(); itExt++ )
		{
			oneLine = *itExt + " " + iter->second->language_name;
			extensions.push_back( oneLine );
		}
	}

	sort( extensions.begin(), extensions.end() );

	multipleLangs = false;
	string	temp, tempLang, previousExtension, previousLang;

	StringVector::iterator itExt = extensions.begin();
	for ( ; itExt != extensions.end(); itExt++ )
	{
		temp = *itExt;
		unsigned int position = temp.find_first_of(" ");
		if ( position == (unsigned int)string::npos )
		{
			// A really strange ERROR happened
			userIF->AddError( "Error: GetExtensionsAndLanguages created wrong string", false, 1, 1 );
			break;
		}
		tempLang = temp.substr( position );
		temp = temp.substr( 0, position );
		if ( previousExtension.compare( temp ) == 0 )
		{
			multipleLangs = true;	// MORE than 1 Language uses the same File Extension !
			char buf[512];
		#ifdef _MSC_VER
			// Use more Secure C library API
			sprintf_s( buf, sizeof( buf ),
		#else
			// Use older less Secure C library API
			sprintf( buf, 
		#endif
			"Warning: %s file extension is assigned to both %s and %s but only 1 language will be used.",
			temp.c_str(), previousLang.c_str(), tempLang.c_str() );
			string err = buf;
			userIF->AddError( err, false, 1, 1 );
		}
		previousExtension = temp;
		previousLang = tempLang;
		extensionsAndLangs += *itExt + "\n";
	}
开发者ID:XiangyuLi926,项目名称:2016SummerUCCProject,代码行数:69,代码来源:LangUtils.cpp

示例11: path

StringVector Component::path() const {
    StringVector ret;
    if (hasParent()) {
        StringVector b = parent()->path();
        ret.insert(ret.begin(), b.begin(), b.end());
    }
    ret.push_back(name());
    return ret;
}
开发者ID:gitcommit,项目名称:simpleorm,代码行数:9,代码来源:component.cpp

示例12: joinedLocalColumnNames

String ForeignKeyConstraint::joinedLocalColumnNames(const String& sep) const {
    StringVector v = localColumnNames();
    std::stringstream ss;
    for (StringVectorConstIterator i = v.begin(); i != v.end(); ++i) {
        if (i != v.begin()) {
            ss << sep;
        }
        ss << (*i);
    }
    return ss.str();
}
开发者ID:gitcommit,项目名称:simpleorm,代码行数:11,代码来源:foreignkeyconstraint.cpp

示例13: pathString

String Component::pathString(const String& sep) const {
    String ret;
    StringVector p = path();
    for (StringVectorConstIterator i = p.begin(); i != p.end(); ++i) {
        if (i != p.begin()) {
            ret += sep;
        }
        ret += (*i);
    }
    return ret;
}
开发者ID:gitcommit,项目名称:simpleorm,代码行数:11,代码来源:component.cpp

示例14:

TEST(Checksum, UUIDs) {
  StringVector checksums;
  for (unsigned i = 0, n = 1000; i < n; ++i) {
    checksums.push_back(checksum(toString(createUUID())));
  }
  auto itStart = checksums.begin();
  ++itStart;
  for (auto it = checksums.begin(), itEnd = checksums.end(); 
       itStart != itEnd; ++it, ++itStart) {
    EXPECT_TRUE(std::find(itStart,itEnd,*it) == itEnd);
  }
}
开发者ID:MatthewSteen,项目名称:OpenStudio,代码行数:12,代码来源:Checksum_GTest.cpp

示例15: get_same_encoding_C_locale

void get_same_encoding_C_locale (const std::string &lname,
                                 const std::string &cname,
                                 StringVector      &libc_locales)
{
    // get the aliases for both name and codeset
    StringVector la;
    StringVector ca;

    get_lname_aliases (lname, la);
    get_cname_aliases (cname, ca);

    // find all the installed C library locales that are equivalent
    // to the locale named by `lname' and that use the encoding given
    // by `cname'

    char* locname = get_installed_locales ();

    for (; *locname; locname += std::strlen (locname) + 1) {

        bool match_found = false;

        typedef StringVector::iterator Iterator;

        // iterate through the aliases and see if any one of them
        // starts with the same sequence
        for (Iterator it = la.begin (); it != la.end (); ++it) {

            if (0 != ci_pre_compare (locname, (*it).c_str ()))
                continue;

            // this is a good match, test to see if the encodings match
            if (0 == std::setlocale (LC_CTYPE, locname))
                continue;

            const char* const cs = nl_langinfo (CODESET);

            // compare the codeset to the aliases
            for (Iterator it1 = ca.begin (); it1 != ca.end (); ++it1) {
                if (0 != ci_compare (cs, (*it1).c_str ()))
                    continue;

                // found a match and save it
                libc_locales.push_back (std::string (locname));
                match_found = true;
            }

            if (match_found)
                break;
        }
    }
}
开发者ID:Quna,项目名称:mspdev,代码行数:51,代码来源:aliases.cpp


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