Пример #1
0
void CConsole::SaveHistory()
{
	WriteBuffer buffer;
	const int linesToSkip = (int)m_deqBufHistory.size() - m_MaxHistoryLines;
	std::deque<std::wstring>::reverse_iterator it = m_deqBufHistory.rbegin();
	if(linesToSkip > 0)
		std::advance(it, linesToSkip);
	for (; it != m_deqBufHistory.rend(); ++it)
	{
		CStr8 line = CStrW(*it).ToUTF8();
		buffer.Append(line.data(), line.length());
		static const char newline = '\n';
		buffer.Append(&newline, 1);
	}
	g_VFS->CreateFile(m_sHistoryFile, buffer.Data(), buffer.Size());
}
Пример #2
0
void WebFeedContentElement::SaveL(WriteBuffer &buf, BOOL force_tags)
{
	BOOL is_plain_text = IsPlainText();
	BOOL in_cdata = FALSE;

	if (!is_plain_text || force_tags)
	{
		if (!is_plain_text)
		{
			buf.Append("<content type=\"");
			buf.AppendOpString(&m_type);
			buf.Append("\"><![CDATA[");
			in_cdata = TRUE;
		}
		else
			buf.Append("<content>");
	}

	if (HasValue())
	{
		if (!IsBinary())
			if (in_cdata)
				buf.Append(Data());
			else
				buf.AppendQuotedL(Data());
		else
			buf.AppendBinaryL(m_value, m_value_length);
	}

	if (!is_plain_text || force_tags)
	{
		if (in_cdata)
			buf.Append("]]>");

		buf.Append("</content>");
	}
}
Пример #3
0
void WebFeedEntry::SaveL(WriteBuffer &buf)
{
	buf.Append("\n<entry id=\"");
	buf.Append(m_id);
	buf.Append("\"");

	if (m_status == STATUS_READ)
		buf.Append(" read=\"yes\"");

	if (m_keep_item)
		buf.Append(" keep=\"yes\"");

	if (GetGuid())
	{
		buf.Append(" guid=\"");
		buf.AppendQuotedL(GetGuid());
		buf.Append("\"");
	}
	buf.Append(">\n");

	if (m_title)
	{
		buf.Append("<title>");
		m_title->SaveL(buf, FALSE);
		buf.Append("</title>\n");
	}

	if (m_pubdate != 0.0)
	{
		buf.Append("<date type=\"published\" value=\"");
		buf.AppendDate(m_pubdate);
		buf.Append("\"/>\n");
	}

	if (!GetPrimaryLink().IsEmpty())
	{
		OpString8 link;
		GetPrimaryLink().GetAttributeL(URL::KName_With_Fragment_Username_Password_Escaped_NOT_FOR_UI, link);

		buf.Append("<url value=\"");
		buf.AppendQuotedL(link.CStr());
		buf.Append("\"/>");
	}

	if (m_properties)
	{
		WebFeedPropElm *prop = (WebFeedPropElm *)m_properties->First();
		while (prop)
		{
			buf.Append("<prop name=\"");
			buf.Append(prop->GetName());
			buf.Append("\">");

			prop->GetContent()->SaveL(buf, FALSE);

			buf.Append("</prop>\n");

			prop = (WebFeedPropElm *)prop->Suc();
		}
	}

	if (m_content)
		m_content->SaveL(buf, TRUE);

	buf.Append("\n</entry>\n");
}