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


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

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


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

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

示例2: splitString

// Split a string ==========================================================
int splitString(const String& input,
                const String& delimiter,
                StringVector & results,
                bool includeEmpties)
{
    results.clear();
    size_t delimiterSize = delimiter.size();
    if (input.size()== 0 || delimiterSize == 0)
        return 0;

    size_t newPos, iPos = 0;
    String emptyString;
    while ((newPos = input.find(delimiter, iPos))!=String::npos)
    {
        if (newPos==iPos)
        {
            if (includeEmpties)
                results.push_back(emptyString);
        }
        else
            results.push_back(input.substr(iPos, newPos-iPos));
        iPos = newPos+delimiterSize;
    }
    if (iPos>=input.size())
    {
        if (includeEmpties)
            results.push_back(emptyString);
    }
    else
        results.push_back(input.substr(iPos, String::npos));
    return results.size();
}
开发者ID:I2PC,项目名称:scipion,代码行数:33,代码来源:xmipp_strings.cpp

示例3: parseStringVector

static void parseStringVector(const std::string& str, StringVector& res)
{
  res.clear();
  std::string item;
  bool inQuotes = 0;
  for(std::string::size_type i = 0;i < str.length();i++)
    {
      if (!inQuotes && str[i] == ':')
	{
	  res.push_back(item);
	  item.erase();
	  continue;
	}
      if (!inQuotes && str[i] == '\"')
	{
	  inQuotes = 1;
	  continue;
	}
      if (inQuotes && str[i] == '\"')
	{
	  if (i + 1 < str.length() && str[i + 1] == '\"')
	    {
	      item += "\"";
	      i++;
	      continue;
	    }
	  inQuotes = 0;
	  continue;
	}
      item += str[i];
    }
  if (!res.empty() || !item.empty())
    res.push_back(item);
}
开发者ID:marigostra,项目名称:deepsolver,代码行数:34,代码来源:RepoParams.cpp

示例4: loadPlaybackData

void loadPlaybackData(PlaybackVector &pv, const char *filename)
{
	StringVector sv;
	readFile(sv, filename);
	parsePlaybackData(pv, sv);
	sv.clear();
}
开发者ID:AlaAyesh,项目名称:sockperf,代码行数:7,代码来源:Playback.cpp

示例5: readDocFromStream

Document readDocFromStream(std::istream& is, std::string& docName) {
    Document document;
    StringVector word;

    std::string line;
    std::string token;

    std::getline(is, docName);
    std::getline(is, line);
    while (!is.eof() && !is.fail()) {
        if (line.size() == 0) {
            break;
        }
        std::stringstream ls(line);
        std::getline(ls, token, '\t');
        while (!ls.eof()) {
            std::getline(ls, token, '\t');
            word.push_back(token);
        }
        document.push_back(word);
        word.clear();

        std::getline(is, line);
    }
    return document;
}
开发者ID:estnltk,项目名称:pfe,代码行数:26,代码来源:Corpus.cpp

示例6: ListboxTextItem

void OgreSample8App::setupModes()
{
    StringVector matNames;

    matNames.push_back("Examples/BumpMapping/MultiLight");
    matNames.push_back("Examples/BumpMapping/MultiLightSpecular");
    matNames.push_back("Examples/OffsetMapping/Specular");
    matNames.push_back("Examples/ShowUV");
    matNames.push_back("Examples/ShowNormals");
    matNames.push_back("Examples/ShowTangents");

    matNames.push_back("RTSS/NormalMapping_SinglePass");
    matNames.push_back("RTSS/NormalMapping_MultiPass");

    mPossibilities["ogrehead.mesh"] = matNames;
    mPossibilities["knot.mesh"] = matNames;

    matNames.clear();
    matNames.push_back("Examples/Athene/NormalMapped");
    matNames.push_back("Examples/Athene/NormalMappedSpecular");
    matNames.push_back("Examples/Athene/NormalMappedSpecular");
    matNames.push_back("Examples/ShowUV");
    matNames.push_back("Examples/ShowNormals");
    matNames.push_back("Examples/ShowTangents");
    matNames.push_back("RTSS/Athene/NormalMapping_SinglePass");
    matNames.push_back("RTSS/Athene/NormalMapping_MultiPass");

    mPossibilities["athene.mesh"] = matNames;

    for (std::map<Ogre::String,Ogre::StringVector>::iterator it = mPossibilities.begin(); it != mPossibilities.end(); it++)
    {
        Ogre::MeshPtr mesh = MeshManager::getSingleton().load(it->first,ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY);

        unsigned short src,dest;
        if (!mesh->suggestTangentVectorBuildParams(VES_TANGENT,src,dest))
        {
            mesh->buildTangentVectors(VES_TANGENT,src,dest);
        }
        Entity* ent = mSceneMgr->createEntity(mesh->getName(),mesh->getName());
        ent->setMaterialName(it->second.front());
    }

    mMeshMenu->addItem(new CEGUI::ListboxTextItem("athene.mesh"));
    mMeshMenu->addItem(new CEGUI::ListboxTextItem("ogrehead.mesh"));
    mMeshMenu->addItem(new CEGUI::ListboxTextItem("knot.mesh"));
    mMeshMenu->setItemSelectState(size_t(0),true);

    const char * a = mMeshMenu->getSelectedItem()->getText().c_str();
    Ogre::StringVector::iterator it = mPossibilities[a].begin();
    Ogre::StringVector::iterator itEnd = mPossibilities[mMeshMenu->getSelectedItem()->getText().c_str()].end();

    for (; it != itEnd; it++)
    {
        mMaterialMenu->addItem(new ListboxTextItem(it->c_str()));
    }
    mMaterialMenu->setItemSelectState(size_t(0),true);
    mSceneMgr->getEntity(mMeshMenu->getSelectedItem()->getText().c_str())->setMaterialName(mMaterialMenu->getSelectedItem()->getText().c_str());
}
开发者ID:harr999y,项目名称:OgreFramework,代码行数:58,代码来源:OgreSample8.cpp

