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


C++ XString::end方法代码示例

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


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

示例1: TrimRight

	void TrimRight(XString& str)
	{
		if(str.empty()) return;
		for (XString::iterator i = str.end()-1;i!=str.begin();--i)
		{
			if(!isspace(*i))
			{
				str.erase(i+1,str.end());
				return;
			}
		}
	}
开发者ID:yuechuanbingzhi163,项目名称:myduilib,代码行数:12,代码来源:CXString.cpp

示例2: owned

 RString::RString(XString x)
 : owned(nullptr)
 {
     const RString *f = x.base();
     const char *xb = &*x.begin();
     const char *xe = &*x.end();
     const char *fb = f ? &*f->begin() : nullptr;
     const char *fe = f ? &*f->end() : nullptr;
     if (f && xb == fb && xe == fe)
         *this = *f;
     else
         _assign(x.begin(), x.end());
 }
开发者ID:o11c,项目名称:tmwa,代码行数:13,代码来源:rstring.cpp

示例3: WBUF_STRING

inline
void WBUF_STRING(uint8_t *p, size_t pos, XString s, size_t len)
{
    char *const begin = static_cast<char *>(WBUFP(p, pos));
    char *const end = begin + len;
    char *const mid = std::copy(s.begin(), s.end(), begin);
    std::fill(mid, end, '\0');
}
开发者ID:cinderweb,项目名称:tmwa,代码行数:8,代码来源:socket.hpp

示例4: WFIFO_STRING

inline
void WFIFO_STRING(int fd, size_t pos, XString s, size_t len)
{
    char *const begin = static_cast<char *>(WFIFOP(fd, pos));
    char *const end = begin + len;
    char *const mid = std::copy(s.begin(), s.end(), begin);
    std::fill(mid, end, '\0');
}
开发者ID:cinderweb,项目名称:tmwa,代码行数:8,代码来源:socket.hpp

示例5: read_constdb

bool read_constdb(ZString filename)
{
    io::ReadFile in(filename);
    if (!in.is_open())
    {
        PRINTF("can't read %s\n"_fmt, filename);
        return false;
    }

    bool rv = true;
    AString line_;
    while (in.getline(line_))
    {
        // is_comment only works for whole-line comments
        // that could change once the Z dependency is dropped ...
        LString comment = "//"_s;
        XString line = line_.xislice_h(std::search(line_.begin(), line_.end(), comment.begin(), comment.end())).rstrip();
        if (!line)
            continue;
        // "%m[A-Za-z0-9_] %i %i"

        // TODO promote either qsplit() or asplit()
        auto _it = std::find(line.begin(), line.end(), ' ');
        auto name = line.xislice_h(_it);
        auto _rest = line.xislice_t(_it);
        while (_rest.startswith(' '))
            _rest = _rest.xslice_t(1);
        auto _it2 = std::find(_rest.begin(), _rest.end(), ' ');
        auto val_ = _rest.xislice_h(_it2);
        auto type_ = _rest.xislice_t(_it2);
        while (type_.startswith(' '))
            type_ = type_.xslice_t(1);
        // yes, the above actually DTRT even for underlength input

        int val;
        int type = 0;
        // Note for future archeaologists: this code is indented correctly
        if (std::find_if_not(name.begin(), name.end(),
                    [](char c)
                    {
                        return ('0' <= c && c <= '9')
                            || ('A' <= c && c <= 'Z')
                            || ('a' <= c && c <= 'z')
                            || (c == '_');
                    }) != name.end()
                || !extract(val_, &val)
                || (!extract(type_, &type) && type_))
        {
            PRINTF("Bad const line: %s\n"_fmt, line_);
            rv = false;
            continue;
        }
        P<str_data_t> n = add_strp(name);
        n->type = type ? StringCode::PARAM : StringCode::INT;
        n->val = val;
    }
    return rv;
}
开发者ID:GermanTMW2015,项目名称:tmwa,代码行数:58,代码来源:script-startup.cpp

示例6: makeSurePath

	bool makeSurePath(XString& s)
	{
		if(s.empty()) return false;
		std::replace(s.begin(),s.end(),'\\','/');
		Trim(s);
		TrimLeftChar(s,'/');
		if(s.empty()) return false;
		while('/' != *s.rbegin()) s += '/';
		return !s.empty();
	}
开发者ID:yuechuanbingzhi163,项目名称:myduilib,代码行数:10,代码来源:CXString.cpp

示例7: TrimLeft

	void TrimLeft(XString& str)
	{
		for (XString::iterator i = str.begin();i !=str.end();++i)
		{
			if(!isspace(*i))
			{
				str.erase(str.begin(),i);
				return;
			}
		}
	}
开发者ID:yuechuanbingzhi163,项目名称:myduilib,代码行数:11,代码来源:CXString.cpp

示例8: extract

