• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ skipws函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中skipws函数的典型用法代码示例。如果您正苦于以下问题:C++ skipws函数的具体用法?C++ skipws怎么用?C++ skipws使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: die

static struct test *read_tests(void) {
    char *fname;
    FILE *fp;
    char line[BUFSIZ];
    struct test *result = NULL, *t = NULL;
    int lc = 0;
    bool append_cmd = true;

    if (asprintf(&fname, "%s/tests/run.tests", abs_top_srcdir) < 0)
        die("asprintf fname");

    if ((fp = fopen(fname, "r")) == NULL)
        die("fopen run.tests");

    while (fgets(line, BUFSIZ, fp) != NULL) {
        lc += 1;
        char *s = skipws(line);
        if (*s == '#' || *s == '\0')
            continue;
        if (*s == ':')
            s += 1;
        char *eos = s + strlen(s) - 2;
        if (eos >= s && *eos == ':') {
            *eos++ = '\n';
            *eos = '\0';
        }

        if (looking_at(s, KW_TEST)) {
            if (ALLOC(t) < 0)
                die_oom();
            list_append(result, t);
            append_cmd = true;
            s = token(s + strlen(KW_TEST), &(t->name));
            s = inttok(s, &t->result);
            s = errtok(s, &t->errcode);
        } else if (looking_at(s, KW_PRINTS)) {
            s = skipws(s + strlen(KW_PRINTS));
            t->out_present = looking_at(s, KW_SOMETHING);
            append_cmd = false;
        } else if (looking_at(s, KW_USE)) {
            if (t->module !=NULL)
                die("Can use at most one module in a test");
            s = token(s + strlen(KW_USE), &(t->module));
        } else {
            char **buf = append_cmd ? &(t->cmd) : &(t->out);
            if (*buf == NULL) {
                *buf = strdup(s);
                if (*buf == NULL)
                    die_oom();
            } else {
                if (REALLOC_N(*buf, strlen(*buf) + strlen(s) + 1) < 0)
                    die_oom();
                strcat(*buf, s);
            }
        }
        if (t->out != NULL)
            t->out_present = true;
    }
    return result;
}
开发者ID:afcady,项目名称:augeas,代码行数:60,代码来源:test-run.c


示例2: skipws

void netlist_parser::netdev_device(const pstring &dev_type)
{
	pstring devname;
	netlist_device_t *dev;
	int cnt;

	skipws();
	devname = getname2(',', ')');
	dev = m_setup.factory().new_device_by_name(dev_type, m_setup);
	m_setup.register_dev(dev, devname);
	NL_VERBOSE_OUT(("Parser: IC: %s\n", devname.cstr()));
	cnt = 0;
	while (getc() != ')')
	{
		skipws();
		pstring output_name = getname2(',', ')');
		pstring alias = pstring::sprintf("%s.[%d]", devname.cstr(), cnt);
		NL_VERBOSE_OUT(("Parser: ID: %s %s\n", output_name.cstr(), alias.cstr()));
		m_setup.register_link(alias, output_name);
		skipws();
		cnt++;
	}
/*
    if (cnt != dev->m_terminals.count() && !dev->variable_input_count())
        fatalerror("netlist: input count mismatch for %s - expected %d found %d\n", devname.cstr(), dev->m_terminals.count(), cnt);
    if (dev->variable_input_count())
    {
        NL_VERBOSE_OUT(("variable inputs %s: %d\n", dev->name().cstr(), cnt));
    }
    */
}
开发者ID:dezi,项目名称:mame-libretro-odroid,代码行数:31,代码来源:nl_parser.c


示例3: skipws

