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


C++ eof函数代码示例

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


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

示例1: while

std::string
mm_io_c::getline() {
  char c;
  std::string s;

  if (eof())
    throw mtx::mm_io::end_of_file_x{mtx::mm_io::make_error_code()};

  while (read(&c, 1) == 1) {
    if (c == '\r')
      continue;
    if (c == '\n')
      return s;
    s += c;
  }

  return s;
}
开发者ID:VRDate,项目名称:mkvtoolnix,代码行数:18,代码来源:mm_io.cpp

示例2: while

   const char *RTextFile::GetNextStrToken(std::string &str) {
      char *set = "\r\t\n ";
      char *strstart;
      str="";

      // Strip la classe blank avant le nouveau token;
      while (_curpos < _buff+_size && (*_curpos == '\r' || *_curpos == '\n' || *_curpos == ' ' || *_curpos == '\t'))
         _curpos++;
      strstart = _curpos;
      
      if (!eof()) {
         int next = mystrcmp(_curpos,set,_buff+_size);
         str.assign(_curpos,_curpos+next);
         _curpos = _curpos+next;
      }

      return str.c_str();
   }
开发者ID:CortlandNation9,项目名称:Gamecodeur,代码行数:18,代码来源:ESceneParser.cpp

示例3: first

bool Dataset::locate(){
  bool result;
  if (plist.empty()) return false;

  std::map<std::string, field_value>::const_iterator i;
  first();
  while (!eof()) {
    result = true;
    for (i=plist.begin();i!=plist.end();++i)
      if (fv(i->first.c_str()).get_asString() == i->second.get_asString()) {
	continue;
      }
      else {result = false; break;}
    if (result) { return result;}
    next();
  }
  return false;
}
开发者ID:Arcko,项目名称:xbmc,代码行数:18,代码来源:dataset.cpp

示例4: while

const char *XMLParser::seekNextTag(const char *m[], const char *d[]){
   doublebuffer->clear();
   boolean f = true;

   while (f && !eof()){
      doublebuffer->add(seekNextTag());

      size_t pos1  = pos;
      const char *s  = getNextTag();
      const char *ds = NULL;
      size_t i;

      for(i = 0; d[i]; i++)
         if (cmpTag(s, d[i]) > 0){
            ds=extractDoubleTag(d[i], true);
            break;
         }

      const char *cs=d[i];

      for(i = 0; m[i]; i++)
         if (cmpTag(s, m[i]) > 0){
            f = false;
            break;
         }

      if (f){
         if (!isempty(s)){
            doublebuffer->add(OPENTAG);
            doublebuffer->add(s);
            doublebuffer->add(CLOSETAG);
	 }
	 if (!isempty(ds)){
	    doublebuffer->add(ds);
            doublebuffer->add(OPENTAG);
            doublebuffer->add(OFFTAG);
            doublebuffer->add(cs);
            doublebuffer->add(CLOSETAG);
         }
      }else
      	 pos=pos1;
   }
   return doublebuffer->get();
};
开发者ID:nmmmnu,项目名称:ccc,代码行数:44,代码来源:xml_parser.cpp

示例5: nextToken

void UnwrappedLineParser::parseEnum() {
  nextToken();
  if (FormatTok->Tok.is(tok::identifier) ||
      FormatTok->Tok.is(tok::kw___attribute) ||
      FormatTok->Tok.is(tok::kw___declspec)) {
    nextToken();
    // We can have macros or attributes in between 'enum' and the enum name.
    if (FormatTok->Tok.is(tok::l_paren)) {
      parseParens();
    }
    if (FormatTok->Tok.is(tok::identifier))
      nextToken();
  }
  if (FormatTok->Tok.is(tok::l_brace)) {
    if (Style.BreakBeforeBraces == FormatStyle::BS_Allman)
      addUnwrappedLine();
    nextToken();
    addUnwrappedLine();
    ++Line->Level;
    do {
      switch (FormatTok->Tok.getKind()) {
      case tok::l_paren:
        parseParens();
        break;
      case tok::r_brace:
        addUnwrappedLine();
        nextToken();
        --Line->Level;
        return;
      case tok::comma:
        nextToken();
        addUnwrappedLine();
        break;
      default:
        nextToken();
        break;
      }
    } while (!eof());
  }
  // We fall through to parsing a structural element afterwards, so that in
  // enum A {} n, m;
  // "} n, m;" will end up in one unwrapped line.
}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_external_clang,代码行数:43,代码来源:UnwrappedLineParser.cpp

