本文整理汇总了C++中JRegex::MatchAfter方法的典型用法代码示例。如果您正苦于以下问题:C++ JRegex::MatchAfter方法的具体用法?C++ JRegex::MatchAfter怎么用?C++ JRegex::MatchAfter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JRegex
的用法示例。
在下文中一共展示了JRegex::MatchAfter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetX
void
GDBPlot2DCommand::HandleSuccess
(
const JString& data
)
{
JArray<JFloat>* x = GetX();
JArray<JFloat>* y = GetY();
if ((GetLastResult()).BeginsWith("error,msg=\"No symbol"))
{
x->RemoveAll();
y->RemoveAll();
return;
}
const JIndex count = x->GetElementCount();
JIndex i;
JIndexRange r;
JArray<JIndexRange> matchRange1, matchRange2;
JString v1, v2;
for (i=1; i<=count; i++)
{
if (!prefixPattern.MatchAfter(data, r, &matchRange1))
{
break;
}
r = matchRange1.GetElement(1);
if (!prefixPattern.MatchAfter(data, r, &matchRange2))
{
break;
}
r = matchRange2.GetElement(1);
v1 = data.GetSubstring(matchRange1.GetElement(2));
v1.TrimWhitespace();
v2 = data.GetSubstring(matchRange2.GetElement(2));
v2.TrimWhitespace();
JFloat x1, y1;
if (!v1.ConvertToFloat(&x1) ||
!v2.ConvertToFloat(&y1))
{
break;
}
x->SetElement(i, x1);
y->SetElement(i, y1);
}
if (i <= count)
{
const JSize delta = count - (i-1);
x->RemoveNextElements(count - delta + 1, delta);
y->RemoveNextElements(count - delta + 1, delta);
}
}
示例2: if
JBoolean
JGetUserMountPointList
(
JMountPointList* list,
JMountState* state
)
{
JProcess* p;
int outFD;
const JError err = JProcess::Create(&p, kMountCmd,
kJIgnoreConnection, NULL,
kJCreatePipe, &outFD,
kJIgnoreConnection, NULL);
if (!err.OK())
{
if (state != NULL)
{
jdelete state->mountCmdOutput;
state->mountCmdOutput = NULL;
}
return kJFalse;
}
JString mountData;
JReadAll(outFD, &mountData);
p->WaitUntilFinished();
const JBoolean success = p->SuccessfulFinish();
jdelete p;
p = NULL;
if (!success)
{
if (state != NULL)
{
jdelete state->mountCmdOutput;
state->mountCmdOutput = NULL;
}
return kJFalse;
}
if (state != NULL && state->mountCmdOutput != NULL &&
mountData == *(state->mountCmdOutput))
{
return kJFalse;
}
list->CleanOut();
if (state != NULL && state->mountCmdOutput == NULL)
{
state->mountCmdOutput = jnew JString(mountData);
assert( state->mountCmdOutput != NULL );
}
else if (state != NULL)
{
*(state->mountCmdOutput) = mountData;
}
JIndexRange r;
JArray<JIndexRange> matchList;
JString options;
ACE_stat stbuf;
while (theLinePattern.MatchAfter(mountData, r, &matchList))
{
r = matchList.GetFirstElement();
options = mountData.GetSubstring(matchList.GetElement(4));
if (options.Contains("nobrowse"))
{
continue;
}
JString* path = jnew JString(mountData.GetSubstring(matchList.GetElement(3)));
assert( path != NULL );
JString* devicePath = jnew JString(mountData.GetSubstring(matchList.GetElement(2)));
assert( devicePath != NULL );
const JMountType type =
JGetUserMountPointType(*path, *devicePath, "");
if (type == kJUnknownMountType ||
ACE_OS::stat(*path, &stbuf) != 0)
{
jdelete path;
jdelete devicePath;
continue;
}
JFileSystemType fsType = kOtherFSType;
if (options.Contains("msdos"))
{
fsType = kVFATType;
}
list->AppendElement(JMountPoint(path, type, stbuf.st_dev, devicePath, fsType));
}
return kJTrue;
}
示例3: stream
void
GDBGetStack::HandleSuccess
(
const JString& cmdData
)
{
JTreeNode* root = (GetTree())->GetRoot();
JIndex initFrameIndex = 0;
const JString& data = GetLastResult();
std::istringstream stream(data.GetCString());
JIndexRange origRange, newRange;
JStringPtrMap<JString> map(JPtrArrayT::kDeleteAll);
JString frameName, fileName;
while (framePattern.MatchAfter(data, origRange, &newRange))
{
stream.seekg(newRange.last);
if (!GDBLink::ParseMap(stream, &map))
{
(CMGetLink())->Log("invalid data map");
break;
}
origRange.first = origRange.last = ((std::streamoff) stream.tellg()) + 1;
JString* s;
JIndex frameIndex;
if (!map.GetElement("level", &s))
{
(CMGetLink())->Log("missing frame index");
continue;
}
if (!s->ConvertToUInt(&frameIndex))
{
(CMGetLink())->Log("frame index is not integer");
continue;
}
frameName = *s;
while (frameName.GetLength() < kFrameIndexWidth)
{
frameName.PrependCharacter('0');
}
frameName += ": ";
JString* fnName;
if (!map.GetElement("func", &fnName))
{
(CMGetLink())->Log("missing function name");
continue;
}
frameName += *fnName;
if (map.GetElement("file", &s))
{
fileName = *s;
}
JIndex lineIndex = 0;
if (map.GetElement("line", &s) &&
!s->ConvertToUInt(&lineIndex))
{
(CMGetLink())->Log("line number is not integer");
continue;
}
CMStackFrameNode* node =
new CMStackFrameNode(root, frameIndex, frameName,
fileName, lineIndex);
assert( node != NULL );
root->Prepend(node);
if (assertPattern.Match(*fnName))
{
initFrameIndex = frameIndex + 1;
}
}
itsArgsCmd->Send();
(GetWidget())->FinishedLoading(initFrameIndex);
}