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

C++ skipSpace函数代码示例

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

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



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

示例1: while

bool
DictConv::parseLine(char* buf,
                    char* word_buf,
                    std::string& syls)
{
    /* ignore the empty lines and comment lines */
    if (*buf == '\n' || *buf == '#')
        return false;

    char* p = (char*)skipSpace(buf);
    char* t = (char*)skipNonSpace(p);
    while (p < t) *word_buf++ = *p++;
    *word_buf = 0;

    p = (char*)skipSpace(p);
    t = (char*)skipNonSpace(p);
    if (*t)
        *t++ = 0;
    p = (char*)skipSpace(t);
    t = (char*)skipNonSpace(p);
    if (*t)
        *t++ = 0;
    syls.assign(p);
    return true;
}
开发者ID:wjcdx,项目名称:sunpinyin,代码行数:25,代码来源:DictConv.cpp


示例2: processIC_H

static void processIC_H( char *fname )
{
    char *p;
    char *ok;
    char *ic_start;
    unsigned ic_idx;

    file = fname;
    line = 0;
    ic_idx = NO_IDX;
    for(;;) {
        ok = fgets( buff, sizeof(buff), ic_h );
        if( ok == NULL ) break;
        ++line;
        p = skipSpace( buff );
        if( memcmp( p, "//", 2 ) == 0 ) {
            continue;
        }
        ic_start = strstr( p, "IC(" );
        if( ic_start != NULL ) {
            p = skipNonSpace( ic_start );
            p = skipSpace( p );
            ic_idx = whatICAmI( p );
            continue;
        }
        if( ic_idx != NO_IDX ) {
            if( buff[0] == '#' ) {
                addName( icPreProcTable, ic_idx, buff );
            }
        }
    }
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:32,代码来源:icmask.c


示例3: main

int main (int argc, char *argv[]) {
  if (argc != 2) {
    std::cout << "Usage: ./numerics inputFileName" << std::endl;
    return EXIT_SUCCESS;
  }
  
  std::string line;
  Functions * functions = new Functions();
  std::fstream f(argv[1]);
  while (std::getline(f, line)) {
    std::size_t pos = 0;
    if ((pos = line.find("define")) != std::string::npos) {
      parse(line, functions);
    }
    else if (((pos = line.find("evaluate")) != std::string::npos)) {
      //compute the value of a function
      double res = evaluate(line, functions);
      printEval(line, res);
    }
    else if (((pos = line.find("numint")) != std::string::npos)) {
      pos += 6;
      skipSpace(line, pos);
      std::string s = line.substr(pos);
      double res = integeral(s, functions);
      printInte(line, res);
    }
    else if (((pos = line.find("mcint")) != std::string::npos)) {
      pos += 5;
      skipSpace(line, pos);
      std::string s = line.substr(pos);
      double res = mcint(s, functions);
      printMcint(line, res);
    }
    else if (((pos = line.find("max")) != std::string::npos)) {
      pos += 3;
      skipSpace(line, pos);
      std::string s = line.substr(pos);
      double res = gradAsc(s, functions, 0);
      printGrad(line, res, 0);
    }
    else if (((pos = line.find("min")) != std::string::npos)) {
      //std::cout << "This is a Gradient Descent" << std::endl;
      pos += 3;
      skipSpace(line, pos);
      std::string s = line.substr(pos);
      double res = gradAsc(s, functions, 1);
      printGrad(line, res, 1);
    }
    else if (((pos = line.find("exit")) != std::string::npos)) {
      delete functions;
      f.close();
      return EXIT_SUCCESS;
    }
  }
  delete functions;
  f.close();
  return EXIT_SUCCESS;
}
开发者ID:willzxd,项目名称:NumercialIntegeration,代码行数:58,代码来源:main.cpp


示例4: findFalconTags

static void findFalconTags (void)
{
    vString *name = vStringNew ();
    const unsigned char *line;

    while ((line = fileReadLine ()) != NULL)
    {
        const unsigned char *cp = line;

        if (*cp == '#')
            continue;

        if (strncmp ((const char*) cp, "function", (size_t) 8) == 0)
        {
            cp += 8;
            cp = skipSpace (cp);
            
            while (isIdentifierChar ((int) *cp))
            {
                vStringPut (name, (int) *cp);
                ++cp;
            }
            vStringTerminate (name);
            makeSimpleTag (name, FalconKinds, K_FUNCTION);
            vStringClear (name);
        }
        else if (strncmp ((const char*) cp, "class", (size_t) 5) == 0)
        {
            cp += 5;
            cp = skipSpace (cp);
            
            while (isIdentifierChar ((int) *cp))
            {
                vStringPut (name, (int) *cp);
                ++cp;
            }
            vStringTerminate (name);
            makeSimpleTag (name, FalconKinds, K_CLASS);
            vStringClear (name);
        }
        else if (strncmp ((const char*) cp, "load", (size_t) 4) == 0)
        {
            cp += 4;
            cp = skipSpace (cp);
            
            while (isIdentifierChar ((int) *cp))
            {
                vStringPut (name, (int) *cp);
                ++cp;
            }
            vStringTerminate (name);
            makeSimpleTag (name, FalconKinds, K_NAMESPACE);
            vStringClear (name);
        }
    }
    vStringDelete (name);
}
开发者ID:VujinovM,项目名称:anjuta,代码行数:57,代码来源:falcon.c


示例5: scanSource

static void scanSource( char *fname )
{
    char *mask_id;
    char *ok;
    char *t;
    char *p;
    char *s;
    char c;
    int begin_found;
    unsigned ic_idx;

    file = fname;
    line = 0;
    begin_found = 0;
    mask_id = NULL;
    for(;;) {
        ok = fgets( buff, sizeof(buff), src_c );
        if( ok == NULL ) break;
        ++line;
        if( begin_found ) {
            t = strstr( buff, "// ICMASK END" );
            if( t != NULL ) {
                begin_found = 0;
                continue;
            }
            p = skipSpace( buff );
            if( memcmp( p, "case", 4 ) == 0 ) {
                p = skipNonSpace( p );
                p = skipSpace( p );
                if( memcmp( p, "IC_", 3 ) == 0 ) {
                    ic_idx = whatICAmI( p );
                    addName( icMaskTable, ic_idx, mask_id );
                }
            }
        } else {
            t = strstr( buff, "// ICMASK BEGIN" );
            if( t != NULL ) {
                p = skipNonSpace( t );
                p = skipSpace( p );
                p = skipNonSpace( p );
                p = skipSpace( p );
                p = skipNonSpace( p );
                p = skipSpace( p );
                s = p;
                p = skipMacroName( p );
                c = *p;
                *p = '\0';
                mask_id = strdup( s );
                *p = c;
                begin_found = 1;
            }
        }
    }
    if( begin_found ) {
        fail( "// ICMASK BEGIN found without matching // ICMASK END\n" );
    }
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:57,代码来源:icmask.c


示例6: getWall

int getWall(char **line) {
	char arg[3];
	char *start, *end;

	start = skipSpace(*line);
	end = findFirstSpace(start);
	copyString(arg, start, end);
	*line = skipSpace(end);

	return (atoi(arg));
}
开发者ID:kc4271,项目名称:KSoftRender,代码行数:11,代码来源:Parser.cpp


示例7: getToken

TTemplatizerToken	getToken(CTemplatizerParser& t, bool skipspc, std::string* value = NULL)
{
	if (skipspc)
		t = skipSpace(t);

	if (!t.isValid())
		return Unknown;

	uint		i;
	CTemplatizerParser	result;
	for (i=0; i<sizeof(SimpleTokens)/sizeof(SimpleTokens[0]); ++i)
	{
		result = match(SimpleTokens[i].Text, t);
		if (result.isValid())
		{
			t = result;
			return SimpleTokens[i].Token;
		}
	}

	if (isalpha(*t))
	{
		TTemplatizerToken	retToken = Identifier;
		
		if (value != NULL)
			*value = "";
		do
		{
			while (isalpha(*t))
			{
				if (value != NULL)
					*value += *t;
				++t;
			}

			t = skipSpace(t);

			if (*t != EnvSeparator)
				break;

			retToken = ListIdentifier;

			if (value != NULL)
				*value += *t;
			++t;
		}
		while (true);

		return retToken;
	}

	return Unknown;
}
开发者ID:Kiddinglife,项目名称:ryzom,代码行数:53,代码来源:templatizer.cpp


示例8: convert

    bool convert(const String &input, LONGLONG &outResult, size_t size, bool ignoreWhiteSpace, size_t base)
    {
      ZS_THROW_INVALID_USAGE_IF((0 == size) || (size > sizeof(QWORD)))

      CSTR str = input;
      if (NULL == str)
        return false;

      if (ignoreWhiteSpace)
        skipSpace(str);

      bool hadSign = false;
      bool positive = isPositive(str, hadSign);
      base = shouldForceBase(str, base, hadSign);

      LONGLONG result = 0;

      BYTE digit = 0;
      if (positive) {
        while ((digit = gDigitToValue[*str]) < base) {
          LONGLONG lastResult = result;

          result *= base;
          result += static_cast<LONGLONG>(digit);
          if (result < lastResult)
            return false; // value had to flip
          ++str;
        }
        if (result > gMaxLongLongs[size-1])
          return false;
      } else {
        while ((digit = gDigitToValue[*str]) < base) {
          LONGLONG lastResult = result;

          result *= base;
          result -= static_cast<LONGLONG>(digit);
          if (lastResult < result)
            return false; // value had to flip
          ++str;
        }
        if (result < static_cast<LONGLONG>(gMinLongLongs[size-1]))
          return false;
      }

      if (ignoreWhiteSpace)
        skipSpace(str);

      if (0 != *str)
        return false;

      outResult = result;
      return true;
    }
开发者ID:liutao6982,项目名称:zsLib,代码行数:53,代码来源:zsLib_Numeric.cpp


示例9: findSmlTags

static void findSmlTags (void)
{
    vString *const identifier = vStringNew ();
    const unsigned char *line;
    smlKind lastTag = K_NONE;

    while ((line = fileReadLine ()) != NULL)
    {
        const unsigned char *cp = skipSpace (line);
        do
        {
            smlKind foundTag;
            if (CommentLevel != 0)
            {
                cp = (const unsigned char *) strstr ((const char *) cp, "*)");
                if (cp == NULL)
                    continue;
                else
                {
                    --CommentLevel;
                    cp += 2;
                }
            }
            foundTag = findNextIdentifier (&cp);
            if (foundTag != K_NONE)
            {
                cp = skipSpace (cp);
                cp = parseIdentifier (cp, identifier);
                if (foundTag == K_AND)
                {
                    if (lastTag != K_NONE)
                        makeSmlTag (lastTag, identifier);
                }
                else
                {
                    makeSmlTag (foundTag, identifier);
                    lastTag = foundTag;
                }
            }
            if (strstr ((const char *) cp, "(*") != NULL)
            {
                cp += 2;
                cp = (const unsigned char *) strstr ((const char *) cp, "*)");
                if (cp == NULL)
                    ++CommentLevel;
            }
        } while (cp != NULL  &&  strcmp ((const char *) cp, "") != 0);
    }
    vStringDelete (identifier);
}
开发者ID:shigio,项目名称:ctags,代码行数:50,代码来源:sml.c


示例10: isFunctionNameInCode

/*
 * pStart - pointer to first char of function name
 * pEnd1  - pointer to (last + 1) char of function name
 */
bool isFunctionNameInCode(char *pStart, char *pEnd1) {
	char *p;

	p = skipSpace(pStart - 1, false);
	if (*p == '(' || *p == ')')
		return true;

	p = skipSpace(pEnd1);

	if (*p == '(' || *p == ')')
		return true;

	return false;
}
开发者ID:gracerpro,项目名称:luaob,代码行数:18,代码来源:obfuscator.cpp


示例11: extractAttributes

bool extractAttributes(char **ptr, Attribute *a)
{
	// Find attribute name.
	{
		skipSpace(ptr);
		a->name = *ptr;

		findSpaceOrChar(ptr, '=');
		
		if (**ptr == '\0')
			return false;

		**ptr = '\0';
		++(*ptr);
	}
	
	// Find attribute value.
	{
		findCharAOrB(ptr, '\'', '\"');
		const char quot = **ptr;
		
		skipOne(ptr);
		a->value = *ptr;
		
		findChar(ptr, quot);
		
		if (**ptr == '\0')
			return false;
		
		**ptr = '\0';
		++(*ptr);
	}
	
	return true;
}
开发者ID:jac8b,项目名称:libcubic,代码行数:35,代码来源:xml.c


示例12: Reset

void LS_Surface::ReadObj(const char* filename, float scale)
{
	Reset();
#ifdef _CRT_SECURE_NO_WARNINGS
	FILE* fp = fopen(filename, "r");
	int v_index = 0, f_index = 0;
#else
	FILE* fp;
	fopen_s(&fp, filename, "r");
	int v_index = 0, f_index = 0;
#endif
	if(!fp)
	{
		printf("open %s failed\n", filename);
		exit(0);
	}
	char str[256];
	while(!feof(fp))
	{
		fgets(str, 255, fp);
		int i = skipSpace(str);
		if(i == -1 || str[i] == '\n' || str[i] == '#')
			continue;
		if(str[i] == 'v')
		{
			//LSPoint p;
			v_index++;
			if(isInVertexIndex(v_index-1))
				continue;
			LS_Vertex* v = new LS_Vertex();
#ifdef _CRT_SECURE_NO_WARNINGS
			sscanf(str+i+1, "%lf%lf%lf", &v->pos[0], &v->pos[1], &v->pos[2]);
#else
			sscanf_s(str+i+1, "%lf%lf%lf", &v->pos[0], &v->pos[1], &v->pos[2]);
#endif
			v->pos[0] *= scale;
			v->pos[1] *= scale;
			v->pos[2] *= scale;

			vertices.push_back(v);
			v->creationLevel = subdivisionLevel;
			v->m_index = vertices.size();
		}
		else if(str[i] = 'f')
		{
			f_index++;
			if(isInFaceIndex(f_index-1))
				continue;
			int v1, v2, v3;
#ifdef _CRT_SECURE_NO_WARNINGS
			sscanf(str+i+1, "%d%d%d", &v1, &v2, &v3);
#else
			sscanf_s(str+i+1, "%d%d%d", &v1, &v2, &v3);
#endif
			AddFaceOfIndex(toNewIndex(v1-1), toNewIndex(v2-1), toNewIndex(v3-1));
			//AddFaceOfIndex(v1-1, v2-1, v3-1);
		}
	}
	fclose(fp);
}
开发者ID:huangxiaojian,项目名称:project,代码行数:60,代码来源:Subdivision.cpp


示例13: isForEnd

bool isForEnd(char *buf){
  skipSpace(&buf);
  if(buf[0] == '}'){
    return true;
  }
  return false;
}
开发者ID:ultimate010,项目名称:c_toy,代码行数:7,代码来源:parse.c


示例14: isVariableDef

/*
 * 简单判断是否是变量定义,只是判断开始是否为数据类型
 */
bool isVariableDef(char * buf){
    skipSpace(&buf);
    if(isDataType(buf) == true){
      return true;
    }
    return false;
}
开发者ID:ultimate010,项目名称:c_toy,代码行数:10,代码来源:parse.c


示例15: parseFloat

float parseFloat(const char* str, size_t& pos)
{
    skipSpace(str,pos);
    size_t begin = pos;
    while (isdigit(str[pos]) || str[pos] == '.') pos++;
    return atof(str+begin);
}
开发者ID:AranHase,项目名称:embree,代码行数:7,代码来源:rtcore.cpp


示例16: while

/*
 * Evaluate string (string replacement)
 */
std::string	CTemplatizerEnv::eval(const std::string& text)
{
	std::string	res;
	const char*	ptr = text.c_str();

	while (*ptr != '\0')
	{
		if (ptr[0] == '$' && ptr[1] == '(')
		{
			ptr += 2;
			std::string	var;

			ptr = skipSpace(ptr);

			while (isalpha(*ptr) || *ptr == '/' || *ptr == '.')
				var += *(ptr++);

			while (*ptr != '\0' && *ptr != ')')
				++ptr;
			if (*ptr == ')')
				++ptr;

			res += get(var);
		}
		else if (*ptr != '\r')
		{
			res += *(ptr++);
		}
	}

	return res;
}
开发者ID:Kiddinglife,项目名称:ryzom,代码行数:35,代码来源:templatizer.cpp


示例17: parseDirective

/*
 * Directives are of the form:
 * -module(foo)
 * -define(foo, bar)
 * -record(graph, {vtab = notable, cyclic = true}).
 * -type some_type() :: any().
 * -opaque some_opaque_type() :: any().
 */
static void parseDirective (const unsigned char *cp, vString *const module)
{
	/*
	 * A directive will be either a record definition or a directive.
	 * Record definitions are handled separately
	 */
	vString *const directive = vStringNew ();
	const char *const drtv = vStringValue (directive);
	cp = parseIdentifier (cp, directive);
	cp = skipSpace (cp);
	if (*cp == '(')
		++cp;

	if (strcmp (drtv, "record") == 0)
		parseSimpleTag (cp, K_RECORD);
	else if (strcmp (drtv, "define") == 0)
		parseSimpleTag (cp, K_MACRO);
	else if (strcmp (drtv, "type") == 0)
		parseSimpleTag (cp, K_TYPE);
	else if (strcmp (drtv, "opaque") == 0)
		parseSimpleTag (cp, K_TYPE);
	else if (strcmp (drtv, "module") == 0)
		parseModuleTag (cp, module);
	/* Otherwise, it was an import, export, etc. */
	
	vStringDelete (directive);
}
开发者ID:simlrh,项目名称:ctags,代码行数:35,代码来源:erlang.c


示例18: skipSpace

int mp::HTMLParser::Rep::tagAttrs(HTMLParserEvent &event,
                                  const char *name, int len,
                                  const char *cp)
{
    int i = skipSpace(cp);
    while (cp[i] && !strchr("/><", cp[i]))
    {
        const char *attr_name = cp + i;
        int attr_len;
        const char *value;
        int val_len;
        int tr;
        char x[2];
        int nor = skipAttribute(event, cp+i, &attr_len, &value, &val_len, &tr);
        if (!nor)
            break;
        i += nor;

        x[0] = tr;
        x[1] = 0;
        if (m_verbose)
        {
            printf("------ attr %.*s", attr_len, attr_name);
            if (value)
                printf("=%.*s", val_len, value);
            printf("\n");
        }
        event.attribute(name, len, attr_name, attr_len, value, val_len, x);
    }
    return i;
}
开发者ID:dcrossleyau,项目名称:metaproxy,代码行数:31,代码来源:html_parser.cpp


示例19: skipSpace

QPair<QStringRef,QStringRef> QDeclarativeStyledTextPrivate::parseAttribute(const QChar *&ch, const QString &textIn)
{
    skipSpace(ch);

    int attrStart = ch - textIn.constData();
    int attrLength = 0;
    while (!ch->isNull()) {
        if (*ch == greaterThan) {
            break;
        } else if (*ch == equals) {
            ++ch;
            if (*ch != singleQuote && *ch != doubleQuote) {
                while (*ch != greaterThan && !ch->isNull())
                    ++ch;
                break;
            }
            ++ch;
            if (!attrLength)
                break;
            QStringRef attr(&textIn, attrStart, attrLength);
            QStringRef val = parseValue(ch, textIn);
            if (!val.isEmpty())
                return QPair<QStringRef,QStringRef>(attr,val);
            break;
        } else {
            ++attrLength;
        }
        ++ch;
    }

    return QPair<QStringRef,QStringRef>();
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:32,代码来源:qdeclarativestyledtext.cpp


示例20: parseIdentifier

 std::string parseIdentifier(const char* str, size_t& pos) 
 {
   skipSpace(str,pos);
   size_t begin = pos;
   while (isalnum(str[pos]) || str[pos] == '_' || str[pos] == '.') pos++;
   return std::string(str+begin,str+pos);
 }
开发者ID:zygyz,项目名称:embree-cl,代码行数:7,代码来源:rtcore.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ skipSpaces函数代码示例发布时间:2022-05-30
下一篇:
C++ skip函数代码示例发布时间: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