示例7: GetFileList

	ERMsg CUINewBrunswick::GetFileList(size_t n, StringVector& fileList, CCallback& callback)const
	{
		ERMsg msg;

		fileList.clear();

		if (msg)
		{

			if (n == FIRE)
			{
				ASSERT(false);
			}
			else if (n == AGRI)
			{
				CInternetSessionPtr pSession;
				CHttpConnectionPtr pConnection;

				msg = GetHttpConnection(SERVER_NAME[AGRI], pConnection, pSession, PRE_CONFIG_INTERNET_ACCESS);
				if (msg)
				{
					string str;
					msg = UtilWWW::GetPageText(pConnection, "010-001/archive.aspx", str);
					if (msg)
					{
						string::size_type pos1 = str.find("<select");
						string::size_type pos2 = str.find("</select>");

						if (pos1 != string::npos && pos2 != string::npos)
						{
							string xml_str = "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>\r\n" + str.substr(pos1, pos2 - pos1 + 9);
							zen::XmlDoc doc = zen::parse(xml_str);

							zen::XmlIn in(doc.root());
							for (zen::XmlIn it = in["option"]; it; it.next())
							{
								string value;
								//it(value);
								it.get()->getAttribute("value", value);
								fileList.push_back(value);
							}//for all station
						}
						
						//static const char* STATIONS[19] = { "47", "49", "62", "42", "45", "51", "55", "36", "37", "59", "41", "67", "68", "70", "66", "65", "53", "73", "69" };
						//for (int i = 0; i < 19; i++)
						//fileList.push_back(STATIONS[i]);
					}

					//clean connection
					pConnection->Close();
					pSession->Close();
				}
			}
		}

		return msg;
	}
开发者ID:RNCan,项目名称:WeatherBasedSimulationFramework,代码行数:57,代码来源:UINewBrunswick.cpp

示例8: InitCopulList

void InitCopulList(StringVector& v_CopulList)
{
	v_CopulList.clear();
	v_CopulList.push_back("как");
	v_CopulList.push_back("словно");
	v_CopulList.push_back("будто");
	v_CopulList.push_back("что");
	v_CopulList.push_back("точно");
}
开发者ID:deNULL,项目名称:seman,代码行数:9,代码来源:SynanDash.cpp

示例9: GetStationList

	ERMsg CEnvCanGribForecast::GetStationList(StringVector& stationList, CCallback& callback)
	{
		ERMsg msg;

		stationList.clear();
		//msg.ajoute("Can't extract station from grid");
		//msg.ajoute("Can be used only as forecast extraction");

		return msg;
	}
开发者ID:RNCan,项目名称:WeatherBasedSimulationFramework,代码行数:10,代码来源:EnvCanGribForecast.cpp

示例10:

// [email protected] Test added to help with gcc debug.
TEST(Table, Trim) {
  Table t;
  StringVector row;

  // create table that can be trimmed
  t.appendRow(row);
  t.appendRow(row);
  row.push_back("real row 1"); row.push_back("header"); row.push_back("");
  t.appendRow(row); row.clear();
  row.push_back("real row 2"); row.push_back("2");
  t.appendRow(row); row.clear();
  t.appendRow(row);
  EXPECT_EQ(static_cast<unsigned>(5),t.nRows());
  EXPECT_EQ(static_cast<unsigned>(3),t.nCols());

  // trim and test
  t.trim();
  EXPECT_EQ(static_cast<unsigned>(2),t.nRows());
  EXPECT_EQ(static_cast<unsigned>(2),t.nCols());
}
开发者ID:CUEBoxer,项目名称:OpenStudio,代码行数:21,代码来源:Table_GTest.cpp

