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


C++ IODevice::read_int32方法代码示例

本文整理汇总了C++中IODevice::read_int32方法的典型用法代码示例。如果您正苦于以下问题:C++ IODevice::read_int32方法的具体用法?C++ IODevice::read_int32怎么用?C++ IODevice::read_int32使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IODevice的用法示例。


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

示例1: load

void ZipFileHeader::load(IODevice &input)
{
	signature = input.read_int32();
	if (signature != 0x02014b50)
	{
		throw Exception("Incorrect File Header signature");
	}
	version_made_by = input.read_int16();
	version_needed_to_extract = input.read_int16();
	general_purpose_bit_flag = input.read_int16();
	compression_method = input.read_int16();
	last_mod_file_time = input.read_int16();
	last_mod_file_date = input.read_int16();
	crc32 = input.read_uint32();
	compressed_size = input.read_int32();
	uncompressed_size = input.read_int32();
	file_name_length = input.read_int16();
	extra_field_length = input.read_int16();
	file_comment_length = input.read_int16();
	disk_number_start = input.read_int16();
	internal_file_attributes = input.read_int16();
	external_file_attributes = input.read_int32();
	relative_offset_of_local_header = input.read_int32();
	filename.resize(file_name_length);

	auto str1 = new char[file_name_length];
	auto str2 = new char[extra_field_length];
	auto str3 = new char[file_comment_length];
	try
	{
		input.read(str1, file_name_length);
		input.read(str2, extra_field_length);
		input.read(str3, file_comment_length);
		if (general_purpose_bit_flag & ZIP_USE_UTF8)
		{
			filename = StringHelp::utf8_to_text(std::string(str1, file_name_length));
			file_comment = StringHelp::utf8_to_text(std::string(str3, file_comment_length));
		}
		else
		{
			filename = StringHelp::cp437_to_text(std::string(str1, file_name_length));
			file_comment = StringHelp::cp437_to_text(std::string(str3, file_comment_length));
		}

		extra_field = DataBuffer(str2, extra_field_length);

		delete[] str1;
		delete[] str2;
		delete[] str3;
	}
	catch (...)
	{
		delete[] str1;
		delete[] str2;
		delete[] str3;
		throw;
	}
}
开发者ID:ARMCoderCHS,项目名称:ClanLib,代码行数:58,代码来源:zip_file_header.cpp

示例2: Exception

	void Zip64EndOfCentralDirectoryLocator::load(IODevice &input)
	{
		signature = input.read_int32();
		if (signature != 0x07064b50)
		{
			throw Exception("Incorrect Zip64 End of central directory locator signature!");
		}

		number_of_disk_with_zip64_end_of_central_directory = input.read_int32();
		relative_offset_of_zip64_end_of_central_directory = input.read_int64();
		total_number_of_disks = input.read_int32();
	}
开发者ID:ArtHome12,项目名称:ClanLib,代码行数:12,代码来源:zip_64_end_of_central_directory_locator.cpp

示例3: load

void OutlineProviderFile_Impl::load(IODevice &input_source)
{
	// file type & version identifiers
	int type = input_source.read_uint32();
	unsigned char version = input_source.read_uint8();

	if( type != 0x16082004  )
		throw Exception("File is not a collision outline file" );
	if( version != 1 )
		throw Exception(string_format("Unsupported version of outline format: %1. Supported versions: 1.", version) );

	// read in width and height
	width = input_source.read_int32();
	height = input_source.read_int32();

	// x-pos of enclosing disc
	minimum_enclosing_disc.position.x = input_source.read_float();
	// y-pos of enclosing disc
	minimum_enclosing_disc.position.y = input_source.read_float();
	// radius of enclosing disc
	minimum_enclosing_disc.radius = input_source.read_float();
	
	// num contours
	int num_contours = input_source.read_uint32();

	for( int cc=0; cc < num_contours; ++cc )
	{
		Contour contour;

		int num_points = input_source.read_uint32();

		for( int pp=0; pp < num_points; ++pp )
		{
			Pointf point(0,0);
			point.x = input_source.read_float();
			point.y = input_source.read_float();

			contour.get_points().push_back(point);
		}
		
		contours.push_back(contour);
	}
}
开发者ID:Cassie90,项目名称:ClanLib,代码行数:43,代码来源:outline_provider_file_generic.cpp

示例4: Exception

	void Zip64EndOfCentralDirectoryRecord::load(IODevice &input)
	{
		signature = input.read_int32();
		if (signature != 0x06064b50)
		{
			throw Exception("Incorrect Zip64 End of Central Directory Record signature");
		}

		size_of_record = input.read_int64();
		version_made_by = input.read_int16();
		version_needed_to_extract = input.read_int16();
		number_of_this_disk = input.read_int32();
		number_of_disk_with_central_directory_start = input.read_int32();
		number_of_entries_on_this_disk = input.read_int64();
		number_of_entries_in_central_directory = input.read_int64();
		size_of_central_directory = input.read_int64();
		offset_to_start_of_central_directory = input.read_int64();

		// todo: read extensible data sector
	}
开发者ID:keigen-shu,项目名称:ClanLib,代码行数:20,代码来源:zip_64_end_of_central_directory_record.cpp


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