TInt DWinsKeyboard::DefineAlias(const char* aValue)
//
// The character string terminates in a ';' or a '\0'
//
	{
	//get the alias name
	const char* beg = skipws(aValue);
	const char* end = skiptok(beg);
	TPtrC8 alias((const TUint8*)beg, end-beg);

	//get the real name
	beg = skipws(end);
	end = skiptok(beg);
	TPtrC8 name((const TUint8*)beg, end-beg);

	//prevent an alias being made of an alias
	if (iAliasedKeys[name] != NULL)
		return KErrArgument;

	// ensure this is valid name
	TInt r = GetEPOCKeyCode(name);
	if (r == KErrNotFound)
		return r;

	//now we need to record the alias name and the real key name
	return iAliasedKeys.Add(alias, name);
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:27,代码来源:keyboard.cpp


示例4: skipws

pstring netlist_parser::getstring()
{
    skipws();
    check_char('"');
    pstring ret = getname2_ext('"', 0, NULL);
    check_char('"');
    skipws();
    return ret;
}
开发者ID:felipesanches,项目名称:ume,代码行数:9,代码来源:nl_parser.c


示例5: parsepair

static int
parsepair(Parser *p, JSON *parent, JSON **kprev, JSON **vprev)
{
	must(*p->s == '"');
	must(parsestring(p, parent, kprev));
	skipws(p);
	must(consume(p, ":"));
	skipws(p);
	must(parsevalue(p, parent, vprev));
	return 1;
}
开发者ID:PawelMarc,项目名称:json,代码行数:11,代码来源:json.c


示例6: get_to_sep

void record_enum::parse(proto_info &, cursor &c) {
    pimpl->name = get_to_sep(c, ' ', enum_body_open_char, enum_type_separator);

    // if enum has specified underlying type
    skipws(c);
    if ( curch(c) == enum_type_separator ) {
        check_next(c, enum_type_separator);
        cursor c1 = c;
        const std::string type = get_to_sep(c, ' ', enum_body_open_char);
        pimpl->type = type_id_by_name(type);
        if ( pimpl->type == type_id::type_unknown )
            YARMI_THROW(
                "enum underlying type error: '%s' in %s"
                ,type
                ,c1.format()
            );
    }

    check_next(c, enum_body_open_char);

    for ( ;; ) {
        skipws(c);
        // if enum don't have any members
        char cc = curch(c);
        if ( cc == enum_body_close_char ) {
            check_next(c, enum_body_close_char);
            check_next(c, enum_body_close_dotcomma_char);
            return;
        }

        const std::string n = get_to_sep(c, ',', ' ', enum_assign_char, enum_body_close_char);

        skipws(c);
        cc = curch(c);
        // without init value
        if ( cc == ',' ) {
            nextch(c);
            pimpl->elems.push_back({n, ""});
            // with init value
        } else if ( cc == enum_assign_char ) {
            nextch(c);
            const std::string v = get_to_sep(c, ' ', ',', enum_body_close_char);
            pimpl->elems.push_back({n, v});
            // error
        } else {
            YARMI_THROW(
                "syntax error: '%c' in %s"
                ,cc
                ,c.format()
            );
        }
    }
}
开发者ID:niXman,项目名称:yarmi,代码行数:53,代码来源:records.cpp


示例7: while

void netlist_parser::parse(const char *buf)
{
	m_px = buf;
	m_line_ptr = buf;
	m_line = 1;

	while (!eof())
	{
		pstring n;
		skipws();
		if (eof()) break;
		n = getname('(');
		NL_VERBOSE_OUT(("Parser: Device: %s\n", n.cstr()));
		if (n == "NET_ALIAS")
			net_alias();
		else if (n == "NET_C")
			net_c();
		else if (n == "NETDEV_PARAM")
			netdev_param();
		else if ((n == "NET_MODEL"))
		    net_model();
		else if (n == "NETLIST_START")
		    netdev_netlist_start();
        else if (n == "NETLIST_END")
            netdev_netlist_end();
		else
			netdev_device(n);
	}
}
开发者ID:felipesanches,项目名称:ume,代码行数:29,代码来源:nl_parser.c


示例8: join

PROC
join(int count)
{
    bool ok;
    int lp, first;
    
    if (lend < bufmax) {	/* are we in the buffer? */
	disp = lend;				/* start redraw here */
	newc = lend;
	do {					/* join until.. */
	    first = lend;
	    lp = skipws(1+first);
	    ok = delete_to_undo(&undo, 1+first, lp-(1+first));
	    if (ok) {
		ok = move_to_undo(&undo, first, 1);
		core[first] = ' ';		/* spaces between lines */
	    }
	    count--;
	    lend = fseekeol(first);
	} while (ok && count > 0);
	endY = MAGICNUMBER;
	newend = lend;
	if (!ok)
	    error();
    }
    else
	error();
}
开发者ID:8l,项目名称:FUZIX,代码行数:28,代码来源:editcor.c


示例9: scroll

PROC
scroll(bool down)
{
    int i;

    if (count <= 0)
	count = dofscroll;
    strput(CURoff);
    if (down) {
	curr = min(bufmax-1, nextline(TRUE, curr, count));
	i = min(bufmax-1, nextline(TRUE, pend, count));
	if (i > pend)
	    scrollforward(i);
    }
    else {
	curr = bseekeol(max(0,nextline(FALSE, curr, count)));
	i = bseekeol(max(0,nextline(FALSE, ptop, count)));
	if (i < ptop)
	    if (canUPSCROLL)
		scrollback(i);
	    else {
		ptop = i;
		setend();
		redisplay(TRUE);
	    }
    }
    strput(CURon);
    setpos(skipws(curr));	/* initialize new position - first nonwhite */
    yp = setY(curr);
    mvcur(yp, xp);		/* go there */
}
开发者ID:8l,项目名称:FUZIX,代码行数:31,代码来源:editcor.c


示例10: tech_fix

void tech_fix(dbref player, void *data, char *buffer)
{
    MECH *mech = data;
    int n = atoi(buffer);
    int low, high;
    int isds;

    skipws(buffer);
    TECHCOMMANDC;
    if (unit_is_fixable(mech))
	make_damage_table(mech);
    else
	make_scrap_table(mech);
    DOCHECK(!damage_last &&
	MechType(mech) == CLASS_MECH,
	"The 'mech is in pristine condition!");
    DOCHECK(!damage_last, "It's in pristine condition!");
    if (sscanf(buffer, "%d-%d", &low, &high) == 2) {
	DOCHECK(low < 1 || low > damage_last, "Invalid low #!");
	DOCHECK(high < 1 || high > damage_last, "Invalid high #!");
	for (n = low; n <= high; n++)
	    fix_entry(player, mech, n);
	return;
    }
    DOCHECK(n < 1 || n > damage_last, "Invalid #!");
    fix_entry(player, mech, n);
}
开发者ID:fstltna,项目名称:Battletech-MUX,代码行数:27,代码来源:mech.tech.damages.c


示例11: while

void netlist_parser::parse(const char *buf)
{
	m_px = buf;

	while (!eof())
	{
		pstring n;
		skipws();
		if (eof()) break;
		n = getname('(');
		NL_VERBOSE_OUT(("Parser: Device: %s\n", n.cstr()));
		if (n == "NET_ALIAS")
			net_alias();
		else if (n == "NET_C")
			net_c();
		else if (n == "NETDEV_PARAM")
			netdev_param();
		else if (n == "NETDEV_R")
			netdev_device(n, "R");
		else if (n == "NETDEV_C")
			netdev_device(n, "C");
		else if (n == "NETDEV_POT")
			netdev_device(n, "R");
		else if (n == "NETDEV_D")
			netdev_device(n, "model", true);
		else if ((n == "NETDEV_TTL_CONST") || (n == "NETDEV_ANALOG_CONST"))
			netdev_const(n);
		else
			netdev_device(n);
	}
}
开发者ID:dezi,项目名称:mame-libretro-odroid,代码行数:31,代码来源:nl_parser.c


示例12: parse_headers

static bool parse_headers(Iterator& it, Request& request)
{
    bool res = true;
    while (res)
    {
        std::string key;
        std::string value;

        res = consumeUntil(it, key, ": \r");
        if (key.empty())
        {
            return res;
        }

        skipws(it);
        res = res && expect(it, ":");

        while (match(it, ' '))
        {
        }

        res = res && consumeUntil(it, value, "\r");

        if (res)
        {
            request.headers.emplace_back(std::move(key), std::move(value));
        }

        res = res && expect(it, HTTP_DELIMITER);
    }

    return false;
}
开发者ID:0x7f,项目名称:httpp,代码行数:33,代码来源:Parser.cpp


示例13: parse_uri

static bool parse_uri(Iterator& it, Request& request)
{

    skipws(it);

    consumeUntil(it, request.uri, "? ");
    if (match(it, '?'))
    {
        do
        {
            std::string key;
            std::string value;

            bool res = consumeUntil(it, key, "&= ");
            if (match(it, '=')) {
                res = res && consumeUntil(it, value, "& ");
                key = UTILS::url_decode(key);
                value = UTILS::url_decode(value);
                request.query_params.emplace_back(std::move(key), std::move(value));
            }
            else
            {
                request.query_params.emplace_back(std::move(key), "");
            }

            if (!res)
            {
                return res;
            }
        } while (match(it, '&'));
    }

    return it != EOS;
}
开发者ID:0x7f,项目名称:httpp,代码行数:34,代码来源:Parser.cpp


示例14: parse_http_version

static bool parse_http_version(Iterator& it, Request& request)
{
    skipws(it);
    bool res = expect(it, "HTTP/");
    std::string major, minor;
    res = res && consumeUntil(it, major, ".");
    res = res && expect(it, ".");
    res = res && consumeUntil(it, minor, "\r");

    if (res)
    {
        try
        {
            request.major = std::stoi(major);
            request.minor = std::stoi(minor);
        }
        catch (std::exception const& ex)
        {
            LOG(parser_logger, error) << "Cannot parse Major/Minor: "
                                      << ex.what();
            return false;
        }
    }

    return res;
}
开发者ID:0x7f,项目名称:httpp,代码行数:26,代码来源:Parser.cpp


示例15: get_two_ws_separated_fields

/*
 * Split a string into 2 whitespace separated fields returned in "key" and
 * "value". If more than 2 fields are found, they are cut off by zero
 * terminating "key" and "value" inside the string. If "value" is not found,
 * *value is set to NULL. If "key" is not found, *key is set to NULL.
 * If something is found, both *key and *value become pointers inside the
 * string s.
 *
 * Return values:
 *  - 0 if neither "key" nor "value" is found
 *  - 1 if only "key" is found
 *  - 2 if both "key" and "value" are found
 */
int get_two_ws_separated_fields(char **key, char **value, char *s)
{
	int i;

	*key = NULL;
	*value = NULL;

	i = skipws(s, 0);   /* Skip initial whitespace */

	if (i < 0)
		return 0;   /* We got nothing */

	*key = s + i;

	i = skip_and_terminate_word(s, i);

	if (i < 0)
		return 1;   /* We got a "key", but not a "value" */

	*value = s + i;

	skip_and_terminate_word(s, i);

	return 2;           /* We got both a "key" and a "value" */
}
开发者ID:Kinglions,项目名称:modizer,代码行数:38,代码来源:support.c


示例16: tok_get

int tok_get(void)
{
	int num;
	if (next != -1) {
		int tok = next;
		next = -1;
		return tok;
	}
	pre = cur;
	if (skipws())
		return TOK_EOF;
	if (buf[cur] == '"') {
		mem_cut(&str, 0);
		while (buf[cur] == '"') {
			readstr(&str);
			if (skipws())
				return TOK_EOF;
		}
		return TOK_STR;
	}
	if (isdigit(buf[cur]) || buf[cur] == '\'') {
		readnum();
		return TOK_NUM;
	}
	if (id_char(buf[cur])) {
		char *s = name;
		int i;
		while (cur < len && id_char(buf[cur]))
			*s++ = buf[cur++];
		*s = '\0';
		for (i = 0; i < LEN(kwds); i++)
			if (!strcmp(kwds[i].name, name))
				return kwds[i].id;
		return TOK_NAME;
	}
	if (cur + 3 <= len && (num = get_tok3(TOK3(buf + cur)))) {
		cur += 3;
		return num;
	}
	if ((num = get_tok3(TOK2(buf + cur)))) {
		cur += 2;
		return num;
	}
	if (strchr(";,{}()[]<>*&!=+-/%?:|^~.", buf[cur]))
		return buf[cur++];
	return -1;
}
开发者ID:gaoxiaojun,项目名称:neatcc,代码行数:47,代码来源:tok.c


示例17: jsonparse

// Scans src and writes pointers to the lexical bounds of JSON values
// to elements of part.
//
// Returns the total number of values in src, regardless of npart.
// If src is not well-formed JSON, returns 0.
int
jsonparse(char *src, JSON *part, int npart)
{
	Parser p = {};
	p.s = src;
	p.j = part;
	p.nj = npart;
	skipws(&p);
	must(parsetext(&p));
	skipws(&p);
	must(*p.s == '\0');
	if (part) {
		if (p.n < npart) {
			npart = p.n;
		}
		for (int i = 0; i < npart; i++) {
			part[i].len = part[i].end - part[i].src;
		}
	}
	return p.n;
}
开发者ID:PawelMarc,项目名称:json,代码行数:26,代码来源:json.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ skynet_error函数代码示例发布时间:2022-05-30
下一篇:
C++ skipwhite函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap