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


C++ StringVec::push_back方法代码示例

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


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

示例1: getVarNames

StringVec SpeckleyNodes::getVarNames() const
{
    StringVec res;
    res.push_back("Nodes_Id");
    res.push_back("Nodes_Tag");
    return res;
}
开发者ID:svn2github,项目名称:Escript,代码行数:7,代码来源:SpeckleyNodes.cpp

示例2: processLDFlags

void processLDFlags(const String& ldFlags, StringVec& libs) {
    // Tokenize flags
    StringVec ldFlagTokens;
    tokenize(ldFlags, ldFlagTokens, " \t", "", "\"'", "", "", true, false);

    // Expand -Wl, and -Xlinker tokens to make parsing easier
    StringVec ldFlagsFixed;
    replaceWlArgs(ldFlagTokens, ldFlagsFixed);

    String savedToken;
    for (auto opt : ldFlagsFixed) {
        if (savedToken.empty()) {
            opt = reduceLinkerToken(opt);
            if (opt == "-library" || opt == "-framework") {
                savedToken = opt;
            } else if (strBeginsWith(opt, "-l")) {
                String libName = strEndsWith(opt, ".o") ? opt.substr(2) : "lib" + opt.substr(2) + ".?";
                libs.push_back(libName);
            } else if (strEndsWith(opt, ".a") || strEndsWith(opt, ".dylib") || strEndsWith(opt, ".o")) {
                libs.push_back(opt);
            }
        } else {
            if (savedToken == "-library") {
                libs.push_back(opt);
            } else if (savedToken == "-framework") {
                std::string frameworkName = opt.substr(0, opt.find(',')) + ".framework";
                libs.push_back(frameworkName);
            }
            savedToken.clear();
        }
    }
}
开发者ID:bbowman,项目名称:WinObjC,代码行数:32,代码来源:clangoptparser.cpp

示例3: getVarNames

StringVec SpeckleyElements::getVarNames() const
{
    StringVec res;
    res.push_back(name + string("_Id"));
    res.push_back(name + string("_Owner"));
    //res.push_back(name + string("_Tag"));
    return res;
}
开发者ID:svn2github,项目名称:Escript,代码行数:8,代码来源:SpeckleyElements.cpp

示例4: explodeString

StringVec explodeString(const std::string& string, const std::string& separator)
{
	StringVec returnVector;
	size_t start = 0, end = 0;
	while((end = string.find(separator, start)) != std::string::npos)
	{
		returnVector.push_back(string.substr(start, end - start));
		start = end + separator.size();
	}

	returnVector.push_back(string.substr(start));
	return returnVector;
}
开发者ID:Berze,项目名称:sour,代码行数:13,代码来源:tools.cpp

示例5: explodeString

StringVec explodeString(const std::string& inString, const std::string& separator, int32_t limit/* = -1*/)
{
	StringVec returnVector;
	std::string::size_type start = 0, end = 0;

	while (--limit != -1 && (end = inString.find(separator, start)) != std::string::npos) {
		returnVector.push_back(inString.substr(start, end - start));
		start = end + separator.size();
	}

	returnVector.push_back(inString.substr(start));
	return returnVector;
}
开发者ID:tOgg1,项目名称:forgottenserver,代码行数:13,代码来源:tools.cpp

示例6: getRecursiveDirList

void getRecursiveDirList(const String& baseDir, StringVec& dirVec, const StringVec& ignoreList)
{ 
  DIR* dir = opendir(baseDir.c_str());
  if (!dir)
    return;
    
  dirVec.push_back(baseDir);

  struct dirent* entry;
  while ((entry = readdir(dir))) {
    if (entry->d_type == DT_DIR) {
      String path = joinPaths(baseDir, entry->d_name);
         
      if (!strcmp(entry->d_name, ".") || !strcmp(entry->d_name, ".."))
        continue;
        
      if (matchWildcardList(entry->d_name, ignoreList))
        continue;
      
      getRecursiveDirList(path, dirVec, ignoreList);
    }
  }

  closedir(dir);
}
开发者ID:GoogleInternetAuthorityG2SUNGHAN,项目名称:WinObjC,代码行数:25,代码来源:fileutils.cpp

示例7: setStringVecValue

inline void setStringVecValue( StringVec& sv, const std::string& value, size_t index = 0 )
{
	size_t size = sv.size();

	if( size <= index )
	{
		while( size < index )
		{
			sv.push_back( "" );
			++size;
		}
		sv.push_back( value );
	}
	else
		sv[index] = value;
}
开发者ID:EfestoLab,项目名称:TuttleOFX,代码行数:16,代码来源:utilities.hpp

示例8: getMeshNames

StringVec SpeckleyElements::getMeshNames() const
{
    StringVec res;
    if (nodeMesh)
        res.push_back(nodeMesh->getName());
    return res;
}
开发者ID:svn2github,项目名称:Escript,代码行数:7,代码来源:SpeckleyElements.cpp

示例9: GetExistingProfiles

