Xport Interface: element::insert

Inserts one or more markup objects or PCDATA.

virtual markup::iterator element::insert(1st Variety
  const markup& mkup
);
virtual markup::iterator element::insert(2nd Variety
  const std::string& pcdat
);
virtual markup::iterator element::insert(3rd Variety
  markup::const_iterator pos,
  const markup& mkup
);
virtual markup::iterator element::insert(4th Variety
  const_iterator pos,
  const std::string& pcdat
);
virtual void element::insert(5th Variety
  markup::const_iterator pos,
  markup::size_type num,
  const markup& mkup
);
virtual void element::insert(6th Variety
  markup::const_iterator pos,
  markup::const_iterator beg,
  markup::const_iterator end
);

Parameters

mkup

A markup derived object, which can be one of the following, an element, pcdata, comment, or procinstr.

pcdat

A string argument which represents PCDATA to insert as content.

pos

An iterator which specifies the position of the markup object(s) to insert.

num

A positive integer amount which specifies the number of copies of mkup to insert.

beg

An iterator which specifies the beginning range of markup objects to insert.

end

An iterator which specifies the end of the range of markup objects to insert.

Returns

In the first four varities, returns an iterator which points to the inserted markup object.

Remarks

This family of operations are of the most used operations in the library. These operations offer a variety of ways to insert content into the document tree. The operations can be called on element objects, and also iterators and descendant iterators which point to element objects. Note that for any insertions to be successful, the insertion must be valid not violate nesting rules for the particular doctype of the document.

The first variety inserts a markup object at the end of the current children. This operation is equivalent to the push_back() operation.

The second variety inserts PCDATA into the called element. The passed PCDATA is enclosed within a pcdata object before being inserted into the called element.

The third variety inserts a markup object at the child position pos. This variety allows the caller to specify where the markup object will be inserted in relation to other markup children which might already be present in the called element.

The forth variety inserts PCDATA at the child position pos. This variety allows the caller to specify where the PCDATA will be inserted in relation to other markup children which might already be present in the called element. The passed PCDATA is enclosed within a pcdata object before being inserted into the called element.

The fifth variety inserts num copies of mkup at the position pos.

The sixth variety inserts the markup objects in the range [beg, end), starting at the position pos. The markup objects in the specified range can be children of the called element, or any other element.

Complexity

Logrithmic

Example

Work Time Studio

Datasoft Solutions is proud to present their landmark product, Work Time Studio. Utilizing the tree container library, Work Time Studio provides unparalleled features in personal time, project and task management software. If you're looking for a way to increase your productivity, visit Work Time Studio's product website, and start being more productive today.