本文整理汇总了C++中OovString类的典型用法代码示例。如果您正苦于以下问题:C++ OovString类的具体用法?C++ OovString怎么用?C++ OovString使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OovString类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isDevelopment
static bool isDevelopment()
{
static enum eDevel { Uninit, Devel, Deploy } devel;
if(devel == Uninit)
{
OovString path = Project::getBinDirectory();
size_t pos = path.find("bin");
if(pos != std::string::npos)
{
path.replace(pos, 3, "lib");
}
OovStatus status(true, SC_File);
if(FileIsDirOnDisk(path, status))
{
devel = Deploy;
}
else
{
devel = Devel;
}
if(status.needReport())
{
status.reported();
}
}
return(devel == Devel);
}
示例2: FilePathGetWithoutEndPathSep
OovString FilePathGetWithoutEndPathSep(
OovStringRef const path)
{
OovString str = path;
FilePathRemovePathSep(str, str.length()-1);
return str;
}
示例3: getPathSegment
int FilePath::discardLeadingRelSegments()
{
int count = 0;
bool didSeg = true;
do
{
OovString seg = getPathSegment(0);
if(seg.compare("..") == 0)
{
CHECKSIZE(__FILE__, __LINE__, size(), 3);
pathStdStr().erase(0, 3);
count++;
}
else if(seg.compare(".") == 0)
{
CHECKSIZE(__FILE__, __LINE__, size(), 2);
pathStdStr().erase(0, 2);
}
else
{
didSeg = false;
}
} while(didSeg);
return count;
}
示例4: status
bool CppFileContents::write(OovStringRef const fn)
{
SimpleFile file;
eOpenStatus openStat = file.open(fn, M_WriteExclusiveTrunc, OE_Binary);
OovStatus status(openStat == OS_Opened, SC_File);
if(status.ok())
{
OovString includeCov = "#include \"OovCoverage.h\"";
appendLineEnding(includeCov);
updateMemory();
status = file.write(includeCov.c_str(), includeCov.length());
}
if(status.ok())
{
status = file.write(mFileContents.data(), mFileContents.size());
}
if(!status.ok())
{
OovString str = "Unable to write %s ";
str += fn;
str += "\n";
status.report(ET_Error, str.getStr());
}
return status.ok();
}
示例5: mapPath
static bool mapPath(ZonePathMap const &map, OovString const &origName,
OovString &newName)
{
bool replaced = false;
size_t starti = 0;
newName = origName;
do
{
size_t firstFoundi = OovString::npos;
ZonePathReplaceItem const *repItem = nullptr;
for(auto const &mapItem : map)
{
size_t foundi = newName.find(mapItem.mSearchPath, starti);
if(foundi < firstFoundi)
{
repItem = &mapItem;
firstFoundi = foundi;
}
}
if(firstFoundi != OovString::npos)
{
newName.replace(firstFoundi, repItem->mSearchPath.length(),
repItem->mReplacePath);
starti = firstFoundi + repItem->mReplacePath.length();
replaced = true;
}
else
starti = OovString::npos;
} while(starti != OovString::npos);
return replaced;
}
示例6: getEditFiles
void Editor::idleDebugStatusChange(eDebuggerChangeStatus st)
{
if(st == DCS_RunState)
{
getEditFiles().updateDebugMenu();
if(mDebugger.getChildState() == DCS_ChildPaused)
{
auto const &loc = mDebugger.getStoppedLocation();
mEditFiles.viewModule(loc.getFilename(), loc.getLine());
mDebugger.startGetStack();
}
}
else if(st == DCS_Stack)
{
GtkTextView *view = GTK_TEXT_VIEW(ControlWindow::getTabView(
ControlWindow::CT_Stack));
Gui::setText(view, mDebugger.getStack());
}
else if(st == DCS_Value)
{
// mVarView.appendText(GuiTreeItem(), mDebugger.getVarValue().getAsString());
GuiTreeItem item;
appendTree(mVarView, item, mDebugger.getVarValue());
GuiTreeItem root;
int numChildren = mVarView.getNumChildren(root);
OovString numPathStr;
numPathStr.appendInt(numChildren-1);
GuiTreePath path(numPathStr);
mVarView.scrollToPath(path);
}
}
示例7: StringToLower
void StringToLower(OovString &str)
{
for(size_t i=0; i<str.length(); ++i)
{
str.at(i) = static_cast<char>(tolower(str.at(i)));
}
}
示例8: recoverFileName
OovString Project::recoverFileName(OovStringRef const srcFileName)
{
OovString file = srcFileName;
file.replaceStrs("_u", "_");
file.replaceStrs("_s", "/");
file.replaceStrs("_d", ".");
return file;
}
示例9: 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
}
}
示例10: getName
OovString ModelStatement::getOverloadFuncName() const
{
OovString opName = getName();
size_t pos = getRightSidePosFromMemberRefExpr(opName, true);
if(pos != 0)
opName.erase(0, pos);
return opName;
}
示例11: appendTree
// This is recursive.
// This adds items if they does not exist. It preserves the tree
// so that the state of expanded items will not be destroyed.
// childIndex of -1 is special since the name is used to find the item.
static void appendTree(GuiTree &varView, GuiTreeItem &parentItem,
DebugResult const &debResult, int childIndex = -1)
{
OovString varPrefix = debResult.getVarName();
OovString str = varPrefix;
if(debResult.getValue().length() > 0)
{
varPrefix += " : ";
str = varPrefix;
str += debResult.getValue();
}
GuiTreeItem item;
bool foundItem = false;
if(childIndex == -1)
{
if(varView.findImmediateChildPartialMatch(varPrefix, parentItem, item))
{
foundItem = true;
}
}
else
{
foundItem = varView.getNthChild(parentItem, childIndex, item);
}
if(foundItem)
{
varView.setText(item, str);
}
else
{
item = varView.appendText(parentItem, str);
}
/// Remove items that no longer are available for the variable name.
{
int numDataChildren = debResult.getChildResults().size();
int numTreeChildren = varView.getNumChildren(item);
for(int childI=numDataChildren; childI<numTreeChildren; childI++)
{
varView.removeNthChild(item, childI);
}
}
int callerChildIndex = 0;
for(auto const &childRes : debResult.getChildResults())
{
appendTree(varView, item, *childRes.get(), callerChildIndex++);
}
/// @TODO - should only expand added item at parent level?
GuiTreeItem root;
int lastChild = varView.getNumChildren(root) - 1;
OovString numPathStr;
numPathStr.appendInt(lastChild);
GuiTreePath path(numPathStr);
varView.expandRow(path);
}
示例12: getComponentParentName
std::string ComponentTypesFile::getComponentParentName(std::string const &compName)
{
OovString parent = compName;
size_t pos = parent.rfind('/');
if(pos != OovString::npos)
{
parent.erase(pos);
}
return parent;
}
示例13: getComponentChildName
std::string ComponentTypesFile::getComponentChildName(std::string const &compName)
{
OovString child = compName;
size_t pos = child.rfind('/');
if(pos != OovString::npos)
{
child.erase(0, pos+1);
}
return child;
}
示例14: getBinDirectory
OovString const Project::getBinDirectory()
{
static OovString path;
if(path.length() == 0)
{
OovStatus status(true, SC_File);
#ifdef __linux__
char buf[300];
ssize_t len = readlink("/proc/self/exe", buf, sizeof(buf));
if(len >= 0)
{
buf[len] = '\0';
path = buf;
size_t pos = path.rfind('/');
if(pos == std::string::npos)
{
pos = path.rfind('\\');
}
if(pos != std::string::npos)
{
path.resize(pos+1);
}
}
/*
if(FileIsFileOnDisk("./oovaide", status))
{
path = "./";
}
else if(FileIsFileOnDisk("/usr/local/bin/oovaide", status))
{
path = "/usr/local/bin/";
}
*/
else
{
path = "/usr/bin";
}
#else
if(FileIsFileOnDisk("./oovaide.exe", status))
{
path = "./";
}
else
{
path = FilePathGetDrivePath(sArgv0);
}
#endif
if(status.needReport())
{
status.report(ET_Error, "Unable to get bin directory");
}
}
return path;
}
示例15: getCrcAsStr
std::string BuildConfig::getCrcAsStr(OovStringRef const buildType, CrcTypes crcType) const
{
OovString buildStr = mConfigFile.getValue(buildType);
std::vector<OovString> crcStrs = buildStr.split(';');
std::string crcStr;
if(crcStrs.size() == CT_LastCrc+1)
{
crcStr = crcStrs[crcType];
}
return crcStr;
}