当前位置: 首页>>代码示例>>C++>>正文


C++ xr_string::clear方法代码示例

本文整理汇总了C++中xr_string::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ xr_string::clear方法的具体用法?C++ xr_string::clear怎么用?C++ xr_string::clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在xr_string的用法示例。


在下文中一共展示了xr_string::clear方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CutFirstColoredTextEntry

void CUILines::CutFirstColoredTextEntry(xr_string& entry, u32& color, xr_string& text) const {
    entry.clear();

    StrSize begin	= text.find(BEGIN);
    StrSize end	= text.find(END, begin);
    if (xr_string::npos == end)
        begin = end;
    StrSize begin2	= text.find(BEGIN, end);
    StrSize end2	= text.find(END,begin2);
    if (xr_string::npos == end2)
        begin2 = end2;

    // if we do not have any color entry or it is single with 0 position
    if (xr_string::npos == begin)
    {
        entry = text;
        color = m_dwTextColor;
        text.clear();
    }
    else if (0 == begin && xr_string::npos == begin2)
    {
        entry = text;
        color = GetColorFromText(entry);
        entry.replace(begin, end - begin + 1, "");
        text.clear();
    }
    // if we have color entry not at begin
    else if (0 != begin)
    {
        entry = text.substr(0, begin );
        color = m_dwTextColor;
        text.replace(0, begin, "");
    }
    // if we have two color entries. and first has 0 position
    else if (0 == begin && xr_string::npos != begin2)
    {
        entry = text.substr(0, begin2);
        color = GetColorFromText(entry);
        entry.replace(begin, end - begin + 1, "");
        text.replace(0, begin2, "");
    }
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:42,代码来源:UILines.cpp


注:本文中的xr_string::clear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。