示例#1
0
文件: xml_lmi.cpp 项目: vadz/lmi.new
bool get_attr
    (xml::element const& element
    ,std::string const&  name
    ,std::string&        value
    )
{
    try
        {
        xml::attributes const& attrs = element.get_attributes();
        xml::attributes::const_iterator i = attrs.find(name.c_str());
        if(i != attrs.end())
            {
            value = i->get_value();
            return true;
            }
        else
            {
            return false;
            }
        }
    catch(std::exception const& e)
        {
        fatal_error() << e.what() << LMI_FLUSH;
        throw "Unreachable--silences a compiler diagnostic.";
        }
}
示例#2
0
文件: xml_lmi.cpp 项目: vadz/lmi.new
void set_attr
    (xml::element&      element
    ,std::string const& name
    ,std::string const& value
    )
{
    try
        {
        element.get_attributes().insert(name.c_str(), value.c_str());
        }
    catch(std::exception const& e)
        {
        fatal_error() << e.what() << LMI_FLUSH;
        throw "Unreachable--silences a compiler diagnostic.";
        }
}