示例6: get_page_for_next_record

static page_p get_page_for_next_record ( schema_p s )
{
  page_p pg = s->tbl->current_pg;
  if (eof(pg)) return NULL;
  if (eob(pg))
    {
      unpin (pg);
      pg = get_next_page (pg);
      if ( pg == NULL)
	{
	  put_msg (FATAL, "get_page_for_next_record failed at block %d\n",
		   page_block_nr(pg) + 1);
	  exit (EXIT_FAILURE);
	}
      page_set_pos_begin (pg);
      s->tbl->current_pg = pg;
    }
  return pg;
}
开发者ID:tho068,项目名称:database-2,代码行数:19,代码来源:schema.c

示例7: nextToken

bool UnwrappedLineParser::tryToParseLambdaIntroducer() {
  nextToken();
  if (FormatTok->is(tok::equal)) {
    nextToken();
    if (FormatTok->is(tok::r_square)) {
      nextToken();
      return true;
    }
    if (FormatTok->isNot(tok::comma))
      return false;
    nextToken();
  } else if (FormatTok->is(tok::amp)) {
    nextToken();
    if (FormatTok->is(tok::r_square)) {
      nextToken();
      return true;
    }
    if (!FormatTok->isOneOf(tok::comma, tok::identifier)) {
      return false;
    }
    if (FormatTok->is(tok::comma))
      nextToken();
  } else if (FormatTok->is(tok::r_square)) {
    nextToken();
    return true;
  }
  do {
    if (FormatTok->is(tok::amp))
      nextToken();
    if (!FormatTok->isOneOf(tok::identifier, tok::kw_this))
      return false;
    nextToken();
    if (FormatTok->is(tok::comma)) {
      nextToken();
    } else if (FormatTok->is(tok::r_square)) {
      nextToken();
      return true;
    } else {
      return false;
    }
  } while (!eof());
  return false;
}
开发者ID:ADonut,项目名称:LLVM-GPGPU,代码行数:43,代码来源:UnwrappedLineParser.cpp

示例8: raise_notice

String File::read(int64 length) {
  if (length <= 0) {
    raise_notice("Invalid length %lld", length);
    return "";
  }

  String s = String(length, ReserveString);
  char *ret = s.mutableSlice().ptr;
  int64 copied = 0;
  int64 avail = m_writepos - m_readpos;

  while (avail < length && !eof()) {
    if (m_buffer == NULL) {
      m_buffer = (char *)malloc(CHUNK_SIZE);
    }

    if (avail > 0) {
      memcpy(ret + copied, m_buffer + m_readpos, avail);
      copied += avail;
      length -= avail;
    }

    m_writepos = readImpl(m_buffer, CHUNK_SIZE);
    m_readpos = 0;
    avail = m_writepos - m_readpos;

    if (avail == 0 || m_nonblocking) {
      // For nonblocking mode, temporary out of data.
      break;
    }
  }

  avail = m_writepos - m_readpos;
  if (avail > 0) {
    int64 n = length < avail ? length : avail;
    memcpy(ret + copied, m_buffer + m_readpos, n);
    m_readpos += n;
    copied += n;
  }

  m_position += copied;
  return s.setSize(copied);
}
开发者ID:deivisonarthur,项目名称:hiphop-php,代码行数:43,代码来源:file.cpp

示例9: readFileChunk

bool BufferedStreamMgr::readFileChunk()
{
	if (eof()) {
		return false;
	}
	memset(_mainBuf, 0, _useBufSize +1);
	_mainBufCurrStartPos = 0;

	if (!_streamFinished) {
		_mainBufCurrLen = _inputStreamMgr->read((char *)_mainBuf, _useBufSize);
		if (_mainBufCurrLen < _useBufSize) {
			_streamFinished = true;
		}
		return _mainBufCurrLen > 0;
	} else {
		_mainBufCurrLen = 0;
		return false;
	}
}
开发者ID:Annaerial,项目名称:bedtools2,代码行数:19,代码来源:BufferedStreamMgr.cpp

示例10: initmsg

