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


C++ XMLHelper::GetAttribute方法代码示例

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


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

示例1:

// XMLRestore
status_t
PlaybackReport::XMLRestore(XMLHelper& xml)
{
	status_t ret = B_OK;

	while (xml.OpenTag("CLIP")) {
		BString clipID = xml.GetAttribute("clip_id", "");
		int32 playbackCount = xml.GetAttribute("playback_count", (int32)-1);

		if (clipID.Length() > 0 && playbackCount >= 0) {
			ret = fIDPlaybackCountMap.Put(clipID.String(), playbackCount);
		}

		if (ret == B_OK)
			ret = xml.CloseTag(); // CLIP

		if (ret < B_OK)
			break;
	}

	return ret;
}
开发者ID:stippi,项目名称:Clockwerk,代码行数:23,代码来源:PlaybackReport.cpp

示例2:

// XMLRestore
status_t
RenderPreset::XMLRestore(XMLHelper& xmlHelper)
{
	xmlHelper.GetAttribute("name", fName);
	fRenderPreview = xmlHelper.GetAttribute("preview", fRenderPreview);

	// "use alpha" depends on "preview" setting
	if (!fRenderPreview)
		fUseAlpha = xmlHelper.GetAttribute("use_alpha", fUseAlpha);
	else
		fUseAlpha = false;

	if (xmlHelper.OpenTag("FILE_FORMAT") == B_OK) {
		xmlHelper.GetAttribute("name", fFamilyName);
		xmlHelper.CloseTag();	// FILE_FORMAT
	}
	if (xmlHelper.OpenTag("VIDEO") == B_OK) {
		fHasVideoTrack = xmlHelper.GetAttribute("on", fHasVideoTrack);
		if (xmlHelper.OpenTag("VIDEO_FORMAT") == B_OK) {
			fLineWidth = xmlHelper.GetAttribute("line_width", fLineWidth);
			fLineCount = xmlHelper.GetAttribute("line_count", fLineCount);
			fColorSpace = (color_space)xmlHelper.GetAttribute("color_space",
														 (int32)fColorSpace);
			xmlHelper.CloseTag();	// VIDEO_FORMAT
		}
		if (xmlHelper.OpenTag("VIDEO_CODEC") == B_OK) {
			xmlHelper.GetAttribute("name", fVideoCodecName);
			xmlHelper.CloseTag();	// VIDEO_CODEC
		}
		if (xmlHelper.OpenTag("QUALITY") == B_OK) {
			fVideoQuality = xmlHelper.GetAttribute("value", fVideoQuality);
			xmlHelper.CloseTag();	// QUALITY;
		}
		xmlHelper.CloseTag();	// VIDEO;
	}
	if (xmlHelper.OpenTag("AUDIO") == B_OK) {
		fHasAudioTrack = xmlHelper.GetAttribute("on", fHasAudioTrack);
		if (xmlHelper.OpenTag("AUDIO_CODEC") == B_OK) {
			xmlHelper.GetAttribute("name", fAudioCodecName);
			fAudioFrameRate = xmlHelper.GetAttribute("frame_rate", fAudioFrameRate);
			fAudioChannelCount = xmlHelper.GetAttribute("channels", fAudioChannelCount);
			xmlHelper.CloseTag();	// AUDIO_CODEC
		}
		xmlHelper.CloseTag();	// AUDIO
	}
	if (xmlHelper.OpenTag("COPYRIGHT") == B_OK) {
		xmlHelper.GetAttribute("string", fCopyright);
		xmlHelper.CloseTag();	// COPYRIGHT
	}
	if (xmlHelper.OpenTag("TIMECODE") == B_OK) {
		fTimeCodeOverlay = xmlHelper.GetAttribute("visible", fTimeCodeOverlay);
		fTimeCodeTransparency = xmlHelper.GetAttribute("transparency", fTimeCodeTransparency);
		fTimeCodeScale = xmlHelper.GetAttribute("scale", fTimeCodeScale);
		xmlHelper.CloseTag();	// TIMECODE
	}
	return B_OK;
}
开发者ID:stippi,项目名称:Clockwerk,代码行数:58,代码来源:RenderPreset.cpp


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