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


C++ xml_node::empty方法代码示例

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


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

示例1: insert_setting

BOOL gdipp_setting::insert_setting(const wchar_t *node_name, const wchar_t *node_text, const wchar_t *parent_xpath, const wchar_t *ref_node_xpath, wstring &new_node_xpath)
{
	// insert the new node as a child node before the reference node, and output its XPath

	bool b_ret;

	xml_node parent_node = _xml_doc->select_single_node(parent_xpath).node();
	if (parent_node.empty())
		return FALSE;

	const xml_node ref_node = _xml_doc->select_single_node(ref_node_xpath).node();
	if (ref_node.empty())
		return FALSE;

	xml_node new_node = parent_node.insert_child_before(node_element, ref_node);
	if (new_node.empty())
		return FALSE;

	xml_node text_node = new_node.append_child(node_pcdata);
	if (text_node.empty())
		return FALSE;

	b_ret = new_node.set_name(node_name);
	if (!b_ret)
		return FALSE;

	text_node.set_value(node_text);
	if (!b_ret)
		return FALSE;

	new_node_xpath = new_node.path();
	return TRUE;
}
开发者ID:Carye,项目名称:gdipp,代码行数:33,代码来源:setting.cpp

示例2: remove_setting

BOOL gdipp_setting::remove_setting(const wchar_t *node_xpath)
{
	const xml_node node = _xml_doc->select_single_node(node_xpath).node();
	if (node.empty())
		return FALSE;

	xml_node parent_node = node.parent();
	if (parent_node.empty())
		return FALSE;

	parent_node.remove_child(node);
	return TRUE;
}
开发者ID:Carye,项目名称:gdipp,代码行数:13,代码来源:setting.cpp

示例3: load_setting

BOOL gdipp_setting::load_setting(const wchar_t *setting_path)
{
	if (!_xml_doc->load_file(as_utf8(setting_path).c_str()))
		return FALSE;

	const xpath_node_set proc_list = _xml_doc->select_nodes(L"/gdipp/gdimm/process");
	if (!proc_list.empty())
		load_gdimm_process(proc_list);

	const xpath_node_set font_list = _xml_doc->select_nodes(L"/gdipp/gdimm/font");
	if (!font_list.empty())
		load_gdimm_font(font_list);

	const xml_node demo_node = _xml_doc->select_single_node(L"/gdipp/demo").node();
	if (!demo_node.empty())
		load_demo(demo_node);

	const xml_node exclude_node = _xml_doc->select_single_node(L"/gdipp/exclude").node();
	if (!exclude_node.empty())
		load_exclude(exclude_node);

	return TRUE;
}
开发者ID:Carye,项目名称:gdipp,代码行数:23,代码来源:setting.cpp

示例4: idoc_eval_string

/// @brief Replaces any IDoc parameters with a the specified value from the input IDoc. IDoc
///     parameters should be in the format {IDoc:SegmentName:FieldName}
///     Note you must specify the input IDoc to use by first calling idoc_select_input_file
/// @param a new string with the IDoc parameters replaced with their values
/// @return a new string with the IDoc parameters replaced
IDOCREPLAYDLL_API LPCSTR idoc_eval_string(const LPCSTR parameterizedString)
{
    if (!ensure_valid_license())
    {
        return parameterizedString;
    }

    if (parameterizedString == NULL)
    {
        lr_error_message("Parameterized string cannot be empty.");
        return parameterizedString;
    }

    // TODO: move this check so that it only throws an error when parameterizedString contains something that looks like an IDoc parameter (i.e. {IDoc:xxx:yyy}
    // We don't want an error to be raised when idoc_create() is called with standard LoadRunner parameters.
    if (g_idocParamInputFilePath.empty())
    {
    //    lr_error_message("Input file is not selected. (Call idoc_select_input_file first.)");
        return parameterizedString;
    }

    g_allocatedStrings.push_back(std::string());

    string& result = g_allocatedStrings.back();

    const char* currentString = parameterizedString;

    cmatch matchResults;
    while (regex_search(currentString, matchResults, g_parameterRegex) && matchResults.size() == 3)
    {
        const cmatch::difference_type offset = matchResults.position();
        if (offset > 0)
        {
            result.append(currentString, offset);
            currentString += offset;
        }

        const sub_match<const char*> entireMatch = matchResults[0];
        const sub_match<const char*> segmentMatch = matchResults[1];
        const sub_match<const char*> fieldMatch = matchResults[2];

        const string segment(segmentMatch.first, segmentMatch.length());
        const string field(fieldMatch.first, fieldMatch.length());

        const xml_node segmentNode = get_node_value(g_idocParamInputFile.root(), segment);
        const xml_node fieldNode = get_node_value(segmentNode, field);

        if (segmentNode.empty() || fieldNode.empty())
        {
            result.append(currentString, entireMatch.length());
            currentString += entireMatch.length();

            if (is_param_log_enabled())
            {
                lr_output_message(
                    "Warning: [IDoc] Unable to find IDoc parameter '%s:%s'.",
                    segment.c_str(),
                    field.c_str());
            }

            continue;
        }

        const char_t* value = fieldNode.text().as_string();
        result.append(value);

        if (is_param_log_enabled())
        {
            lr_output_message(
                "[IDoc] Parameter substitution: '%s:%s' => '%s'.",
                segment.c_str(),
                field.c_str(),
                value);
        }

        currentString += entireMatch.length();
    }

    result.append(currentString);

    return result.c_str();
}
开发者ID:MyLoadTest,项目名称:IDocWizard,代码行数:87,代码来源:IDocReplayDLL.cpp


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