本文整理汇总了C++中OovStringVec::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ OovStringVec::push_back方法的具体用法?C++ OovStringVec::push_back怎么用?C++ OovStringVec::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OovStringVec
的用法示例。
在下文中一共展示了OovStringVec::push_back方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addConfig
void OptionsDialog::addConfig()
{
GtkEntry *newNameEntry = GTK_ENTRY(Builder::getBuilder()->getWidget("NewConfigNameEntry"));
// Update the build config option
std::string compStr = mProjectOptions.getValue(OptBuildConfigs);
CompoundValue compVal;
compVal.parseString(compStr);
OovString newName = Gui::getText(newNameEntry);
OovStringVec cfgs = compVal;
cfgs.push_back(BuildConfigAnalysis);
cfgs.push_back(BuildConfigDebug);
cfgs.push_back(BuildConfigRelease);
bool found = std::find(cfgs.begin(), cfgs.end(), newName) != cfgs.end();
if(!found)
{
compVal.addArg(newName);
mProjectOptions.setNameValue(OptBuildConfigs, compVal.getAsString());
// Leave what is on the screen, and change the config name.Save the
// screen data to the new config.
mCurrentBuildConfig = newName;
// ScreenOptions options(mCurrentBuildConfig);
// options.screenToOptions();
updateBuildConfig();
}
else
Gui::messageBox("Configuration already exists", GTK_MESSAGE_INFO);
}
示例2: getAllCrcLinkArgs
const OovStringVec ProjectBuildArgs::getAllCrcLinkArgs() const
{
OovStringVec vec;
for(auto item : mLinkArgs)
vec.push_back(item.mString);
std::copy(mPackageCrcLinkArgs.begin(), mPackageCrcLinkArgs.end(),
std::back_inserter(vec));
return vec;
}
示例3: updateArgs
void ProjectBuildArgs::updateArgs()
{
OovStringVec args;
CompoundValue baseArgs;
baseArgs.parseString(mBuildEnv.getValue(OptCppArgs));
for(auto const &arg : baseArgs)
{
args.push_back(arg);
}
parseArgs(args);
}
示例4: getMatchingNames
OovStringVec NameValueRecord::getMatchingNames(OovStringRef const baseName) const
{
OovStringVec names;
int len = baseName.numBytes();
for(auto const &nv : mNameValues)
{
if(nv.first.compare(0, len, baseName, len) == 0)
{
names.push_back(nv.first);
}
}
return names;
}
示例5: getComponentNamesByType
OovStringVec ComponentTypesFile::getComponentNamesByType(eCompTypes cft) const
{
OovStringVec allCompNames = CompoundValueRef::parseString(
mCompTypesFile.getValue("Components"));
OovStringVec filteredNames;
for(auto const &compName : allCompNames)
{
if(getComponentType(compName) == cft)
{
filteredNames.push_back(compName);
}
}
return filteredNames;
}
示例6: StringSplit
OovStringVec StringSplit(char const * const str, char const * const delimiterStr)
{
OovString tempStr = str;
OovStringVec tokens;
size_t start = 0;
size_t end = 0;
const size_t delimLen = strlen(delimiterStr);
while(end != std::string::npos)
{
end = tempStr.find(delimiterStr, start);
size_t len = (end == std::string::npos) ? std::string::npos : end - start;
OovString splitStr = tempStr.substr(start, len);
tokens.push_back(splitStr);
start = (( end > (std::string::npos - delimLen)) ?
std::string::npos : end + delimLen);
}
return tokens;
}
示例7: drawClass
GraphSize OperationDrawer::drawClass(DiagramDrawer &drawer, const OperationClass &node,
const OperationDrawOptions & /*options*/, bool draw)
{
GraphPoint startpos = node.getPosition();
const ModelType *type = node.getType();
OovStringRef const typeName = type->getName();
int rectx = 0;
int recty = 0;
const ModelClassifier *classifier = type->getClass();
if(classifier)
{
if(draw)
{
drawer.groupText(true, false);
}
OovStringVec strs;
std::vector<GraphPoint> positions;
strs.push_back(typeName);
splitStrings(strs, 30, 40);
for(auto const &str : strs)
{
recty += mCharHeight + (mPad * 2);
positions.push_back(GraphPoint(startpos.x+mPad, startpos.y + recty - mPad));
int curx = static_cast<int>(drawer.getTextExtentWidth(str)) + mPad*2;
if(curx > rectx)
rectx = curx;
}
if(draw)
{
drawer.groupShapes(true, Color(0,0,0), Color(245,245,255));
drawer.drawRect(GraphRect(startpos.x, startpos.y, rectx, recty));
drawer.groupShapes(false, Color(0,0,0), Color(245,245,255));
for(size_t i=0; i<strs.size(); i++)
{
drawer.drawText(positions[i], strs[i]);
}
drawer.groupText(false, false);
}
}
return GraphSize(rectx, recty);
}
示例8: codeComplete
OovStringVec Tokenizer::codeComplete(size_t offset)
{
CLangAutoLock lock(mCLangLock, __LINE__, this);
OovStringVec strs;
unsigned options = 0;
// This gets more than we want.
// unsigned options = clang_defaultCodeCompleteOptions();
unsigned int line;
unsigned int column;
getLineColumn(offset, line, column);
CXCodeCompleteResults *results = clang_codeCompleteAt(mTransUnit,
mSourceFilename.getStr(), line, column,
nullptr, 0, options);
if(results)
{
clang_sortCodeCompletionResults(&results->Results[0], results->NumResults);
for(size_t ri=0; ri<results->NumResults /*&& ri < 50*/; ri++)
{
OovString str;
CXCompletionString compStr = results->Results[ri].CompletionString;
size_t numChunks = clang_getNumCompletionChunks(compStr);
for(size_t ci=0; ci<numChunks && ci < 30; ci++)
{
CXCompletionChunkKind chunkKind = clang_getCompletionChunkKind(compStr, ci);
// We will discard return values from functions, so the first
// chunk returned will be the identifier or function name. Function
// arguments will be returned after a space, so they can be
// discarded easily.
if(chunkKind == CXCompletionChunk_TypedText || str.length())
{
std::string chunkStr = getDisposedString(clang_getCompletionChunkText(compStr, ci));
if(str.length() != 0)
str += ' ';
str += chunkStr;
}
}
strs.push_back(str);
}
clang_disposeCodeCompleteResults(results);
}
return strs;
}
示例9: getDiagResults
OovStringVec Tokenizer::getDiagResults()
{
OovStringVec diagResults;
if(mTransUnit)
{
int numDiags = clang_getNumDiagnostics(mTransUnit);
for (int i = 0; i<numDiags && diagResults.size() < 10; i++)
{
CXDiagnostic diag = clang_getDiagnostic(mTransUnit, i);
// CXDiagnosticSeverity sev = clang_getDiagnosticSeverity(diag);
// if(sev >= CXDiagnostic_Error)
OovString diagStr = getDisposedString(clang_formatDiagnostic(diag,
clang_defaultDiagnosticDisplayOptions()));
if(diagStr.find(mSourceFilename) != std::string::npos)
{
diagResults.push_back(diagStr);
}
}
}
return diagResults;
}
示例10: parseStringRef
void CompoundValueRef::parseStringRef(OovStringRef const strIn,
OovStringVec &vec, char delimiter)
{
OovString str = strIn;
size_t startArgPos = 0;
while(startArgPos != std::string::npos)
{
size_t endColonPos = str.find(delimiter, startArgPos);
std::string tempStr = str.substr(startArgPos, endColonPos-startArgPos);
// For compatibility with previous files, allow a string that is
// after the last colon. Previous versions that had the extra string
// did not allow null strings.
if(endColonPos != std::string::npos || tempStr.length() > 0)
{
vec.push_back(tempStr);
}
startArgPos = endColonPos;
if(startArgPos != std::string::npos)
startArgPos++;
}
}
示例11: updateConnections
void ComponentGraph::updateConnections(const ComponentTypesFile &compFile,
const ComponentDrawOptions &options)
{
BuildPackages buildPkgs(true);
std::vector<Package> packages = buildPkgs.getPackages();
mConnections.clear();
OovStringVec compPaths;
for(size_t i=0; i<mNodes.size(); i++)
{
if(mNodes[i].getComponentNodeType() == ComponentNode::CNT_Component)
{
std::string incPath;
incPath = compFile.getComponentAbsolutePath(mNodes[i].getName());
compPaths.push_back(incPath);
}
}
// This is slow - look to improve?
for(size_t consumerIndex=0; consumerIndex<mNodes.size(); consumerIndex++)
{
if(mNodes[consumerIndex].getComponentNodeType() == ComponentNode::CNT_Component)
{
OovStringVec srcFiles = compFile.getComponentFiles(
ComponentTypesFile::CFT_CppSource, mNodes[consumerIndex].getName());
for(auto const &srcFile : srcFiles)
{
FilePath fp;
fp.getAbsolutePath(srcFile, FP_File);
OovStringVec incDirs =
mIncludeMap->getNestedIncludeDirsUsedBySourceFile(fp);
for(auto const &incDir : incDirs)
{
size_t supplierIndex = getComponentIndex(compPaths, incDir);
if(supplierIndex != NO_INDEX && consumerIndex != supplierIndex)
mConnections.insert(ComponentConnection(consumerIndex, supplierIndex));
}
}
}
}
for(size_t supplierIndex=0; supplierIndex<mNodes.size(); supplierIndex++)
{
if(mNodes[supplierIndex].getComponentNodeType() == ComponentNode::CNT_ExternalPackage)
{
OovString const &nodeName = mNodes[supplierIndex].getName();
auto const &supplierIt = std::find_if(packages.begin(), packages.end(),
[nodeName](Package const &pkg) -> bool
{ return(pkg.getPkgName().compare(nodeName) == 0); });
if(supplierIt != packages.end())
{
for(size_t consumerIndex=0; consumerIndex<mNodes.size(); consumerIndex++)
{
if(mNodes[consumerIndex].getComponentNodeType() == ComponentNode::CNT_Component)
{
OovStringVec incRoots = (*supplierIt).getIncludeDirs();
if(mIncludeMap->anyRootDirsMatch(incRoots, compPaths[consumerIndex]))
{
mConnections.insert(ComponentConnection(consumerIndex, supplierIndex));
}
}
}
}
}
}
if(!options.drawImplicitRelations)
pruneConnections();
}
示例12: getCompLibrariesAndIncs
OovStringVec CMaker::getCompLibrariesAndIncs(OovStringRef const compName,
OovStringVec &extraIncDirs)
{
OovStringVec libs;
/*
OovStringVec projectLibFileNames;
mObjSymbols.appendOrderedLibFileNames("ProjLibs", getSymbolBasePath(),
projectLibFileNames);
*/
/// @todo - this does not order the libraries.
OovStringVec srcFiles = mCompTypes.getComponentSources(compName);
OovStringSet projLibs;
OovStringSet extraIncDirsSet;
OovStringVec compNames = mCompTypes.getComponentNames(true);
for(auto const &srcFile : srcFiles)
{
FilePath fp;
fp.getAbsolutePath(srcFile, FP_File);
OovStringVec incDirs =
mIncMap.getNestedIncludeDirsUsedBySourceFile(fp);
for(auto const &supplierCompName : compNames)
{
ComponentTypesFile::eCompTypes compType =
mCompTypes.getComponentType(supplierCompName);
if(compType == ComponentTypesFile::CT_StaticLib ||
compType == ComponentTypesFile::CT_Unknown)
{
std::string compDir = mCompTypes.getComponentAbsolutePath(
supplierCompName);
for(auto const &incDir : incDirs)
{
if(compDir.compare(incDir) == 0)
{
if(supplierCompName.compare(compName) != 0)
{
if(compType == ComponentTypesFile::CT_StaticLib)
{
projLibs.insert(makeComponentNameFromDir(
supplierCompName));
}
else
{
/// @todo - this could check for include files in the dir
extraIncDirsSet.insert(makeRelativeComponentNameFromDir(
compName, supplierCompName));
}
break;
}
}
}
}
}
}
std::copy(projLibs.begin(), projLibs.end(), std::back_inserter(libs));
std::copy(extraIncDirsSet.begin(), extraIncDirsSet.end(),
std::back_inserter(extraIncDirs));
for(auto const &pkg : mBuildPkgs.getPackages())
{
OovString compDir = mCompTypes.getComponentAbsolutePath(compName);
OovStringVec incRoots = pkg.getIncludeDirs();
if(mIncMap.anyRootDirsMatch(incRoots, compDir))
{
if(pkg.getPkgName().compare(compName) != 0)
{
OovString pkgRef = "${";
OovString pkgDefName;
makeDefineName(pkg.getPkgName(), pkgDefName);
pkgRef += pkgDefName + "_LIBRARIES}";
libs.push_back(pkgRef);
}
}
}
return libs;
}