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


C++ skipSpace函数代码示例

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


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


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