本文整理汇总了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());
}
}
}
}
示例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()));
}
}
}
}
示例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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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());
}
示例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;
}
示例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());
}
示例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";
}
示例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;
}
示例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();
}
示例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;
}
示例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);
}
}
示例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;
}
}
}