亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? basicexcelvc6.cpp

?? 對EXCEL的操作
?? CPP
?? 第 1 頁 / 共 5 頁
字號:
#include "BasicExcelVC6.hpp"

namespace YCompoundFiles
{
/********************************** Start of Class Block *************************************/
// PURPOSE: Manage a file by treating it as blocks of data of a certain size.
Block::Block() : 
	blockSize_(512), fileSize_(0), indexEnd_(0),
	filename_(0) {}

bool Block::Create(const wchar_t* filename)
// PURPOSE: Create a new block file and open it.
// PURPOSE: If file is present, truncate it and then open it.
// PROMISE: Return true if file is successfully created and opened, false if otherwise.
{
	// Create new file
	size_t filenameLength = wcslen(filename);
	char* name = new char[filenameLength+1];
	wcstombs(name, filename, filenameLength);
	name[filenameLength] = 0;

	file_.open(name, ios_base::out | ios_base::trunc);
	file_.close();
	file_.clear();

	// Open the file
	bool ret = this->Open(filename);
	delete[] name;
	return ret;
}

bool Block::Open(const wchar_t* filename, ios_base::openmode mode)
// PURPOSE: Open an existing block file.
// PROMISE: Return true if file is successfully opened, false if otherwise.
{
	// Open existing file for reading or writing or both
	size_t filenameLength = wcslen(filename);
	filename_.resize(filenameLength+1, 0);
	wcstombs(&*(filename_.begin()), filename, filenameLength);

	file_.open(&*(filename_.begin()), mode | ios_base::binary);
	if (!file_.is_open()) return false;

	mode_ = mode;
	
	// Calculate filesize
	if (mode & ios_base::in)
	{
		file_.seekg(0, ios_base::end);
		fileSize_ = file_.tellg();
	}
	else if (mode & ios_base::out)
	{
		file_.seekp(0, ios_base::end);
		fileSize_ = file_.tellp();
	}
	else
	{
		this->Close();
		return false;	
	}
	
	// Calculate last index + 1
	indexEnd_ = fileSize_/blockSize_ + (fileSize_ % blockSize_ ? 1 : 0);
	return true;
}

bool Block::Close()
// PURPOSE: Close the opened block file.
// PROMISE: Return true if file is successfully closed, false if otherwise.
{
	file_.close();
	file_.clear();
	filename_.clear(); 
	fileSize_ = 0; 
	indexEnd_ = 0; 
	blockSize_ = 512;
	return !file_.is_open();
}

bool Block::IsOpen()
// PURPOSE: Check if the block file is still opened.
// PROMISE: Return true if file is still opened, false if otherwise.
{
	return file_.is_open();
}

bool Block::Read(size_t index, char* block)
// PURPOSE: Read a block of data from the opened file at the index position.
// EXPLAIN: index is from [0..].
// PROMISE: Return true if data are successfully read, false if otherwise.
{
	if (!(mode_ & ios_base::in)) return false;
	if (index < indexEnd_)
	{
		file_.seekg(index * blockSize_);
		file_.read(block, blockSize_);
		return !file_.fail();
	}
	else return false;
}

bool Block::Write(size_t index, const char* block)
// PURPOSE: Write a block of data to the opened file at the index position.
// EXPLAIN: index is from [0..].
// PROMISE: Return true if data are successfully written, false if otherwise.
{
	if (!(mode_ & ios_base::out)) return false;
	file_.seekp(index * blockSize_);
	file_.write(block, blockSize_);
	if (indexEnd_ <= index) 
	{
		indexEnd_ = index + 1;
		fileSize_ += blockSize_;
	}
	file_.close();
	file_.clear();
	file_.open(&*(filename_.begin()), mode_ | ios_base::binary);
	return file_.is_open();		
}

bool Block::Swap(size_t index1, size_t index2)
// PURPOSE: Swap two blocks of data in the opened file at the index positions.
// EXPLAIN: index1 and index2 are from [0..].
// PROMISE: Return true if data are successfully swapped, false if otherwise.
{
	if (!(mode_ & ios_base::out)) return false;
	if (index1 < indexEnd_ && index2 < indexEnd_)
	{
		if (index1 == index2) return true;
		
		char* block1 = new char[blockSize_];
		if (!this->Read(index1, block1)) return false;
		
		char* block2 = new char[blockSize_];
		if (!this->Read(index2, block2)) return false;
		
		if (!this->Write(index1, block2)) return false;
		if (!this->Write(index2, block1)) return false;
		
		delete[] block1;
		delete[] block2;
		return true;
	}
	else return false;
}

bool Block::Move(size_t from, size_t to)
// PURPOSE: Move a block of data in the opened file from an index position to another index position.
// EXPLAIN: from and to are from [0..].
// PROMISE: Return true if data are successfully moved, false if otherwise.
{
	if (!(mode_ & ios_base::out)) return false;
	if (from < indexEnd_ && to < indexEnd_)
	{
		if (to > from)
		{
			for (size_t i=from; i!=to; ++i)
			{
				if (!this->Swap(i, i+1)) return false;	
			}
		}
		else
		{
			for (size_t i=from; i!=to; --i)
			{
				if (!this->Swap(i, i-1)) return false;	
			}
		}
		return true;	
	}
	else return false;
}

bool Block::Insert(size_t index, const char* block)
// PURPOSE: Insert a new block of data in the opened file at the index position.
// EXPLAIN: index is from [0..].
// PROMISE: Return true if data are successfully inserted, false if otherwise.
{
	if (!(mode_ & ios_base::out)) return false;
	if (index <= indexEnd_)
	{
		// Write block to end of file
		if (!this->Write(indexEnd_, block)) return false;

		// Move block to index if necessary
		if (index < indexEnd_-1) return this->Move(indexEnd_-1, index);
		else return true;
	}
	else 
	{
		// Write block to index after end of file
		return this->Write(index, block); 
	}
}

bool Block::Erase(size_t index)
// PURPOSE: Erase a block of data in the opened file at the index position.
// EXPLAIN: index is from [0..].
// PROMISE: Return true if data are successfully erased, false if otherwise.
{
	if (!(mode_ & ios_base::out)) return false;
	if (index < indexEnd_)
	{
		fileSize_ -= blockSize_;
		indexEnd_ -= 1;
		
		// Read entire file except the block to be deleted into memory.
		char* buffer = new char[fileSize_];
		for (size_t i=0, j=0; i!=indexEnd_+1; ++i) 
		{
			file_.seekg(i*blockSize_);
			if (i != index) 
			{
				file_.read(buffer+j*blockSize_, blockSize_);
				++j;
			}
		}
		file_.close();
		file_.open(&*(filename_.begin()), ios_base::out | ios_base::trunc | ios_base::binary);
		file_.write(buffer, fileSize_);	// Write the new file.
		file_.close();
		file_.open(&*(filename_.begin()), mode_ | ios_base::binary);
		delete[] buffer;
		return true;
	}
	else return false;
}

bool Block::Erase(vector<size_t>& indices)
// PURPOSE: Erase blocks of data in the opened file at the index positions.
// EXPLAIN: Each index in indices is from [0..].
// PROMISE: Return true if data are successfully erased, false if otherwise.
{
	if (!(mode_ & ios_base::out)) return false;

	// Read entire file except the blocks to be deleted into memory.
	size_t maxIndices = indices.size();
	fileSize_ -= maxIndices*blockSize_;
	char* buffer = new char[fileSize_];
	for (size_t i=0, k=0; i!=indexEnd_; ++i) 
	{
		file_.seekg(i*blockSize_);
		bool toDelete = false;
		for (size_t j=0; j<maxIndices; ++j)
		{
			if (i == indices[j])
			{
				toDelete = true;
				break;
			}
		}
		if (!toDelete) 
		{
			file_.read(buffer+k*blockSize_, blockSize_);
			++k;
		}
	}
	indexEnd_ -= maxIndices;
	
	file_.close();
	file_.open(&*(filename_.begin()), ios_base::out | ios_base::trunc | ios_base::binary);
	file_.write(buffer, fileSize_);	// Write the new file.
	file_.close();
	file_.open(&*(filename_.begin()), mode_ | ios_base::binary);
	delete[] buffer;
	return true;
}
/********************************** End of Class Block ***************************************/

/********************************** Start of Class Header ************************************/
// PURPOSE: Read and write data to a compound file header.
CompoundFile::Header::Header() : 
	fileType_(0xE11AB1A1E011CFD0),
	uk1_(0), uk2_(0), uk3_(0), uk4_(0), uk5_(0x003B), uk6_(0x0003), uk7_(-2),
	log2BigBlockSize_(9), log2SmallBlockSize_(6), 
	uk8_(0), uk9_(0), uk10_(0), uk11_(0x00001000),
	SBATStart_(-2), SBATCount_(0),
	XBATStart_(-2), XBATCount_(0),
	BATCount_(1), propertiesStart_(1) 
{
	BATArray_[0] = 0;	// Initial BAT indices at block 0 (=block 1 in Block)
	fill (BATArray_+1, BATArray_+109, -1);	// Rest of the BATArray is empty
	Initialize();
}

void CompoundFile::Header::Write(char* block)
// PURPOSE: Write header information into a block of data.
// REQUIRE: Block of data must be at least 512 bytes in size.
{
	LittleEndian::Write(block, fileType_, 0x0000, 8);
	LittleEndian::Write(block, uk1_, 0x0008, 4);
	LittleEndian::Write(block, uk2_, 0x000C, 4);
	LittleEndian::Write(block, uk3_, 0x0010, 4);
	LittleEndian::Write(block, uk4_, 0x0014, 4);
	LittleEndian::Write(block, uk5_, 0x0018, 2);
	LittleEndian::Write(block, uk6_, 0x001A, 2);
	LittleEndian::Write(block, uk7_, 0x001C, 2);
	LittleEndian::Write(block, log2BigBlockSize_, 0x001E, 2);
	LittleEndian::Write(block, log2SmallBlockSize_, 0x0020, 4);
	LittleEndian::Write(block, uk8_, 0x0024, 4);
	LittleEndian::Write(block, uk9_, 0x0028, 4);
	LittleEndian::Write(block, BATCount_, 0x002C, 4);
	LittleEndian::Write(block, propertiesStart_, 0x0030, 4);
	LittleEndian::Write(block, uk10_, 0x0034, 4);
	LittleEndian::Write(block, uk11_, 0x0038, 4);
	LittleEndian::Write(block, SBATStart_, 0x003C, 4);
	LittleEndian::Write(block, SBATCount_, 0x0040, 4);
	LittleEndian::Write(block, XBATStart_, 0x0044, 4);
	LittleEndian::Write(block, XBATCount_, 0x0048, 4);
	for (size_t i=0; i<109; ++i) LittleEndian::Write(block, BATArray_[i], 0x004C+i*4, 4);
}

void CompoundFile::Header::Read(char* block)
// PURPOSE: Read header information from a block of data.
// REQUIRE: Block of data must be at least 512 bytes in size.
{
	LittleEndian::Read(block, fileType_, 0x0000, 8);
	LittleEndian::Read(block, uk1_, 0x0008, 4);
	LittleEndian::Read(block, uk2_, 0x000C, 4);
	LittleEndian::Read(block, uk3_, 0x0010, 4);
	LittleEndian::Read(block, uk4_, 0x0014, 4);
	LittleEndian::Read(block, uk5_, 0x0018, 2);
	LittleEndian::Read(block, uk6_, 0x001A, 2);
	LittleEndian::Read(block, uk7_, 0x001C, 2);
	LittleEndian::Read(block, log2BigBlockSize_, 0x001E, 2);
	LittleEndian::Read(block, log2SmallBlockSize_, 0x0020, 4);
	LittleEndian::Read(block, uk8_, 0x0024, 4);
	LittleEndian::Read(block, uk9_, 0x0028, 4);
	LittleEndian::Read(block, BATCount_, 0x002C, 4);
	LittleEndian::Read(block, propertiesStart_, 0x0030, 4);
	LittleEndian::Read(block, uk10_, 0x0034, 4);
	LittleEndian::Read(block, uk11_, 0x0038, 4);
	LittleEndian::Read(block, SBATStart_, 0x003C, 4);
	LittleEndian::Read(block, SBATCount_, 0x0040, 4);
	LittleEndian::Read(block, XBATStart_, 0x0044, 4);
	LittleEndian::Read(block, XBATCount_, 0x0048, 4);
	for (size_t i=0; i<109; ++i) LittleEndian::Read(block, BATArray_[i], 0x004C+i*4, 4);
	Initialize();		
}

void CompoundFile::Header::Initialize()
{
	bigBlockSize_ = (size_t)pow(2.0, log2BigBlockSize_);		// Calculate each big block size.
	smallBlockSize_ = (size_t)pow(2.0, log2SmallBlockSize_);	// Calculate each small block size.
}
/********************************** End of Class Header **************************************/

/********************************** Start of Class Property **********************************/
// PURPOSE: Read and write data to a compound file property.
CompoundFile::Property::Property() :
	nameSize_(0),
	propertyType_(1), nodeColor_(1),
	previousProp_(-1), nextProp_(-1), childProp_(-1),
	uk1_(0), uk2_(0), uk3_(0), uk4_(0), uk5_(0),
	seconds1_(0), days1_(0), seconds2_(0), days2_(0),
	startBlock_(-2), size_(0)
{
	fill (name_, name_+32, 0);
}

void CompoundFile::Property::Write(char* block)
// PURPOSE: Write property information from a block of data.
// REQUIRE: Block of data must be at least 128 bytes in size.
{
	LittleEndian::WriteString(block, name_, 0x00, 32);
	LittleEndian::Write(block, nameSize_, 0x40, 2);
	LittleEndian::Write(block, propertyType_, 0x42, 1);
	LittleEndian::Write(block, nodeColor_, 0x43, 1);
	LittleEndian::Write(block, previousProp_, 0x44, 4);
	LittleEndian::Write(block, nextProp_, 0x48, 4);
	LittleEndian::Write(block, childProp_, 0x4C, 4);
	LittleEndian::Write(block, uk1_, 0x50, 4);
	LittleEndian::Write(block, uk2_, 0x54, 4);
	LittleEndian::Write(block, uk3_, 0x58, 4);
	LittleEndian::Write(block, uk4_, 0x5C, 4);
	LittleEndian::Write(block, uk5_, 0x60, 4);
	LittleEndian::Write(block, seconds1_, 0x64, 4);
	LittleEndian::Write(block, days1_, 0x68, 4);
	LittleEndian::Write(block, seconds2_, 0x6C, 4);
	LittleEndian::Write(block, days2_, 0x70, 4);
	LittleEndian::Write(block, startBlock_, 0x74, 4);
	LittleEndian::Write(block, size_, 0x78, 4);
}

void CompoundFile::Property::Read(char* block)
// PURPOSE: Read property information from a block of data.
// REQUIRE: Block of data must be at least 128 bytes in size.
{
	LittleEndian::ReadString(block, name_, 0x00, 32);
	LittleEndian::Read(block, nameSize_, 0x40, 2);
	LittleEndian::Read(block, propertyType_, 0x42, 1);
	LittleEndian::Read(block, nodeColor_, 0x43, 1);
	LittleEndian::Read(block, previousProp_, 0x44, 4);
	LittleEndian::Read(block, nextProp_, 0x48, 4);
	LittleEndian::Read(block, childProp_, 0x4C, 4);
	LittleEndian::Read(block, uk1_, 0x50, 4);
	LittleEndian::Read(block, uk2_, 0x54, 4);
	LittleEndian::Read(block, uk3_, 0x58, 4);
	LittleEndian::Read(block, uk4_, 0x5C, 4);
	LittleEndian::Read(block, uk5_, 0x60, 4);
	LittleEndian::Read(block, seconds1_, 0x64, 4);
	LittleEndian::Read(block, days1_, 0x68, 4);
	LittleEndian::Read(block, seconds2_, 0x6C, 4);
	LittleEndian::Read(block, days2_, 0x70, 4);
	LittleEndian::Read(block, startBlock_, 0x74, 4);
	LittleEndian::Read(block, size_, 0x78, 4);
}
/********************************** End of Class Property ************************************/

/********************************** Start of Class PropertyTree **********************************/
CompoundFile::PropertyTree::PropertyTree() {};

CompoundFile::PropertyTree::~PropertyTree()
{
	size_t maxChildren = children_.size();

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品一区二区男女羞羞无遮挡| 日韩精品五月天| 欧美午夜寂寞影院| 精品在线一区二区三区| 亚洲另类一区二区| 久久影院电视剧免费观看| 色婷婷狠狠综合| 国产精品正在播放| 日韩中文字幕av电影| 国产精品第一页第二页第三页| 欧美一区日韩一区| 在线视频国内一区二区| 成人免费黄色在线| 韩国三级在线一区| 亚洲不卡在线观看| 亚洲码国产岛国毛片在线| 久久久亚洲午夜电影| 欧美一区二区日韩一区二区| 欧美性大战xxxxx久久久| 成人福利在线看| 国产麻豆精品在线| 六月婷婷色综合| 日本不卡高清视频| 天天爽夜夜爽夜夜爽精品视频| 亚洲人成网站精品片在线观看| 久久九九99视频| 337p粉嫩大胆色噜噜噜噜亚洲| 91精品国产日韩91久久久久久| 欧美日韩免费高清一区色橹橹| 91视频免费播放| 99视频一区二区三区| 国产成人精品免费视频网站| 激情综合网最新| 经典三级一区二区| 精品一区二区三区免费毛片爱| 青青草原综合久久大伊人精品 | 亚洲国产综合色| 亚洲欧美日韩一区二区三区在线观看 | 国产精品一区二区久久不卡 | 成人一级黄色片| 国产九色sp调教91| 国产伦精品一区二区三区免费迷 | 在线视频综合导航| 欧美天堂一区二区三区| 日本韩国欧美三级| 欧美日韩成人激情| 337p亚洲精品色噜噜狠狠| 在线综合视频播放| 日韩欧美的一区| 精品国一区二区三区| 久久男人中文字幕资源站| 2020国产成人综合网| 国产亚洲欧美一级| 中文字幕在线不卡一区| 中文字幕在线不卡一区| 一区二区三区欧美日韩| 亚洲成a人片在线观看中文| 日韩av电影天堂| 国产在线精品一区二区不卡了 | 欧美大片日本大片免费观看| 精品精品国产高清a毛片牛牛| 国产视频亚洲色图| 国产精品大尺度| 一级女性全黄久久生活片免费| 五月婷婷欧美视频| 精品一区二区三区蜜桃| 成人免费视频国产在线观看| 91成人在线免费观看| 日韩欧美国产一区在线观看| 国产日韩欧美综合在线| 亚洲美女屁股眼交| 麻豆91精品视频| 9人人澡人人爽人人精品| 欧美日韩亚洲国产综合| 久久免费看少妇高潮| 综合久久久久综合| 青青草精品视频| 波多野结衣在线一区| 5566中文字幕一区二区电影| 国产精品久久一级| 日韩高清一区在线| 福利91精品一区二区三区| 欧美午夜电影网| 26uuuu精品一区二区| 亚洲猫色日本管| 激情小说欧美图片| 91福利精品视频| 国产日产欧产精品推荐色| 亚洲午夜在线电影| 国产成人av电影在线播放| 欧美亚洲另类激情小说| 久久在线免费观看| 天堂av在线一区| 99视频一区二区三区| 2019国产精品| 天天免费综合色| 色综合久久久久久久| 久久日一线二线三线suv| 视频一区免费在线观看| 99精品视频在线播放观看| 日韩你懂的在线播放| 亚洲一区二区欧美日韩| 国产成人午夜高潮毛片| 欧美一区二区久久| 亚洲综合在线视频| 成人激情校园春色| 久久久综合激的五月天| 日本欧美在线看| 在线观看一区二区精品视频| 中文一区在线播放| 久久超碰97人人做人人爱| 欧美精三区欧美精三区| 一区二区三区波多野结衣在线观看| 国产剧情av麻豆香蕉精品| 欧美成人猛片aaaaaaa| 天堂久久一区二区三区| 在线免费一区三区| 亚洲欧洲精品天堂一级| 国产91精品精华液一区二区三区 | 欧美日韩久久久一区| 亚洲欧美另类在线| 成人精品电影在线观看| 国产日韩欧美不卡| 国产风韵犹存在线视精品| 精品国精品自拍自在线| 九九视频精品免费| 日韩三级伦理片妻子的秘密按摩| 亚洲成a人片综合在线| 在线观看中文字幕不卡| 夜夜嗨av一区二区三区网页 | 欧美一区二区三区日韩视频| 亚洲国产精品一区二区久久恐怖片 | 欧美精品欧美精品系列| 午夜精品在线看| 911精品产国品一二三产区| 午夜激情久久久| 欧美精选午夜久久久乱码6080| 图片区小说区区亚洲影院| 欧美日韩国产大片| 丝袜a∨在线一区二区三区不卡| 欧美日韩亚洲综合| 热久久一区二区| 精品国精品国产尤物美女| 国产麻豆视频精品| 中文字幕一区二区视频| 91视频com| 亚洲午夜视频在线观看| 欧美一三区三区四区免费在线看| 久久国产精品99精品国产| xvideos.蜜桃一区二区| 国产成人在线看| 国产欧美一区二区精品性| 成人av电影在线网| 亚洲免费看黄网站| 欧美男同性恋视频网站| 日韩黄色小视频| 久久综合一区二区| 成人aaaa免费全部观看| 亚洲卡通欧美制服中文| 欧美美女网站色| 极品瑜伽女神91| 亚洲三级在线免费观看| 欧美丰满美乳xxx高潮www| 精品亚洲porn| 中文字幕一区二区三中文字幕| 91黄色在线观看| 日本不卡视频在线观看| 国产欧美日韩在线看| 在线影视一区二区三区| 蜜臀av一区二区| 国产精品久久久久影院老司| 欧美日韩国产综合一区二区| 黑人巨大精品欧美一区| 一区二区在线看| 日韩精品中午字幕| 一本一本大道香蕉久在线精品 | 久久精品在线免费观看| 91久久香蕉国产日韩欧美9色| 裸体健美xxxx欧美裸体表演| 亚洲人成人一区二区在线观看 | 性做久久久久久久免费看| 欧美xxxxxxxx| 91免费视频大全| 精品亚洲成a人| 亚洲国产视频a| 国产日韩欧美高清| 91精品国产色综合久久不卡蜜臀 | 欧美精品视频www在线观看| 国产在线视频精品一区| 亚洲亚洲人成综合网络| 国产婷婷一区二区| 欧美精品v日韩精品v韩国精品v| 国产成人亚洲精品狼色在线| 亚洲bt欧美bt精品777| 中文乱码免费一区二区| 日韩午夜在线播放| 精品视频在线看| 成人av电影免费观看| 九一九一国产精品| 偷拍一区二区三区四区|