inline
bool extract(XString str, HumanTimeDiff *iv)
{
    // str is a sequence of [-+]?[0-9]+([ay]|m|[jd]|h|mn|s)
    // there are NO spaces here
    // parse by counting the number starts
    auto is_num = [](char c)
    { return c == '-' || c == '+' || ('0' <= c && c <= '9'); };
    if (!str || !is_num(str.front()))
        return false;
    *iv = HumanTimeDiff{};
    while (str)
    {
        auto it = std::find_if_not(str.begin(), str.end(), is_num);
        auto it2 = std::find_if(it, str.end(), is_num);
        XString number = str.xislice_h(it);
        XString suffix = str.xislice(it, it2);
        str = str.xislice_t(it2);

        short *ptr = nullptr;
        if (suffix == "y"_s || suffix == "a"_s)
            ptr = &iv->year;
        else if (suffix == "m"_s)
            ptr = &iv->month;
        else if (suffix == "j"_s || suffix == "d"_s)
            ptr = &iv->day;
        else if (suffix == "h"_s)
            ptr = &iv->hour;
        else if (suffix == "mn"_s)
            ptr = &iv->minute;
        else if (suffix == "s"_s)
            ptr = &iv->second;
        else
            return false;
        if (number.startswith('+') && !number.startswith("+-"_s))
            number = number.xslice_t(1);
        if (*ptr || !extract(number, ptr))
            return false;
    }
    return true;
}
开发者ID:mrktj,项目名称:tmwa,代码行数:41,代码来源:human_time_diff.hpp

示例9: XSimpleTimeZone

XIRef<XTimeZone> XSimpleTimeZone::FromXML(XIRef<XDomParserNode> node)
{
    const XString utcOffsetStr = node->GetMetaData("utcOffset");
    const XString dstOffsetStr = node->GetMetaData("dstOffset");

    if(node->GetTagName() != "XSimpleTimeZone" ||
       utcOffsetStr.empty() ||
       (!verifyDigit(utcOffsetStr[0]) && utcOffsetStr[0] != '-') ||
       count_if(utcOffsetStr.begin() + 1, utcOffsetStr.end(), verifyDigit) != (int)utcOffsetStr.size() - 1 ||
       dstOffsetStr.empty() ||
       (!verifyDigit(dstOffsetStr[0]) && dstOffsetStr[0] != '-') ||
       count_if(dstOffsetStr.begin() + 1, dstOffsetStr.end(), verifyDigit) != (int)dstOffsetStr.size() - 1)
    {
        return 0;
    }

    const int utcOffset = utcOffsetStr.ToInt();
    const int dstOffset = dstOffsetStr.ToInt();

    return new XSimpleTimeZone(utcOffset, dstOffset);
}
开发者ID:MultiSight,项目名称:xsdk,代码行数:21,代码来源:XTimeZone.cpp

示例10: XString

/// Return a pair of strings, {spellname, parameter}
/// Parameter may be empty.
static
std::pair<XString, XString> magic_tokenise(XString src)
{
    auto seeker = std::find(src.begin(), src.end(), ' ');

    if (seeker == src.end())
    {
        return {src, XString()};
    }
    else
    {
        XString rv1 = src.xislice_h(seeker);
        ++seeker;

        while (seeker != src.end() && *seeker == ' ')
            ++seeker;

        // Note: this very well could be empty
        XString rv2 = src.xislice_t(seeker);
        return {rv1, rv2};
    }
}
开发者ID:qiuhw,项目名称:tmwa,代码行数:24,代码来源:magic.cpp

示例11: e_mail_check

//---------------------------------------------------
// E-mail check: return 0 (not correct) or 1 (valid).
//---------------------------------------------------
bool e_mail_check(XString email)
{
    // athena limits
    if (email.size() < 3 || email.size() > 39)
        return 0;

    // part of RFC limits (official reference of e-mail description)
    XString::iterator at = std::find(email.begin(), email.end(), '@');
    if (at == email.end())
        return 0;
    XString username = email.xislice_h(at);
    XString hostname = email.xislice_t(at + 1);
    if (!username || !hostname)
        return 0;
    if (hostname.contains('@'))
        return 0;
    if (hostname.front() == '.' || hostname.back() == '.')
        return 0;
    if (hostname.contains_seq(".."))
        return 0;
    if (email.contains_any(" ;"))
        return 0;
    return email.is_print();
}
开发者ID:JaduJagat,项目名称:tmwa,代码行数:27,代码来源:utils.cpp

示例12: ToUpper

	void ToUpper(XString& str)
	{
		std::transform(str.begin(),str.end(),str.begin(),toupper);
	}
开发者ID:yuechuanbingzhi163,项目名称:myduilib,代码行数:4,代码来源:CXString.cpp

示例13: ToLower

	void ToLower(XString& str)
	{
		std::transform(str.begin(),str.end(),str.begin(),tolower);
	}
开发者ID:yuechuanbingzhi163,项目名称:myduilib,代码行数:4,代码来源:CXString.cpp


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