本文整理汇总了C++中CL_StringRef::find_first_not_of方法的典型用法代码示例。如果您正苦于以下问题:C++ CL_StringRef::find_first_not_of方法的具体用法?C++ CL_StringRef::find_first_not_of怎么用?C++ CL_StringRef::find_first_not_of使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CL_StringRef
的用法示例。
在下文中一共展示了CL_StringRef::find_first_not_of方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: next_line
void CL_SpanLayout_Impl::next_line(CurrentLine ¤t_line)
{
current_line.cur_line.width = current_line.x_position;
for (std::vector<LineSegment>::reverse_iterator it = current_line.cur_line.segments.rbegin(); it != current_line.cur_line.segments.rend(); ++it)
{
LineSegment &segment = *it;
if (segment.type == object_text)
{
CL_StringRef s = text.substr(segment.start, segment.end-segment.start);
if (s.find_first_not_of(" \t\r\n") != CL_StringRef::npos)
{
current_line.cur_line.width = segment.x_position + segment.width;
break;
}
}
else
{
current_line.cur_line.width = segment.x_position + segment.width;
break;
}
}
int height = current_line.cur_line.height;
lines.push_back(current_line.cur_line);
current_line.cur_line = Line();
current_line.x_position = 0;
current_line.y_position += height;
}
示例2: trim_whitespace
inline CL_StringRef CL_XMLTokenizer_Generic::trim_whitespace(const CL_StringRef &text)
{
CL_StringRef::size_type pos_start = text.find_first_not_of(" \t\r\n");
if (pos_start == CL_StringRef::npos)
return CL_StringRef();
CL_StringRef::size_type pos_end = text.find_last_not_of(" \t\r\n", pos_start);
if (pos_end == CL_StringRef::npos)
{
if (pos_start == 0)
return text;
else
return string_allocator.alloc(text.substr(pos_start));
}
else
{
return string_allocator.alloc(text.substr(pos_start, pos_end - pos_start + 1));
}
}