示例11: getActionNames

GUIDECRAFT_BEGIN_NAMESPACE

void Action::getActionNames(StringVector& res) const
{
  assert(m_action);
  res.clear();
  GError* err = NULL;
  const int count = atspi_action_get_n_actions(m_action, &err);
  for(int i = 0;i < count;++i)
    res.push_back(atspi_action_get_action_name(m_action, i, &err));
}
开发者ID:luwrain,项目名称:guidecraft,代码行数:11,代码来源:Action.cpp

示例12: LemmatizeWordForPlmLines

bool CLemmatizer::LemmatizeWordForPlmLines(string& InputWordStr, const bool cap, const bool predict,  StringVector& results) const 
{
	results.clear();
	vector<CAutomAnnotationInner>	FindResults;

	FilterSrc(InputWordStr);

	bool bFound = LemmatizeWord(InputWordStr, cap, predict, FindResults, true);

	AssignWeightIfNeed(FindResults);

	return  FormatResults(InputWordStr, FindResults, results, bFound);
}
开发者ID:generall,项目名称:gogo_lemmatizer,代码行数:13,代码来源:Lemmatizers.cpp

示例13: makeFlankingHaplotypes

bool HapgenUtil::makeFlankingHaplotypes(const HapgenAlignment& aln,
                                        const ReadTable* pRefTable,
                                        int flanking,
                                        const StringVector& inHaplotypes,
                                        StringVector& outFlankingHaplotypes,
                                        StringVector& outHaplotypes)
{
    std::string upstream;
    std::string referenceHaplotype;
    std::string downstream;

    extractReferenceSubstrings(aln, pRefTable, flanking, upstream, referenceHaplotype, downstream);

    // Flip reference strings to match the strand of the input haplotypes
    if(aln.isRC)
    {
        // reverse complement each string
        upstream = reverseComplement(upstream);
        referenceHaplotype = reverseComplement(referenceHaplotype);
        downstream = reverseComplement(downstream);

        // Swap up and downstream
        upstream.swap(downstream);
    }

    // Make the reference haplotype w/ flanking sequence
    std::string referenceFlanking = upstream + referenceHaplotype + downstream;
    outFlankingHaplotypes.push_back(referenceFlanking);
    outHaplotypes.push_back(referenceHaplotype);

    // Check that all sequences match the reference haplotype properly
    bool checkOk = checkAlignmentsAreConsistent(referenceFlanking, inHaplotypes);
    if(!checkOk)
    {
        outHaplotypes.clear();
        return false;
    }

    // Make the flanking sequences for each haplotype
    for(size_t i = 0; i < inHaplotypes.size(); ++i)
    {
        // Skip if the input haplotype exactly matches the reference
        if(inHaplotypes[i] != referenceHaplotype)
        {
            outFlankingHaplotypes.push_back(upstream + inHaplotypes[i] + downstream);
            outHaplotypes.push_back(inHaplotypes[i]);
        }
    }

    return true;
}
开发者ID:nathanhaigh,项目名称:sga,代码行数:51,代码来源:HapgenUtil.cpp

示例14: InitThesList

void InitThesList (const CThesaurus* Thes, string ConceptStr,	StringVector& Vec)
{
	Vec.clear();
	vector<int> LowerTermins;
	Thes->QueryLowerTermins(ConceptStr.c_str(), morphRussian, LowerTermins);
	long Count = LowerTermins.size();
	for (long i=0; i <Count; i++)
	{
			const CInnerTermin& T = Thes->m_Termins[LowerTermins[i]];
			string TerminStr =  T.m_TerminStr;
			EngRusMakeUpper(TerminStr);
			Vec.push_back(TerminStr);
	};
	sort(Vec.begin(),Vec.end());
};
开发者ID:deNULL,项目名称:seman,代码行数:15,代码来源:SemanticsHolder.cpp

示例15: tokenize

// Tokenize a C++ string ===================================================
void tokenize(const String& str, StringVector& tokens,
              const String& delimiters)
{
    tokens.clear();
    // Skip delimiters at beginning.
    String::size_type lastPos = str.find_first_not_of(delimiters, 0);
    // Find first "non-delimiter".
    String::size_type pos     = str.find_first_of(delimiters, lastPos);

    while (String::npos != pos || String::npos != lastPos)
    {
        // Found a token, add it 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:I2PC,项目名称:scipion,代码行数:20,代码来源:xmipp_strings.cpp


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