コード例 #1
0
ファイル: tu_file.cpp プロジェクト: codeoneclick/iGaia-Tanks
	bool	resize(int new_size)
	// Return false if we couldn't resize.
	{
		if (m_read_only) return false;

		m_.resize(new_size);

		// Hm, does this make sense?  We're truncating the file, so clamping the cursor.
		// Alternative would be to disallow resize, but that doesn't seem good either.
		if (m_position > m_.size())
		{
			m_position = m_.size();
		}

		return true;
	}
コード例 #2
0
ファイル: membuf.cpp プロジェクト: zhuzhonghua/flash
bool	membuf::operator!=(const membuf& buf) const
{
	if (size() != buf.size())
	{
		return false;
	}
	return memcmp(m_data, buf.m_data, size()) == 0 ? false : true;
}
コード例 #3
0
ファイル: tu_file.cpp プロジェクト: codeoneclick/iGaia-Tanks
	bool	is_valid()
	{
		return
			m_position >= 0
			&& m_position <= m_.size();
	}
コード例 #4
0
ファイル: membuf.cpp プロジェクト: zhuzhonghua/flash
void membuf::operator=(const membuf& buf)
{
	resize(buf.size());
	memcpy(m_data, buf.m_data, size());
	m_read_only = buf.m_read_only;
}
コード例 #5
0
ファイル: membuf.cpp プロジェクト: zhuzhonghua/flash
void membuf::append(const membuf& buf)
{
	append(buf.data(), buf.size());
}