本文整理汇总了C++中nglString::Extract方法的典型用法代码示例。如果您正苦于以下问题:C++ nglString::Extract方法的具体用法?C++ nglString::Extract怎么用?C++ nglString::Extract使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nglString
的用法示例。
在下文中一共展示了nglString::Extract方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetConstraint
void nuiLayout::SetConstraint(nuiWidget* pWidget, const nglString& rDescription)
{
nuiLayoutConstraint constraintH, constraintV;
int pos = rDescription.Find('/');
if (pos < 0)
{
nglString desc(rDescription);
desc.Trim();
constraintH.Set(desc);
}
else if (pos == 0)
{
nglString desc2 = rDescription.Extract(pos+1, rDescription.GetLength() - (pos + 1));
desc2.Trim();
constraintV.Set(desc2);
}
else
{
nglString desc1 = rDescription.Extract(0, pos);
nglString desc2 = rDescription.Extract(pos+1, rDescription.GetLength() - (pos + 1));
desc1.Trim();
desc2.Trim();
constraintH.Set(desc1);
constraintV.Set(desc2);
}
SetConstraint(pWidget, constraintH, constraintV);
}
示例2: GetAbsoluteURL
void nuiHTML::GetAbsoluteURL(const nglString& rBaseURL, nglString& url)
{
int32 colon = url.Find(':');
if (colon > 0)
{
// complete url link
}
else if (url[0] == '/')
{
// Site absolute
int32 col = rBaseURL.Find(_T("://"));
if (col > 0)
{
int32 end = rBaseURL.Find('/', col + 3);
if (end)
url = rBaseURL.Extract(0, end) + url;
}
}
else
{
// Site relative
int32 end = rBaseURL.FindLast(_T('/'));
if (end >= 0)
{
url = rBaseURL.Extract(0, end + 1) + url;
}
else
{
url = rBaseURL + _T("/") + url;
}
}
Canonize(url);
}
示例3: Input
void nglConsole::Input (nglString& rLine)
{
#if NGL_DISABLE_CONSOLE
return;
#else
rLine.TrimRight();
if (mUseHExpansion && (!rLine.Compare(_T("!"), 0, 1)))
{
list<nglString*>::iterator h_entry;
list<nglString*>::iterator h_end = mHistory.end();
nglString base = rLine.Extract (1, -1);
int size = base.GetLength();
for (h_entry = mHistory.begin(); h_entry != h_end; ++h_entry)
if (*h_entry)
{
if ((!base.Compare(_T("!"), 0, 1)) || // "!!" (repeat last)
(!(*h_entry)->Compare (base, 0, size, mHistoryCase)))
{
NGL_OUT(_T("%s\n"), (nglChar*)(*h_entry));
OnInput (**h_entry);
return;
}
}
}
OnInput (rLine);
#endif
}
示例4: Canonize
static bool Canonize(nglString& rStr)
{
nglString canon;
int32 len = rStr.GetLength();
int32 root_part = GetRootPart(rStr);
int32 last_slash = root_part;
int32 slash = 0;
canon = rStr.GetLeft(root_part);
while (slash < len)
{
slash = rStr.Find(_T('/'), last_slash);
if (slash == - 1)
slash = len;
if (((slash - last_slash) == 1) && (rStr.GetChar(last_slash) == _T('.')))
{
// Ignore '.'
}
else
if (((slash - last_slash) == 2) && (!rStr.Compare(_T(".."), last_slash, 2)))
{
// Interpret '..'
int32 prev_slash = canon.FindLast(_T('/'));
if (prev_slash < root_part)
prev_slash = root_part;
if (!canon.IsEmpty() && canon.Compare(_T(".."), canon.GetLength() - 2, 2))
canon.Delete(prev_slash);
else
{
if (canon.GetLength() > root_part)
canon += _T('/');
canon += _T("..");
}
}
else
{
// Simply append path node
nglString node = rStr.Extract(last_slash, (slash - last_slash));
if (canon.GetLength() > root_part)
canon += _T('/');
canon += node;
}
last_slash = slash + 1;
}
rStr = canon;
return true;
}
示例5: Find
nuiWidgetPtr nuiContainer::Find(const nglString& rName)
{
CheckValid();
int slash = rName.Find('/');
if (slash >= 0)
{
nglString path = rName.GetLeft(slash);
nglString rest = rName.Extract(slash + 1);
nuiWidgetPtr node = SearchForChild(path, false);
return node ? node->Find(rest) : NULL;
}
else
return SearchForChild(rName,false);
}
示例6: if
nuiAttribute<nuiAnchorType>(const nglString& rName, nuiLayout* pLayout)
: nuiAttribute<int32>(rName, nuiUnitNone, nuiMakeDelegate(this, &nuiAttribute<nuiAnchorType>::_Get), nuiMakeDelegate(this, &nuiAttribute<nuiAnchorType>::_Set), NUI_INVALID_RANGE),
mAnchor(rName.Extract(13))
{
nuiAttributeBase::SetAsInstanceAttribute(true);
if (rName.CompareLeft("HAnchorsType_", true) == 0)
{
mGetAnchorDelegate = nuiMakeDelegate(pLayout, &nuiLayout::GetHorizontalAnchorType);
mSetAnchorDelegate = nuiMakeDelegate(pLayout, &nuiLayout::SetHorizontalAnchorType);
}
else if (rName.CompareLeft("VAnchorsType_", true) == 0)
{
mGetAnchorDelegate = nuiMakeDelegate(pLayout, &nuiLayout::GetVerticalAnchorType);
mSetAnchorDelegate = nuiMakeDelegate(pLayout, &nuiLayout::SetVerticalAnchorType);
}
}
示例7: Set
bool nuiLayoutConstraint::Set(const nglString& rDescription)
{
int index = 0;
nglUChar c = rDescription.GetNextUChar(index);
if (c == '[')
{
// Fix start + ?
int pos = index;
int end = index;
c = rDescription.GetNextUChar(index);
while (c != ',' && c != '}')
{
end = index;
c = rDescription.GetNextUChar(index);
}
nglString anchor1 = rDescription.Extract(pos, index - pos - 1);
anchor1.Trim();
if (c == ',')
{
// Fix stop or fix size
int pos = index;
int end = index;
c = rDescription.GetNextUChar(index);
while (c != ']' && c != '}')
{
end = index;
c = rDescription.GetNextUChar(index);
}
nglString anchor2 = rDescription.Extract(pos, index - pos - 1);
anchor2.Trim();
if (c == ']')
{
// Start and Stop:
SetStartAndStop(anchor1, anchor2);
return true;
}
else if (c == '}')
{
// Start and size:
SetStartAndSize(anchor1, anchor2.GetCFloat());
return true;
}
}
else if (c == '}')
{
// Fix start
SetStart(anchor1);
return true;
}
}
else if (c == '{')
{
// Fix end + ?
int pos = index;
int end = index;
c = rDescription.GetNextUChar(index);
while (c != ',' && c != '}' && c != ']')
{
end = index;
c = rDescription.GetNextUChar(index);
}
nglString anchor1 = rDescription.Extract(pos, index - pos - 1);
anchor1.Trim();
if (c == ',')
{
// Fix stop or fix size
int pos = index;
int end = index;
c = rDescription.GetNextUChar(index);
while (c != ']' && c != '}' && c != ',')
{
end = index;
c = rDescription.GetNextUChar(index);
}
nglString anchor2 = rDescription.Extract(pos, index - pos - 1);
anchor2.Trim();
if (c == ']')
{
// size and Stop:
SetStopAndSize(anchor2, anchor1.GetCFloat());
return true;
}
else if (c == '}')
{
// Midle and size:
if (anchor2.IsFloat())
SetMiddleAndSize(anchor1, anchor2.GetCFloat());
else
//.........这里部分代码省略.........