本文整理汇总了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;
}
示例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();
}
示例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);
}
示例4: loadPlaybackData
void loadPlaybackData(PlaybackVector &pv, const char *filename)
{
StringVector sv;
readFile(sv, filename);
parsePlaybackData(pv, sv);
sv.clear();
}
示例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;
}
示例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());
}
示例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;
}
示例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("точно");
}
示例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;
}
示例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());
}
示例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));
}
示例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);
}
示例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;
}
示例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());
};
示例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);
}
}