コード例 #1
0
ファイル: sci_consumer.cpp プロジェクト: gkalab/cb2pgn
void
Consumer::sendTrailingComment(Comment const& comment, bool variationIsEmpty)
{
	if (!comment.isEmpty())
	{
#ifndef ALLOW_EMPTY_VARS
		if (variationIsEmpty)
			putMove(m_move = Move::null());
#endif

		if (m_danglingEndMarker)
		{
			m_strm.put(token::End_Marker);
			m_danglingEndMarker--;
		}

		Byte flag = writeComment(comm::Post, comment);

		//M_ASSERT(flag);

		m_strm.put(token::Comment);
		m_data.put(flag);
		m_endOfRun = true;

		if (isMainline())
			m_lastCommentPos = plyCount() + 1;
	}
}
コード例 #2
0
ファイル: sci_consumer.cpp プロジェクト: gkalab/cb2pgn
Byte
Consumer::writeComment(Byte position, Comment const& comment)
{
	//M_ASSERT(position == comm::Ante || position == comm::Post);

	Byte flag = 0;

	if (!comment.isEmpty())
	{
		if (comment.engFlag())
			flag |= comm::Ante_Eng;
		if (comment.othFlag())
			flag |= comm::Ante_Oth;
		flag |= position;

		m_text.put(comment.content(), comment.size() + 1);
	}

	return flag;
}