当前位置: 首页>>代码示例>>C++>>正文


C++ ExportContext::writeString方法代码示例

本文整理汇总了C++中ExportContext::writeString方法的典型用法代码示例。如果您正苦于以下问题:C++ ExportContext::writeString方法的具体用法?C++ ExportContext::writeString怎么用?C++ ExportContext::writeString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ExportContext的用法示例。


在下文中一共展示了ExportContext::writeString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: xmlExportContent

void FlatMessageIO::xmlExportContent(
	ExportContext& context) const {

	context.beginContent();

	// convert message to base64
	ASSERT(m_message);
	ssize_t flatSize = m_message->FlattenedSize();
	ASSERT(flatSize);
	char* flatData = new char[flatSize];
	status_t err = m_message->Flatten(flatData, flatSize);
	ASSERT(err == B_OK);
	
	// make plenty of room for encoded content (encode_base64 adds newlines)
	ssize_t base64Size = ((flatSize * 3) / 2);
	char* base64Data = new char[base64Size];
	ssize_t base64Used = encode_base64(base64Data, flatData, flatSize);
	base64Data[base64Used] = '\0';
	
	// write the data

	const char* pos = base64Data;
	while(*pos) {
		ssize_t chunk = 0;
		const char* nextBreak = strchr(pos, '\n');
		if(!nextBreak)
			chunk = strlen(pos);
		else
			chunk = nextBreak - pos;

		context.writeString(context.indentString());
		context.writeString(pos, chunk);
		context.writeString("\n");
		
		pos += chunk;
		if(*pos == '\n')
			++pos;
	}
	
	// clean up
	delete [] flatData;
	delete [] base64Data;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:43,代码来源:FlatMessageIO.cpp

示例2: write_media_type

void write_media_type(
	media_type t,
	ExportContext& context) {

	context.beginElement(MediaFormatIO::s_media_type_tag);
	context.beginContent();
	
	switch(t) {
		case B_MEDIA_NO_TYPE:
			context.writeString("B_MEDIA_NO_TYPE");
			break;
		case B_MEDIA_UNKNOWN_TYPE:
			context.writeString("B_MEDIA_UNKNOWN_TYPE");
			break;
		case B_MEDIA_RAW_AUDIO:
			context.writeString("B_MEDIA_RAW_AUDIO");
			break;
		case B_MEDIA_RAW_VIDEO:
			context.writeString("B_MEDIA_RAW_VIDEO");
			break;
		case B_MEDIA_VBL:
			context.writeString("B_MEDIA_VBL");
			break;
		case B_MEDIA_TIMECODE:
			context.writeString("B_MEDIA_TIMECODE");
			break;
		case B_MEDIA_MIDI:
			context.writeString("B_MEDIA_MIDI");
			break;
		case B_MEDIA_TEXT:
			context.writeString("B_MEDIA_TEXT");
			break;
		case B_MEDIA_HTML:
			context.writeString("B_MEDIA_HTML");
			break;
		case B_MEDIA_MULTISTREAM:
			context.writeString("B_MEDIA_MULTISTREAM");
			break;
		case B_MEDIA_PARAMETERS:
			context.writeString("B_MEDIA_PARAMETERS");
			break;
		case B_MEDIA_ENCODED_AUDIO:
			context.writeString("B_MEDIA_ENCODED_AUDIO");
			break;
		case B_MEDIA_ENCODED_VIDEO:
			context.writeString("B_MEDIA_ENCODED_VIDEO");
			break;
		default: {
			BString val;
			val << (uint32)t;
			context.writeString(val);
		}
	}
	context.endElement();
}
开发者ID:HaikuArchives,项目名称:Cortex,代码行数:55,代码来源:MediaFormatIO.cpp

示例3: xmlExportContent

void ConnectionIO::xmlExportContent(
    ExportContext&						context) const {

    context.beginContent();

    // write output
    {
        context.beginElement(_OUTPUT_ELEMENT);
        context.beginContent();

        // describe the node
//		LiveNodeIO nodeIO(
//			m_manager,
//			dynamic_cast<NodeSetIOContext*>(&context),
//			m_outputNode);
        context.writeObject(m_outputNodeIO);

//		context.beginElement(_LIVE_NODE_ELEMENT);
//		if(m_outputNodeKey.Length()) {
//			context.writeAttr("key", m_outputNodeKey);
//		}
//		else {
//			_write_simple("name", m_outputNodeName.String(), context);
//			_write_node_kinds(m_outputNodeKind, context);
//		}
//		context.endElement(); // _LIVE_NODE_ELEMENT

        // describe the output

        _write_simple("name", m_outputName.String(), context);

        if(m_outputFormat.type > B_MEDIA_UNKNOWN_TYPE) {
            MediaFormatIO io(m_outputFormat);
            context.writeObject(&io);
        }

        context.endElement(); // _OUTPUT_ELEMENT
    }

    // write input
    {
        context.beginElement(_INPUT_ELEMENT);
        context.beginContent();

        // describe the node
//		LiveNodeIO nodeIO(
//			m_manager,
//			dynamic_cast<NodeSetIOContext*>(&context),
//			m_inputNode);
        context.writeObject(m_inputNodeIO);

//		context.beginElement(_LIVE_NODE_ELEMENT);
//		if(m_inputNodeKey.Length()) {
//			context.writeAttr("key", m_inputNodeKey);
//		}
//		else {
//			_write_simple("name", m_inputNodeName.String(), context);
//			_write_node_kinds(m_inputNodeKind, context);
//		}
//		context.endElement(); // _LIVE_NODE_ELEMENT

        // describe the input

        _write_simple("name", m_inputName.String(), context);

        if(m_inputFormat.type > B_MEDIA_UNKNOWN_TYPE) {
            MediaFormatIO io(m_inputFormat);
            context.writeObject(&io);
        }

        context.endElement(); // _INPUT_ELEMENT
    }

    // write requested format
    if(m_requestedFormat.type > B_MEDIA_UNKNOWN_TYPE) {
        MediaFormatIO io(m_requestedFormat);
        BString comment = "\n";
        comment << context.indentString();
        comment << "<!-- initial requested format -->";
        context.writeString(comment);
        context.writeObject(&io);
    }
}
开发者ID:yunxiaoxiao110,项目名称:haiku,代码行数:83,代码来源:ConnectionIO.cpp

示例4: xmlExportContent

void NodeKey::xmlExportContent(
	ExportContext&								context) const {
	context.beginContent();
	context.writeString(content);
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:5,代码来源:NodeKey.cpp


注:本文中的ExportContext::writeString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。