示例#1
0
/***********************************************************************//**
 * @brief Set attribute value
 *
 * @param[in] name Attribute name.
 * @param[in] value Attribute value.
 *
 * Sets an attribute of the element. If the attribute name exists the value
 * is modified. If the attribute does not yet exist it is created and
 * added to the list of attributes.
 *
 * Note that this logical assures that only one attribute with a given name
 * will exist in the element.
 ***************************************************************************/
void GXmlElement::attribute(const std::string& name, const std::string& value)
{
    // Initialise attribute NULL pointer
    GXmlAttribute* attr = NULL;

    // Search attribute name in list of attributes
    for (int i = 0; i < m_attr.size(); ++i) {
        if (m_attr[i]->name() == name) {
            attr = m_attr[i];
            break;
        }
    }

    // If no attribute with specified name has been found then add a new
    // attribute to the list of attributes
    if (attr == NULL) {
        attr = new GXmlAttribute;
        attr->name(name);
        m_attr.push_back(attr);
    }

    // Set or update value of attribute
    attr->value(value);

    // Return
    return;
}
示例#2
0
/***********************************************************************//**
 * @brief Set standalone
 *
 * @param[in] standalone Standalone value string.
 ***************************************************************************/
inline
void GXmlDocument::standalone(const std::string& standalone)
{
    m_standalone.value(standalone);
    return;
}
示例#3
0
/***********************************************************************//**
 * @brief Set encoding
 *
 * @param[in] encoding Encoding string.
 ***************************************************************************/
inline
void GXmlDocument::encoding(const std::string& encoding)
{
    m_encoding.value(encoding);
    return;
}
示例#4
0
/***********************************************************************//**
 * @brief Set version
 *
 * @param[in] version Version string.
 ***************************************************************************/
inline
void GXmlDocument::version(const std::string& version)
{
    m_version.value(version);
    return;
}
示例#5
0
/***********************************************************************//**
 * @brief Return standalone
 *
 * @return Standalone value string.
 ***************************************************************************/
inline
std::string GXmlDocument::standalone(void) const
{
    return (m_standalone.value());
}
示例#6
0
/***********************************************************************//**
 * @brief Return encoding
 *
 * @return Encoding string.
 ***************************************************************************/
inline
std::string GXmlDocument::encoding(void) const
{
    return (m_encoding.value());
}
示例#7
0
/***********************************************************************//**
 * @brief Return version
 *
 * @return Version string.
 ***************************************************************************/
inline
std::string GXmlDocument::version(void) const
{
    return (m_version.value());
}