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


C++ PHYSFS_tell函数代码示例

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


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

示例1: switch

int
OggSoundFile::cb_seek(void* source, ogg_int64_t offset, int whence)
{
  PHYSFS_file* file = reinterpret_cast<PHYSFS_file*> (source);

  switch(whence) {
    case SEEK_SET:
      if(PHYSFS_seek(file, static_cast<PHYSFS_uint64> (offset)) == 0)
        return -1;
      break;
    case SEEK_CUR:
      if(PHYSFS_seek(file, PHYSFS_tell(file) + offset) == 0)
        return -1;
      break;
    case SEEK_END:
      if(PHYSFS_seek(file, PHYSFS_fileLength(file) + offset) == 0)
        return -1;
      break;
    default:
#ifdef DEBUG
      assert(false);
#else
      return -1;
#endif
  }
  return 0;
}
开发者ID:slackstone,项目名称:tuxjunior,代码行数:27,代码来源:sound_file.cpp

示例2: switch

int OSBasics::seek(OSFILE * stream, long int offset, int origin ) {
	switch(stream->fileType) {
		case OSFILE::TYPE_FILE:
			return fseek(stream->file, offset, origin);
			break;
		case OSFILE::TYPE_ARCHIVE_FILE:
			switch(origin) {
				case SEEK_SET:
					return PHYSFS_seek(stream->physFSFile, offset);
				break;
				case SEEK_CUR: {
					PHYSFS_sint64 curoffset = PHYSFS_tell(stream->physFSFile);					
					return PHYSFS_seek(stream->physFSFile, curoffset+offset);				
				}
				break;
				case SEEK_END: {
					PHYSFS_sint64 fileLength =  PHYSFS_fileLength(stream->physFSFile);
					return PHYSFS_seek(stream->physFSFile, fileLength-offset);
				}
				break;
			}
			break;			
	}
	return 0;	
}
开发者ID:mcclure,项目名称:old-Polycode,代码行数:25,代码来源:OSBasics.cpp

示例3: PHYSFS_tell

        bool FileReadObject::seek(long finalPos, bool relativeMovement)
        {
            if (relativeMovement)
                finalPos += PHYSFS_tell(mFileHandle);

            return PHYSFS_seek(mFileHandle, finalPos);
        }
开发者ID:DraconicEnt,项目名称:KGE,代码行数:7,代码来源:CFileReader.cpp

示例4: return

	int File::tell()
	{
		if(file == 0)
			return -1;

		return (int)PHYSFS_tell(file);
	}
开发者ID:icedman,项目名称:lov8,代码行数:7,代码来源:physFile.cpp

示例5: PHYSFS_tell

uint FileStream::tell()
{
    if(!m_caching)
        return PHYSFS_tell(m_fileHandle);
    else
        return m_pos;
}
开发者ID:HeberPcL,项目名称:otclient,代码行数:7,代码来源:filestream.cpp

示例6: PHYSFS_tell

size_t
WavSoundFile::read(void* buffer, size_t buffer_size)
{
  PHYSFS_sint64 end = datastart + size;
  PHYSFS_sint64 cur = PHYSFS_tell(file);
  if(cur >= end)
    return 0;

  size_t readsize = std::min(static_cast<size_t> (end - cur), buffer_size);
  if(PHYSFS_read(file, buffer, readsize, 1) != 1)
    throw SoundError("read error while reading samples");

#ifdef WORDS_BIGENDIAN
  if (bits_per_sample != 16)
    return readsize;
  char *tmp = (char*)buffer;

  size_t i;
  char c;
  for (i = 0; i < readsize / 2; i++)
  {
    c          = tmp[2*i];
    tmp[2*i]   = tmp[2*i+1];
    tmp[2*i+1] = c;
  }

  buffer = tmp;
#endif

  return readsize;
}
开发者ID:AndroidAppList,项目名称:Android-Supertux,代码行数:31,代码来源:wav_sound_file.cpp

示例7: PHYSFS_tell

bool physfsFile::prepareRead() {
	PHYSFS_uint64 pos = PHYSFS_tell(fhandle);
	PHYSFS_close(fhandle);
	fhandle = PHYSFS_openRead(pname);
	PHYSFS_seek(fhandle, pos);
	//LOG_MSG("Goto read (%s at %i)",pname,PHYSFS_tell(fhandle));
    return true;
}
开发者ID:Cliff-F,项目名称:Boxer,代码行数:8,代码来源:drive_physfs.cpp

示例8: PHYSFS_fixedEof

int PHYSFS_fixedEof(PHYSFS_File *handle) {
    if((PHYSFS_eof(handle)) ||
       (PHYSFS_fileLength(handle) == PHYSFS_tell(handle))) {
        return 1;
    }

    return 0;
}
开发者ID:Mojofreem,项目名称:flub,代码行数:8,代码来源:physfsutil.c

示例9: wz_oggVorbis_seek

