本文整理汇总了C++中CompoundValue类的典型用法代码示例。如果您正苦于以下问题:C++ CompoundValue类的具体用法?C++ CompoundValue怎么用?C++ CompoundValue使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CompoundValue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: makeCoverageComponentTypesFile
static bool makeCoverageComponentTypesFile(OovStringRef const srcFn, OovStringRef const dstFn)
{
ComponentTypesFile file;
OovStatus status = file.readTypesOnly(srcFn);
if(status.ok())
{
// Define a static library that contains the code that stores
// the coverage counts that is compiled into exectuables.
static OovStringRef const covLibName = Project::getCovLibName();
CompoundValue names = file.getComponentNames();
if(names.find(covLibName) == CompoundValue::npos)
{
names.push_back(covLibName);
file.setComponentNames(names.getAsString());
file.setComponentType(covLibName,
ComponentTypesFile::getShortComponentTypeName(
ComponentTypesFile::CT_StaticLib));
}
status = file.writeTypesOnly(dstFn);
}
if(status.needReport())
{
OovString err = "Unable to make component types file ";
err += srcFn;
status.report(ET_Error, err);
}
return status.ok();
}
示例2: GTK_ENTRY
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);
}
示例3: GTK_TEXT_VIEW
void TextViewOption::screenToOption(NameValueFile &file) const
{
GtkTextView *view = GTK_TEXT_VIEW(Builder::getBuilder()->getWidget(mWidgetName));
std::string str = Gui::getText(view);
CompoundValue cppArgs;
cppArgs.parseString(str, '\n');
std::string newCppArgsStr = cppArgs.getAsString();
file.setNameValue(mOptionName, newCppArgsStr);
}
示例4: optionToScreen
void TextViewOption::optionToScreen(NameValueFile const &file) const
{
CompoundValue cppArgs;
cppArgs.parseString(file.getValue(mOptionName));
GtkTextView *view = GTK_TEXT_VIEW(Builder::getBuilder()->getWidget(mWidgetName));
Gui::clear(view);
std::string str = cppArgs.getAsString('\n');
Gui::appendText(view, str);
}
示例5: updateArgs
void ProjectBuildArgs::updateArgs()
{
OovStringVec args;
CompoundValue baseArgs;
baseArgs.parseString(mBuildEnv.getValue(OptCppArgs));
for(auto const &arg : baseArgs)
{
args.push_back(arg);
}
parseArgs(args);
}
示例6: setComponentFiles
void ComponentTypesFile::setComponentFiles(CompFileTypes cft,
OovStringRef const compName, OovStringSet const &srcs)
{
CompoundValue objArgs;
for(const auto &src : srcs)
{
objArgs.addArg(src);
}
OovString tag = getCompTagName(compName, getCompFileTypeTagName(cft));
mCompSourceListFile.setNameValue(tag, objArgs.getAsString());
}
示例7: getProjectExcludeDirs
CompoundValue ProjectBuildArgs::getProjectExcludeDirs() const
{
CompoundValue val;
val.parseString(mProjectOptions.getValue(OptProjectExcludeDirs));
// This doesn't work.
// val.push_back(sCoverageSourceDir);
// val.push_back(sCoverageProjectDir);
for(size_t i=0; i<val.size(); i++)
{
val[i] = getAbsoluteDirFromSrcRootDirRelativeDir(val[i]);
}
return val;
}
示例8: GTK_COMBO_BOX_TEXT
void BuildSettingsDialog::loadToScreen(std::string const &compName)
{
if(compName.length())
{
GtkComboBoxText *typeBox = GTK_COMBO_BOX_TEXT(Builder::getBuilder()->getWidget(
"ComponentTypeComboboxtext"));
GtkTextView *argsView = GTK_TEXT_VIEW(Builder::getBuilder()->getWidget(
"ComponentBuildArgsTextview"));
int index = mComponentFile.getComponentType(compName);
Gui::setSelected(GTK_COMBO_BOX(typeBox), index);
CompoundValue cppArgs;
cppArgs.parseString(mComponentFile.getComponentBuildArgs(compName));
std::string str = cppArgs.getAsString('\n');
Gui::setText(argsView, str);
}
}
示例9: loadDiagram
bool ClassDiagram::loadDiagram(File &file)
{
NameValueFile nameValFile;
bool success = nameValFile.readFile(file);
if(success)
{
CompoundValue names;
names.parseString(nameValFile.getValue("Names"));
CompoundValue xPositions;
xPositions.parseString(nameValFile.getValue("XPositions"));
CompoundValue yPositions;
yPositions.parseString(nameValFile.getValue("YPositions"));
std::vector<ClassNode> &nodes = getNodes();
for(size_t i=0; i<names.size(); i++)
{
OovString name = names[i];
if(i == 0)
{
// The node at index zero is the graph key, and is not stored in
// the graph with a name or type.
// The node at index one is the first class, which is typically the
// same as the drawing name.
eDiagramStorageTypes drawingType;
OovString drawingName;
DiagramStorage::getDrawingHeader(nameValFile, drawingType, drawingName);
// This adds the key automatically as item index zero.
// Call this function to set the last selected class name for the journal.
clearGraphAndAddClass(drawingName, ClassGraph::AN_All,
ClassDiagram::DEPTH_SINGLE_CLASS, false);
int x=0;
int y=0;
xPositions[i].getInt(0, INT_MAX, x);
yPositions[i].getInt(0, INT_MAX, y);
nodes[0].setPosition(GraphPoint(x, y));
}
else
{
// This will not add duplicates, so if the name is different
// from the drawingName, it will be added.
addClass(name, ClassGraph::AN_All,
ClassDiagram::DEPTH_SINGLE_CLASS, false);
}
auto nodeIter = std::find_if(nodes.begin(), nodes.end(),
[&name](ClassNode &node)
{ return(node.getType() && name == node.getType()->getName()); });
if(nodeIter != nodes.end())
{
int x=0;
int y=0;
xPositions[i].getInt(0, INT_MAX, x);
yPositions[i].getInt(0, INT_MAX, y);
nodeIter->setPosition(GraphPoint(x, y));
}
}
}
return success;
}
示例10: status
OovStatusReturn ClassDiagram::saveDiagram(File &file)
{
OovStatus status(true, SC_File);
NameValueFile nameValFile;
CompoundValue names;
CompoundValue xPositions;
CompoundValue yPositions;
OovString drawingName;
for(auto const &node : mClassGraph.getNodes())
{
if(node.getType())
{
if(drawingName.length() == 0)
{
drawingName = node.getType()->getName();
}
names.addArg(node.getType()->getName());
}
else
{
names.addArg("Oov-Key");
}
OovString num;
num.appendInt(node.getPosition().x);
xPositions.addArg(num);
num.clear();
num.appendInt(node.getPosition().y);
yPositions.addArg(num);
}
if(drawingName.length() > 0)
{
DiagramStorage::setDrawingHeader(nameValFile, DST_Class, drawingName);
nameValFile.setNameValue("Names", names.getAsString());
nameValFile.setNameValue("XPositions", xPositions.getAsString());
nameValFile.setNameValue("YPositions", yPositions.getAsString());
status = nameValFile.writeFile(file);
}
return status;
}
示例11: getValue
bool IncDirDependencyMap::includedPathsChanged(OovStringRef includerFn,
std::set<std::string> const &includedInfoStr) const
{
bool changed = false;
// First check if the includer filename exists in the dependency file.
OovString origIncludedInfoStr = getValue(includerFn);
if(origIncludedInfoStr.size() > 0)
{
CompoundValue origIncludedInfoCompVal;
// get the changed time, which is the first value and discard
// everything else.
origIncludedInfoCompVal.parseString(origIncludedInfoStr);
// Check that counts of the number of includes is the same in
// the new and original map. This will detect deleted includes.
if(origIncludedInfoCompVal.size()-IncDirMapNumTimeVals !=
(includedInfoStr.size() * IncDirMapNumIncPathParts))
{
changed = true;
}
else
{
// Every included file in the new map must exist in the
// original map.
for(const auto &included : includedInfoStr)
{
CompoundValue incPathParts;
incPathParts.parseString(included);
if(incPathParts.size() == 2)
{
if(std::find(origIncludedInfoCompVal.begin(),
origIncludedInfoCompVal.end(), incPathParts[1]) ==
origIncludedInfoCompVal.end())
{
changed = true;
}
}
else
{
changed = true;
}
}
}
}
else
{
changed = true;
}
return changed;
}
示例12: updateBuildConfig
void OptionsDialog::updateBuildConfig()
{
if(mBuildConfigList.getSelected().length() == 0)
{
mCurrentBuildConfig = BuildConfigAnalysis;
mBuildConfigList.setSelected(BuildConfigAnalysis);
}
mBuildConfigList.clear();
mBuildConfigList.appendText(BuildConfigAnalysis);
mBuildConfigList.appendText(BuildConfigDebug);
mBuildConfigList.appendText(BuildConfigRelease);
std::string confStr = mProjectOptions.getValue(OptBuildConfigs);
CompoundValue configVals;
configVals.parseString(confStr);
for(const auto &config:configVals)
{
mBuildConfigList.appendText(config);
}
updateBuildMenu(configVals);
}
示例13: time
/// For every includer file that is run across during parsing, this means that
/// the includer file was fully parsed, and that no old included information
/// needs to be kept, except to check if the old included information has not
/// changed.
///
/// This code assumes that no tricks are played with ifdef values, and
/// ifdef values must be the same every time a the same file is included.
void IncDirDependencyMap::write()
{
bool anyChanges = false;
time_t curTime;
time_t changedTime = 0;
time(&curTime);
#if(SHARED_FILE)
SharedFile file;
if(!writeFileExclusiveReadUpdate(file))
{
fprintf(stderr, "\nOovCppParser - Write file sharing error %s\n", getFilename().c_str());
}
#endif
// Append new values from parsed includes into the original NameValueFile.
// Update existing values times and make new dependencies.
for(const auto &newMapItem : mParsedIncludeDependencies)
{
bool changed = includedPathsChanged(newMapItem.first, newMapItem.second);
if(changed)
{
// Cheat and say updated time and checked time are the same.
changedTime = curTime;
CompoundValue newIncludedInfoCompVal;
OovString changeStr;
changeStr.appendInt(changedTime);
newIncludedInfoCompVal.addArg(changeStr);
OovString checkedStr;
checkedStr.appendInt(curTime);
newIncludedInfoCompVal.addArg(checkedStr);
for(const auto &str : newMapItem.second)
{
size_t pos = newIncludedInfoCompVal.find(str);
if(pos == CompoundValue::npos)
{
newIncludedInfoCompVal.addArg(str);
}
}
setNameValue(newMapItem.first, newIncludedInfoCompVal.getAsString());
anyChanges = true;
}
}
if(file.isOpen() && anyChanges)
{
#if(SHARED_FILE)
if(!writeFileExclusive(file))
{
OovString str = "Unable to write include map file";
OovError::report(ET_Error, str);
}
#else
writeFile();
#endif
}
}
示例14: addCLangArgs
static void addCLangArgs(CompoundValue &cv)
{
cv.addArg("-x");
cv.addArg("c++");
cv.addArg("-std=c++11");
}
示例15: setDefaultOptions
void OptionsDefaults::setDefaultOptions()
{
CompoundValue baseArgs;
CompoundValue extraCppDocArgs;
CompoundValue extraCppRlsArgs;
CompoundValue extraCppDbgArgs;
baseArgs.addArg("-c");
bool useCLangBuild = false;
#ifdef __linux__
// baseArgs.addArg("-ER/usr/include/gtk-3.0");
// baseArgs.addArg("-ER/usr/lib/x86_64-linux-gnu/glib-2.0/include");
OovStatus status(true, SC_File);
if(FileIsFileOnDisk("/usr/bin/clang++", status))
useCLangBuild = true;
if(status.needReport())
{
status.reported();
}
#else
std::string path = getenv("PATH");
if(path.find("LLVM") != std::string::npos)
{
useCLangBuild = true;
}
/*
// On Windows, GTK includes gmodule, glib, etc., so no reason to get mingw.
bool success = addExternalReference(path, "gtk", baseArgs);
if(!success)
{
addExternalReference(path, "mingw", baseArgs);
}
addExternalReference(path, "qt", baseArgs);
*/
#endif
// The GNU compiler cannot have these, but the clang compiler requires them.
// CLang 3.2 does not work on Windows well, so GNU is used on Windows for
// building, but CLang is used for XMI parsing.
// These are important for xmi parsing to show template relations
if(useCLangBuild)
{
addCLangArgs(baseArgs);
}
else
{
addCLangArgs(extraCppDocArgs);
extraCppDbgArgs.addArg("-std=c++0x");
extraCppRlsArgs.addArg("-std=c++0x");
}
extraCppDbgArgs.addArg("-O0");
extraCppDbgArgs.addArg("-g3");
extraCppRlsArgs.addArg("-O3");
#ifdef __linux__
mProject.setNameValue(OptToolDebuggerPath, "/usr/bin/gdb");
#else
// This works without setting the full path.
// The path could be /MinGW/bin, or could be /Program Files/mingw-builds/...
mProject.setNameValue(OptToolDebuggerPath, "gdb.exe");
#endif
setBuildConfigurationPaths(mProject, BuildConfigAnalysis,
extraCppDocArgs.getAsString(), useCLangBuild);
setBuildConfigurationPaths(mProject, BuildConfigDebug,
extraCppDbgArgs.getAsString(), useCLangBuild);
setBuildConfigurationPaths(mProject, BuildConfigRelease,
extraCppRlsArgs.getAsString(), useCLangBuild);
mProject.setNameValue(OptBaseArgs, baseArgs.getAsString());
}