VirtualBox

Ignore:
Timestamp:
Dec 22, 2016 7:23:15 AM (8 years ago)
Author:
vboxsync
Message:

XML: added new function setContent()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/xml.cpp

    r64158 r64993  
    12821282
    12831283/**
     1284 * Changes the contents of node and appends it to the list of
     1285 * children
     1286 *
     1287 * @param pcszContent
     1288 * @return
     1289 */
     1290ContentNode *ElementNode::setContent(const char *pcszContent)
     1291{
     1292//  1. Update content
     1293    xmlNodeSetContent(m_pLibNode, (const xmlChar*)pcszContent);
     1294
     1295//  2. Remove Content node from the list
     1296    /* Check that the order is right. */
     1297    xml::Node * pNode;
     1298    RTListForEach(&m_children, pNode, xml::Node, m_listEntry)
     1299    {
     1300        bool fLast = RTListNodeIsLast(&m_children, &pNode->m_listEntry);
     1301
     1302        if (pNode->isContent())
     1303        {
     1304            RTListNodeRemove(&pNode->m_listEntry);
     1305        }
     1306
     1307        if (fLast)
     1308            break;
     1309    }
     1310
     1311//  3. Create a new node and append to the list
     1312    // now wrap this in C++
     1313    ContentNode *pCNode = new ContentNode(this, &m_children, m_pLibNode);
     1314    RTListAppend(&m_children, &pCNode->m_listEntry);
     1315
     1316    return pCNode;
     1317}
     1318
     1319/**
    12841320 * Sets the given attribute; overloaded version for const char *.
    12851321 *
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette