本文整理汇总了C++中StringVector::insert方法的典型用法代码示例。如果您正苦于以下问题:C++ StringVector::insert方法的具体用法?C++ StringVector::insert怎么用?C++ StringVector::insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringVector
的用法示例。
在下文中一共展示了StringVector::insert方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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());
}
示例3: 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());
}
示例4: 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;
}
示例5: getDomains
/*
* 获取该规则期望过滤的域名
*/
void FilterRule::getDomains(StringVector & domains)
{
if(!m_domains.empty())
{
domains.insert(domains.end(),m_domains.begin(),m_domains.end());
return;
}
std::string s=parseDomain(m_reFilter);
if(!s.empty())
domains.push_back(s);
}
示例6: GetStringVector
StringVector PME::GetStringVector ( )
{
StringVector oStringVector;
for ( int nCurrentMatch = 0;
nCurrentMatch < nMatches;
nCurrentMatch++ ) {
oStringVector.insert ( oStringVector.end ( ), (*this)[nCurrentMatch] );
}
return oStringVector;
}
示例7: GetFilesList
//************************************************************
// GetFileArray : obtain a list of file by serching in all directory
//************************************************************
StringVector CDirectoryManager::GetFilesList()const
{
StringVector files;
if (m_simpleExt)
{
files = CDirectoryManagerBase::GetFilesList(m_extensions);
}
else
{
StringVector extensions(m_extensions, "|");
for (size_t i = 0; i < extensions.size(); i++)
{
StringVector tmp = CDirectoryManagerBase::GetFilesList(extensions[i]);
files.insert(files.end(), tmp.begin(), tmp.end());
}
}
return files;
}
示例8: runDindelPairMatePair
// Run dindel on a pair of samples
DindelReturnCode DindelUtil::runDindelPairMatePair(const std::string& id,
const StringVector& base_haplotypes,
const StringVector& variant_haplotypes,
const GraphCompareParameters& parameters,
std::ostream& baseOut,
std::ostream& variantOut,
std::ostream& callsOut,
DindelReadReferenceAlignmentVector* pReadAlignments)
{
PROFILE_FUNC("runDindelPairMatePair")
StringVector inHaplotypes;
inHaplotypes.insert(inHaplotypes.end(), base_haplotypes.begin(), base_haplotypes.end());
inHaplotypes.insert(inHaplotypes.end(), variant_haplotypes.begin(), variant_haplotypes.end());
//
// First, extract the reads from the normal and variant data sets that match each haplotype
//
assert(inHaplotypes.size() > 0);
// Get canidate alignments for the input haplotypes
HapgenAlignmentVector candidateAlignments;
// Choose the kmer size for alignment
size_t align_kmer = 31;
for(size_t i = 0; i < inHaplotypes.size(); ++i)
{
HapgenAlignmentVector thisCandidateAlignments;
HapgenUtil::alignHaplotypeToReferenceKmer(align_kmer,
inHaplotypes[i],
parameters.referenceIndex,
parameters.pRefTable,
thisCandidateAlignments);
candidateAlignments.insert(candidateAlignments.end(), thisCandidateAlignments.begin(), thisCandidateAlignments.end());
}
// Remove duplicate or bad alignment pairs
HapgenUtil::coalesceAlignments(candidateAlignments);
if(Verbosity::Instance().getPrintLevel() > 3)
printf("runDindel -- %zu candidate alignments found\n", candidateAlignments.size());
size_t MAX_ALIGNMENTS = 10;
if(candidateAlignments.size() > MAX_ALIGNMENTS)
return DRC_AMBIGUOUS_ALIGNMENT;
// Join each haplotype with flanking sequence from the reference genome for each alignment
// This function also adds a haplotype (with flanking sequence) for the piece of the reference
int FLANKING_SIZE = 0;
if (parameters.dindelRealignParameters.realignMatePairs)
FLANKING_SIZE = 1000;
StringVector flankingHaplotypes;
// This vector contains the internal portion of the haplotypes, without the flanking sequence
// It is used to extract reads
StringVector candidateHaplotypes;
for(size_t i = 0; i < candidateAlignments.size(); ++i)
{
HapgenUtil::makeFlankingHaplotypes(candidateAlignments[i],
parameters.pRefTable,
FLANKING_SIZE,
inHaplotypes,
flankingHaplotypes,
candidateHaplotypes);
}
if(Verbosity::Instance().getPrintLevel() > 3)
printf("runDindel -- made %zu flanking haplotypes\n", candidateHaplotypes.size());
// Normal reads
SeqRecordVector normalReads;
SeqRecordVector normalRCReads;
// Remove non-unique candidate haplotypes
std::sort(candidateHaplotypes.begin(), candidateHaplotypes.end());
StringVector::iterator haplotype_iterator = std::unique(candidateHaplotypes.begin(), candidateHaplotypes.end());
candidateHaplotypes.resize(haplotype_iterator - candidateHaplotypes.begin());
// Set the value to use for extracting reads that potentially match the haplotype
// Do not use a kmer for extraction greater than this value
size_t KMER_CEILING = 31;
size_t extractionKmer = parameters.kmer < KMER_CEILING ? parameters.kmer : KMER_CEILING;
bool extractOK = true;
if(!parameters.bReferenceMode)
{
// Reads on the same strand as the haplotype
extractOK = HapgenUtil::extractHaplotypeReads(candidateHaplotypes, parameters.baseIndex, extractionKmer,
false, parameters.maxReads, parameters.maxExtractionIntervalSize, &normalReads, NULL);
if(!extractOK)
return DRC_OVER_DEPTH;
// Reads on the reverse strand
extractOK = HapgenUtil::extractHaplotypeReads(candidateHaplotypes, parameters.baseIndex, extractionKmer,
true, parameters.maxReads, parameters.maxExtractionIntervalSize, &normalRCReads, NULL);
//.........这里部分代码省略.........
示例9: variablesTokenizer
void
NumericExpression::init()
{
_vars.clear();
_rpn.clear();
StringTokenizer variablesTokenizer( "", "" );
variablesTokenizer.addDelims( "[]", true );
variablesTokenizer.addQuotes( "'\"", true );
variablesTokenizer.keepEmpties() = false;
StringTokenizer operandTokenizer( "", "" );
operandTokenizer.addDelims( ",()%*/+-", true );
operandTokenizer.addQuotes( "'\"", true );
operandTokenizer.keepEmpties() = false;
StringVector variablesTokens;
variablesTokenizer.tokenize( _src, variablesTokens );
StringVector t;
bool invar = false;
for( unsigned i=0; i<variablesTokens.size(); ++i )
{
if ( variablesTokens[i] == "[" && !invar )
{
// Start variable, add "[" token
invar = true;
t.push_back(variablesTokens[i]);
}
else if ( variablesTokens[i] == "]" && invar )
{
// End variable, add "]" token
invar = false;
t.push_back(variablesTokens[i]);
}
else if ( invar )
{
// Variable, add variable token
t.push_back(variablesTokens[i]);
}
else
{
// Operands, tokenize it and add tokens
StringVector operandTokens;
operandTokenizer.tokenize( variablesTokens[i], operandTokens );
t.insert(t.end(), operandTokens.begin(), operandTokens.end());
}
}
// identify tokens:
AtomVector infix;
invar = false;
for( unsigned i=0; i<t.size(); ++i ) {
if ( t[i] == "[" && !invar ) {
invar = true;
}
else if ( t[i] == "]" && invar ) {
invar = false;
infix.push_back( Atom(VARIABLE,0.0) );
_vars.push_back( Variable(t[i-1],0) );
}
else if ( t[i] == "(" ) infix.push_back( Atom(LPAREN,0.0) );
else if ( t[i] == ")" ) infix.push_back( Atom(RPAREN,0.0) );
else if ( t[i] == "," ) infix.push_back( Atom(COMMA,0.0) );
else if ( t[i] == "%" ) infix.push_back( Atom(MOD,0.0) );
else if ( t[i] == "*" ) infix.push_back( Atom(MULT,0.0) );
else if ( t[i] == "/" ) infix.push_back( Atom(DIV,0.0) );
else if ( t[i] == "+" ) infix.push_back( Atom(ADD,0.0) );
else if ( t[i] == "-" ) infix.push_back( Atom(SUB,0.0) );
else if ( t[i] == "min" ) infix.push_back( Atom(MIN,0.0) );
else if ( t[i] == "max" ) infix.push_back( Atom(MAX,0.0) );
else if ( (t[i][0] >= '0' && t[i][0] <= '9') || t[i][0] == '.' )
infix.push_back( Atom(OPERAND,as<double>(t[i],0.0)) );
else if ( t[i] != "," && (i == 0 || t[i-1] != "["))
{
std::string var = t[i];
// If this is a call to a script function, store the entire function
// call in the variable string
if (i < t.size() - 1 && t[i+1] == "(")
{
int parenCount = 0;
do
{
++i;
var += t[i];
if (t[i] == "(")
parenCount++;
else if (t[i] == ")")
parenCount--;
} while (i < t.size() - 1 && parenCount > 0);
}
infix.push_back( Atom(VARIABLE, 0.0) );
_vars.push_back( Variable(var, 0) );
}
// note: do nothing for a comma
}
//.........这里部分代码省略.........
示例10: WriteToMKFile
bool CConverToMK::WriteToMKFile()
{
filesystem::path kPath(m_pszMKFile);
string strParentPath = kPath.parent_path().string();
StringVector kPathSet = m_kMKFileData;
StringVector::iterator pkIterator = kPathSet.begin();
for (unsigned int i = 0;i < m_uiKeyStringPosition;i++)
{
pkIterator++;
}
kPathSet.insert(pkIterator,string("LOCAL_SRC_FILES := \\"));
unsigned int uiPos = m_uiKeyStringPosition + 1;
for (ModuleInfoMap::iterator it = m_kModuleInfoMap.begin();
it != m_kModuleInfoMap.end();it++)
{
ModuleInfo kInfo = it->second;
StringVector kStringVector = m_kFilesPathData[string(kInfo.szModuleName)];
for (unsigned int uiIndex = 0;uiIndex < kStringVector.size();uiIndex++)
{
string strFullPath = kStringVector[uiIndex];
string strProcessedPath = "";
if (!ProcessPath(kInfo.szVCProjFile,strFullPath.c_str(),strProcessedPath))
{
cout << "文件 " << strFullPath << " 找不到!请检查vcproj文件" << endl;
continue;
}
replace_all(strProcessedPath,"\\","/");
if (uiIndex != kStringVector.size() - 1)
{
strProcessedPath = strProcessedPath + string(" \\");
}
kPathSet.insert(kPathSet.begin() + uiPos,strProcessedPath);
uiPos++;
}
}
ofstream kOutStream("temp.mk");
cout << "正在写入到" << "temp.mk" << "文件里" << endl;
progress_display kProgressDisplay(kPathSet.size());
for (unsigned int uiIndex = 0;uiIndex < kPathSet.size();uiIndex++)
{
kOutStream << kPathSet[uiIndex] << endl;
++kProgressDisplay;
Sleep(20);
}
kOutStream.close();
cout << "已经写完并且关闭文件" << endl;
return true;
}
示例11: GetRadarList
ERMsg CUIEnvCanRadar::GetRadarList(StringVector& radarList, CCallback& callback)const
{
ERMsg msg;
//Interface attribute index to attribute index
//sample for Québec
//http://climate.weather.gc.ca/radar/index_e.html?site=XAM&year=2015&month=7&day=25&hour=13&minute=20&duration=2&image_type=PRECIPET_SNOW_WEATHEROFFICE
//http://climate.weather.gc.ca/radar/index_e.html?site=XAM&sYear=2013&sMonth=7&sDay=15&sHour=22&sMin=00&Duration=2&ImageType=PRECIP_SNOW_WEATHEROFFICE&scale=14
static const char pageFormat[] =
"radar/index_e.html?"
"site=%s&"
"year=%d&"
"month=%d&"
"day=%d&"
"hour=%d&"
"minute=00&"
"duration=2&"
"image_type=%s";
CCanadianRadar radar(Get(RADAR));
CTPeriod period = GetPeriod();
callback.PushTask(GetString(IDS_LOAD_FILE_LIST), radar.count() * period.size() / 2);
size_t type = as<size_t>(TYPE);
size_t prcpType = as<size_t>(PRCP_TYPE);
CInternetSessionPtr pSession;
CHttpConnectionPtr pConnection;
msg = GetHttpConnection(SERVER_NAME[type], pConnection, pSession);
if (!msg)
return msg;
ASSERT(period.GetTM().Type() == CTM::HOURLY);
std::set<string> tmpList;
//loop each 2 hours
for (size_t i = 0; i < radar.size() && msg; i++)
{
if (radar.none() || radar[i])
{
for (CTRef TRef = period.Begin(); TRef <= period.End() && msg; TRef += 2)
{
string URL = FormatA(pageFormat, CCanadianRadar::GetName(i,0).c_str(), TRef.GetYear(), TRef.GetMonth() + 1, TRef.GetDay() + 1, TRef.GetHour(), TYPE_NAME[prcpType]);
URL.resize(strlen(URL.c_str()));
string source;
UtilWWW::GetPageText(pConnection, URL, source, true);
//string::size_type posEnd = 0;
string fileList = FindString(source, "blobArray = [", "]");
if (!fileList.empty())
{
string::size_type posBegin = 0;
while (posBegin != string::npos)
{
string image = FindString(fileList, "'", "'", posBegin);
if (!image.empty())
tmpList.insert(image);
posBegin = fileList.find(",", posBegin);
}
}
msg += callback.StepIt();
}
}
}
pConnection->Close();
pSession->Close();
radarList.insert(radarList.end(), tmpList.begin(), tmpList.end());
callback.AddMessage(GetString(IDS_NB_FILES_FOUND) + ToString(radarList.size()));
callback.PopTask();
return msg;
}
示例12: Exception
//.........这里部分代码省略.........
if (profile == NULL &&
(m_params.defaultLibrary.empty() || m_params.defaultProfile.empty())) {
DDS::ReturnCode_t rc = dpf->get_default_participant_qos(qos);
if (rc != DDS_RETCODE_OK) {
ostr << "Get default participant Qos profile: " << DdsSupport::getError(rc);
throw Miro::Exception(ostr.str());
}
}
else {
DDS::ReturnCode_t rc = dpf->get_participant_qos_from_profile(qos, library, profile);
if (rc != DDS_RETCODE_OK) {
ostr << "Load participant Qos profile: " << DdsSupport::getError(rc);
throw Miro::Exception(ostr.str());
}
}
// set participant name from Miro parameters
if (!first->participantName.empty()) {
qos.participant_name.name = DDS_String_dup(first->participantName.c_str());
}
// handle discovery-peers processing
// just print the stuff as a first step...
if (!first->discoveryPeersFiles.empty()) {
DDS_DiscoveryQosPolicy& discovery = qos.discovery;
StringVector peers;
StringVector::const_iterator f, l = first->discoveryPeersFiles.end();
for (f = first->discoveryPeersFiles.begin(); f != l; ++f) {
StringVector const p = parseDiscoveryPeersFile(*f);
peers.insert(peers.end(), p.begin(), p.end());
}
// set peers list in qos
if (discovery.initial_peers.maximum() < (int)peers.size()) {
discovery.initial_peers.maximum(peers.size());
}
discovery.initial_peers.length(peers.size());
for (int i = 0; i < discovery.initial_peers.length(); ++i) {
assert (peers[i].length() < 100);
DDS_String_free(discovery.initial_peers[i]);
discovery.initial_peers[i] = DDS_String_dup(peers[i].c_str());
}
MIRO_LOG_OSTR(LL_NOTICE, "DDS Initial peers layout for " << qos.participant_name.name);
for (int i = 0; i < qos.discovery.initial_peers.length(); ++i) {
MIRO_LOG_OSTR(LL_NOTICE, qos.discovery.initial_peers[i]);
}
}
#ifdef KNDDS_HAS_DDS_Monitor
if (first->enableMonitor) {
int rc;
rc = DDS_PropertyQosPolicyHelper_add_property(&qos.property,
"rti.monitor.library",
"rtimonintoring",
DDS_BOOLEAN_FALSE);
assert (rc == DDS_RETCODE_OK);
char valueBuffer[17];
sprintf(valueBuffer, "%p", RTIDefaultMonitor_create);
rc = DDS_PropertyQosPolicyHelper_add_property(&qos.property,
"rti.monitor.create_function_ptr",