Пример #1
0
void Compress::storeLayerMap()
{
	rDebug("%s: m_fd: %d", __PRETTY_FUNCTION__, m_fd);

	// Don't store LayerMap if it has not been modified
	// since begining (open).

	if (!m_lm.isModified())
		return;

	io::nonclosable_file_descriptor file(m_fd);
	file.seek(m_RawFileSize, ios_base::beg);

	io::filtering_ostream out;
	m_fh.type.push(out);
	out.push(file);

	portable_binary_oarchive pba(out);
	pba << m_lm;

	// Set the file header's index to the current offset
	// where the index was saved.

	m_fh.index = m_RawFileSize;
}
Пример #2
0
void Compress::restoreFileHeader(const char *name)
{
	ifstream file(name);
	io::filtering_istream in;
	in.push(file);
	portable_binary_iarchive pba(in);
	pba >> m_fh;
}
Пример #3
0
void Compress::storeFileHeader() const
{
	rDebug("%s: m_fd: %d", __PRETTY_FUNCTION__, m_fd);

	io::nonclosable_file_descriptor file(m_fd);
	file.seek(0, ios_base::beg);

	io::filtering_ostream out;
	out.push(file);

	portable_binary_oarchive pba(out);
	pba << m_fh;
}
Пример #4
0
/* m_fh must be correct. m_length may be changed. */
void Compress::restoreLayerMap()
{
	rDebug("%s: fd: %d", __PRETTY_FUNCTION__, m_fd);

	io::nonclosable_file_descriptor file(m_fd);
	file.seek(m_fh.index, ios_base::beg);

	io::filtering_istream in;
	m_fh.type.push(in);
	in.push(file);

	portable_binary_iarchive pba(in);
	pba >> m_lm;

	// Optimization on size. Overwrite the index during
	// next write if the index was stared on the end of the file.

	if (file.seek(0, ios_base::cur) == file.seek(0, ios_base::end))
		m_RawFileSize = m_fh.index;
}
Пример #5
0
MagnormoCard::MagnormoCard(const gloox::VCard *vCard)
{
	gloox::VCard::Photo p = vCard->photo();
	QByteArray pba(p.binval.c_str(), p.binval.size());
	photo.loadFromData(pba);
}