本文整理汇总了C++中OovString::substr方法的典型用法代码示例。如果您正苦于以下问题:C++ OovString::substr方法的具体用法?C++ OovString::substr怎么用?C++ OovString::substr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OovString
的用法示例。
在下文中一共展示了OovString::substr方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: insertLine
void NameValueRecord::insertLine(OovString lineBuf)
{
size_t colonPos = lineBuf.find(mapDelimiter);
if(colonPos != std::string::npos)
{
std::string key = lineBuf.substr(0, colonPos);
size_t termPos = lineBuf.find('\n');
std::string value = lineBuf.substr(colonPos+1, termPos-(colonPos+1));
setNameValue(key, value);
}
}
示例2: 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;
}
示例3: 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++;
}
}
示例4: onIdle
gboolean Editor::onIdle(gpointer data)
{
if(mDebugOut.length())
{
GtkTextView *view = GTK_TEXT_VIEW(ControlWindow::getTabView(
ControlWindow::CT_Control));
Gui::appendText(view, mDebugOut);
Gui::scrollToCursor(view);
mDebugOut.clear();
}
eDebuggerChangeStatus dbgStatus = mDebugger.getChangeStatus();
if(dbgStatus != DCS_None)
{
idleDebugStatusChange(dbgStatus);
}
getEditFiles().onIdle();
OovIpcMsg msg;
if(mEditorIpc.getMessage(msg))
{
OovString cmd = msg.getArg(0);
if(cmd[0] == EC_ViewFile)
{
OovString fn = msg.getArg(1);
OovString lineNumStr = msg.getArg(2);
int lineNum = 1;
size_t pos = lineNumStr.findSpace();
if(pos != std::string::npos)
{
lineNumStr = lineNumStr.substr(0, pos);
}
if(lineNumStr.getInt(0, INT_MAX, lineNum))
{
}
gEditor->getEditFiles().viewModule(fn, lineNum);
}
}
sleepMs(5);
return true;
}