コード例 #1
0
ファイル: webfeedentry.cpp プロジェクト: prestocore/browser
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>");
	}
}
コード例 #2
0
ファイル: webfeedentry.cpp プロジェクト: prestocore/browser
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");
}