initmsg()
{
char s[80],k[80];
int i;

numread=0;
i=curconf;
i++;
strcpy(s,config.supportdir);
itoa(i,k,10);
strcat(s,k);
strcat(s,"MSG.IDX");
i=0;

filefile=open(s,O_RDWR | O_BINARY);

if(filefile!=-1 && (filelength(filefile)!=0))
	{
	while(!eof(filefile))
		{
		read(filefile,&bidx[i],sizeof(struct boardindex));
		i++;
		numread++;
		}
	close(filefile);
	return;
	}


filefile=open(s,O_BINARY | O_RDWR | O_CREAT,S_IWRITE | S_IREAD);
strcpy(bidx[0].name,"General");
bidx[0].num=1;
bidx[0].level=10;
bidx[0].maxmsgs=255;
bidx[0].net=0;
bidx[0].totalmsgs=0;
bidx[0].options=0;
bidx[0].pass[0]=0;
write(filefile,&bidx[0],sizeof(struct boardindex));
close(filefile);
numread=1;
}
开发者ID:mdiiorio,项目名称:ForceTen,代码行数:42,代码来源:MSG.C

示例11: fill_cache

std::streamsize
NoSeekFile::read(void *dst, std::streamsize bytes)
{
#ifdef GNASH_NOSEEK_FD_VERBOSE
    std::cerr << boost::format("read_cache(%d) called") % bytes << std::endl;
#endif

    if (eof()) {
#ifdef GNASH_NOSEEK_FD_VERBOSE
        std::cerr << "read_cache: at eof!" << std::endl;
#endif
        return 0;
    }

    fill_cache(bytes + tell());

#ifdef GNASH_NOSEEK_FD_VERBOSE
    printInfo();
#endif

    std::streamsize ret = std::fread(dst, 1, bytes, _cache);

    if (ret == 0) {
        if (std::ferror(_cache)) {
            std::cerr << "an error occurred while reading from cache" <<
                std::endl;
        }
#if GNASH_NOSEEK_FD_VERBOSE
        if (std::feof(_cache)) {
            std::cerr << "EOF reached while reading from cache" << std::endl;
        }
#endif
    }

#ifdef GNASH_NOSEEK_FD_VERBOSE
    std::cerr << boost::format("fread from _cache returned %d") % ret <<
        std::endl;
#endif

    return ret;

}
开发者ID:BrandRegard,项目名称:gnash,代码行数:42,代码来源:noseek_fd_adapter.cpp

示例12: while

bool istream::readtags(string& s, const string& tag)
{
	char buf[8192];

	s.clear();

	while (!eof())
	{
		size_t size = sizeof(buf);
		if (readtags(buf, &size, tag.c_str(), tag.length()) == true)
		{
			if (size > 0)
				s.append(buf, size);
			return true;
		}
		if (size > 0)
			s.append(buf, size);
	}
	return false;
}
开发者ID:FlowSea,项目名称:acl,代码行数:20,代码来源:istream.cpp

示例13: while

Token Lexer::Next()
{
	char curr_c;
	TType a_type;
	while (!eof())
	{
		curr_c = read();
		state = SwitchState(curr_c, state, a_type);
		if (state == accept)
		{
			Token Tok = Accept(a_type);
			if (a_type == Skip)
				continue;

			return Tok;
		}
	}
	if (state == ready)
		return Token(Eof, "");
}
开发者ID:AhmedHossamFadl,项目名称:Interpreter,代码行数:20,代码来源:Lexer.cpp

示例14: parseString

/**
Parse a source string as an expression
*/
Tuple parseString(const char* str, const char* srcName)
{
    auto input = new Input(
        str,
        srcName
    );

    input->eatWS();

    auto expr = parseExpr(input);

    input->eatWS();

    if (!input->eof())
    {
        throw ParseError(input, "unconsumed input remains");
    }

    return expr;
}
开发者ID:maximecb,项目名称:bjrn,代码行数:23,代码来源:parser.cpp

示例15: advance

 bool IntervalBtreeCursor::advance() {
     RARELY killCurrentOp.checkForInterrupt();
     if ( eof() ) {
         return false;
     }
     // Advance _curr to the next key in the btree.
     _curr.bucket = _curr.bucket.btree<V1>()->advance( _curr.bucket,
                                                       _curr.pos,
                                                       1,
                                                       __FUNCTION__ );
     skipUnused( &_curr );
     if ( _curr == _end ) {
         // _curr has reached _end, so iteration is complete.
         _curr.bucket.Null();
     }
     else {
         ++_nscanned;
     }
     return ok();
 }
开发者ID:Cassie90,项目名称:mongo,代码行数:20,代码来源:intervalbtreecursor.cpp


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