static int wz_oggVorbis_seek(void *datasource, ogg_int64_t offset, int whence)
{
	PHYSFS_file* fileHandle;
	BOOL allowSeeking;
	int newPos;

	ASSERT(datasource != NULL, "NULL decoder passed!");

	fileHandle = ((struct OggVorbisDecoderState*)datasource)->fileHandle;
	ASSERT(fileHandle != NULL, "Bad PhysicsFS file handle passed in");

	allowSeeking = ((struct OggVorbisDecoderState*)datasource)->allowSeeking;

	if (!allowSeeking)
		return -1;

	switch (whence)
	{
		// Seek to absolute position
		case SEEK_SET:
			newPos = offset;
			break;

		// Seek `offset` ahead
		case SEEK_CUR:
		{
			int curPos = PHYSFS_tell(fileHandle);
			if (curPos == -1)
				return -1;

			newPos = curPos + offset;
			break;
		}

		// Seek backwards from the end of the file
		case SEEK_END:
		{
			int fileSize = PHYSFS_fileLength(fileHandle);
			if (fileSize == -1)
				return -1;

			newPos = fileSize - 1 - offset;
			break;
		}

		// unrecognized seek instruction
		default:
			// indicate failure
			return -1;
	}

	// PHYSFS_seek return value of non-zero means success
	if (PHYSFS_seek(fileHandle, newPos) != 0)
		return newPos;   // success
	else
		return -1;  // failure
}
开发者ID:cybersphinx,项目名称:wzgraphicsmods,代码行数:57,代码来源:oggvorbis.c

示例10: seekpos

	pos_type seekpos(pos_type pos, std::ios_base::openmode mode) {
		PHYSFS_seek(file, pos);
		if (mode & std::ios_base::in) {
			setg(egptr(), egptr(), egptr());
		}
		if (mode & std::ios_base::out) {
			setp(buffer, buffer);
		}
		return PHYSFS_tell(file);
	}
开发者ID:dekimsey,项目名称:physfs-cpp,代码行数:10,代码来源:physfs.cpp

示例11: check_file_open

uint32_t File::tell() const
{
	check_file_open();

	PHYSFS_sint64 tp = PHYSFS_tell( reinterpret_cast<PHYSFS_file*> (mHandle) );

	if(tp == -1)
		BOOST_THROW_EXCEPTION( PhysfsFileException(mFileName) );

	return tp;
}
开发者ID:EliasOenal,项目名称:blobby,代码行数:11,代码来源:File.cpp

示例12: switch

long OSBasics::tell(OSFILE * stream) {
	switch(stream->fileType) {
		case OSFILE::TYPE_FILE:
			return ftell(stream->file);
			break;
		case OSFILE::TYPE_ARCHIVE_FILE:
			return PHYSFS_tell(stream->physFSFile);
			break;			
	}
	return 0;
}
开发者ID:RobLach,项目名称:Polycode,代码行数:11,代码来源:OSBasics.cpp

示例13: wz_oggVorbis_tell

static long wz_oggVorbis_tell(void *datasource)
{
	PHYSFS_file* fileHandle;

	ASSERT(datasource != NULL, "NULL decoder passed!");

	fileHandle = ((struct OggVorbisDecoderState*)datasource)->fileHandle;
	ASSERT(fileHandle != NULL, "Bad PhysicsFS file handle passed in");

	return PHYSFS_tell(fileHandle);
}
开发者ID:cybersphinx,项目名称:wzgraphicsmods,代码行数:11,代码来源:oggvorbis.c

示例14: PHYSFS_tell

std::size_t File::CurrentPosition() const
{
   PHYSFS_sint64 position = PHYSFS_tell(impl->physfsFileHandle);

   if (position == -1)
   {
      throw Exception(std::string("Could not obtain current position of file ") + mountedFilePath.path + "\n" + PHYSFS_getLastError());
   }

   return LossyCast<std::size_t, PHYSFS_sint64>(position);
}
开发者ID:ShacharAvni,项目名称:Locus-Game-Engine,代码行数:11,代码来源:File.cpp

示例15: seekoff

	pos_type seekoff(off_type pos, ios_base::seekdir dir, ios_base::openmode mode) {
		switch (dir) {
		case std::ios_base::beg:
			PHYSFS_seek(file, pos);
			break;
		case std::ios_base::cur:
			// subtract characters currently in buffer from seek position
			PHYSFS_seek(file, (PHYSFS_tell(file) + pos) - (egptr() - gptr()));
			break;
		case std::ios_base::end:
			PHYSFS_seek(file, PHYSFS_fileLength(file) + pos);
			break;
		}
		if (mode & std::ios_base::in) {
			setg(egptr(), egptr(), egptr());
		}
		if (mode & std::ios_base::out) {
			setp(buffer, buffer);
		}
		return PHYSFS_tell(file);
	}
开发者ID:dekimsey,项目名称:physfs-cpp,代码行数:21,代码来源:physfs.cpp


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