ProfileDlg::StringVec ProfileDlg::GetExistingProfiles()
{
	StringVec profiles;
	HKEY hKey;
	if (::RegOpenKeyEx(HKEY_CURRENT_USER, PROFILES_LOC, 0, KEY_READ, &hKey) != ERROR_SUCCESS)
		return profiles;
	
	DWORD dwIndex = 0;
	LONG lRet;
	DWORD len = 50;
	TCHAR profileName[50];

	while ((lRet = ::RegEnumKeyEx(hKey, dwIndex, profileName, &len, NULL,
	NULL, NULL, NULL)) != ERROR_NO_MORE_ITEMS)
	{
		// Do we have a key to open?
		if (lRet == ERROR_SUCCESS)
		{
			// Open the key and get the value
			HKEY hItem;
			if (::RegOpenKeyEx(hKey, profileName, 0, KEY_READ, &hItem) != ERROR_SUCCESS)
				continue;
			profiles.push_back(profileName);
			::RegCloseKey(hItem);
		}
		dwIndex++;
		len = 50;
	}
	::RegCloseKey(hKey);
	return profiles;
}
开发者ID:christau,项目名称:xp-AntiSpy,代码行数:31,代码来源:ProfileDlg.cpp

示例10: normalize

  std::string Path::normalize(const std::string & path)
  {
    // Easiest way is: split, then remove "." and remove a/.. (but not ../.. !)
    // This does not get a/b/../.. so if we remove a/.., go through the string again
    // Also need to treat rootdir/.. specially
    // Also normalize(foo/..) -> "." but normalize(foo/bar/..) -> "foo"
    StringVec v = Path::split(path);
    if (v.size() == 0) 
      return "";

    StringVec outv;
    bool doAgain = true;
    while (doAgain) 
    {
      doAgain = false;
      for (unsigned int i = 0; i < v.size(); i++) 
      {
        if (v[i] == "") continue; // remove empty fields
        if (v[i] == "." && v.size() > 1) continue; // skip "." unless it is by itself
        if (i == 0 && isRootdir(v[i]) && i+1 < v.size() && v[i+1] == "..") 
        {
          // <root>/.. -> <root>
          outv.push_back(v[i]);
          i++; // skipped following ".."
          doAgain = true;
          continue;
        }
        // remove "foo/.."
        if (i+1 < v.size() && v[i] != ".." && v[i+1] == "..")
        {
          // but as a special case, if the full path is "foo/.." return "."
          if (v.size() == 2) return ".";
          i++;
          doAgain = true;
          continue;
        }
        outv.push_back(v[i]);
      }
      if (doAgain) 
      {
        v = outv;
        outv.clear();
      }
    }
    return Path::join(outv.begin(), outv.end());

  }
开发者ID:AndreCAndersen,项目名称:nupic,代码行数:47,代码来源:Path.cpp

示例11: explodeString

StringVec explodeString(const std::string& string, const std::string& separator, bool trim/* = true*/)
{
	StringVec returnVector;
	size_t start = 0, end = 0;
	while((end = string.find(separator, start)) != std::string::npos)
	{
		std::string t = string.substr(start, end - start);
		if(trim)
			trimString(t);

		returnVector.push_back(t);
		start = end + separator.size();
	}

	returnVector.push_back(string.substr(start));
	return returnVector;
}
开发者ID:AhmedWaly,项目名称:CastOnly,代码行数:17,代码来源:tools.cpp

示例12: get_vocab_names

StringVec Grammar::get_vocab_names() const
{
    StringVec vec;
    if( m_inherit ) {
        vec = m_inherit->get_vocab_names();
    }
    for( size_t i = 0 ; i < m_vocabs.size() ; i++ ) {
        vec.push_back( m_vocabs[i]->get_name() );
    }
    return vec;
}
开发者ID:nickmat,项目名称:HistoryCal,代码行数:11,代码来源:calgrammar.cpp

示例13: Split

//---------------------------------------------------------------------------------------------------------------------
// This is basically like the Perl split() function.  It splits str into substrings by cutting it at each delimiter.  
// The result is stored in vec.
//---------------------------------------------------------------------------------------------------------------------
void Split(const string& str, StringVec& vec, char delimiter)
{
	vec.clear();
	size_t strLen = str.size();
	if (strLen == 0)
		return;

	size_t startIndex = 0;
	size_t indexOfDel = str.find_first_of(delimiter, startIndex);
	while (indexOfDel != string::npos)
	{
		vec.push_back(str.substr(startIndex, indexOfDel-startIndex));
		startIndex=indexOfDel + 1;
		if (startIndex >= strLen)
			break;
		indexOfDel = str.find_first_of(delimiter, startIndex);
	}
	if(startIndex < strLen)
		vec.push_back(str.substr(startIndex));
}
开发者ID:Ostkaka,项目名称:ANT,代码行数:24,代码来源:String.cpp

示例14: split

 int split(StringVec &result, const String &src, const String& delm)
 {
     String _src(src);
     char *p = strtok((char*)_src.c_str(), delm.c_str());
     while (p != NULL)
     {
         result.push_back(p);
         p = strtok(NULL, delm.c_str());
     }
     return int(result.size());
 }
开发者ID:GHScan,项目名称:DailyProjects,代码行数:11,代码来源:ScanUtil.cpp

示例15: replaceWlArgs

// "Expand" -Wl and -Xlinker tokens
// This is OK to do since we're interested in a small subset of flags.
// Preserving correctness is not important.
static void replaceWlArgs(const StringVec& inArgs, StringVec& outArgs) {
    for (auto arg : inArgs) {
        if (strBeginsWith(arg, "-Wl,")) {
            StringVec tokens;
            tokenize(arg, tokens, ",", "", "", "", "");
            outArgs.insert(outArgs.end(), tokens.begin() + 1, tokens.end());
        } else if (arg != "-Xlinker") {
            outArgs.push_back(arg);
        }
    }
}
开发者ID:bbowman,项目名称:WinObjC,代码行数:14,代码来源:clangoptparser.cpp


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