GroveEditor — Interface for performing operations on the XML grove instance.
class GroveEditor : : public SimpleWrappedObjectSernaApi::SimpleWrappedObject { public: // construct/copy/destruct GroveEditor(SernaApiBase * = 0); // public member functions Command insertText(const GrovePos &, const SString &) ; Command removeText(const GrovePos &, unsigned int) ; Command replaceText(const GrovePos &, unsigned int, const SString &) ; Command insertElement(const GrovePos &, const SString &, const PropertyNode & = PropertyNode()) ; Command removeNode(const GroveNode &) ; Command splitElement(const GrovePos &) ; Command joinElements(const GroveElement &) ; Command renameElement(const GrovePos &, const SString &) ; Command setAttribute(const GroveAttr &, const SString &) ; Command addAttribute(const GroveElement &, const PropertyNode & = PropertyNode()) ; Command removeAttribute(const GroveAttr &) ; Command renameAttribute(const GroveAttr &, const PropertyNode & = PropertyNode()) ; Command mapXmlNs(const GroveElement &, const SString &, const SString &) ; Command insertEntity(const GrovePos &, const SString &) ; Command cut(const GrovePos &, const GrovePos &) ; void copy(const GrovePos &, const GrovePos &, const GroveDocumentFragment &) ; Command paste(const GroveDocumentFragment &, const GrovePos &) ; Command tagRegion(const GrovePos &, const GrovePos &, const SString &, const PropertyNode & = PropertyNode()) ; Command untag(const GrovePos &) ; Command insertPi(const GrovePos &, const SString &, const SString &) ; Command changePi(const GrovePos &, const SString &, const SString &) ; Command insertComment(const GrovePos &, const SString &) ; Command changeComment(const GrovePos &, const SString &) ; Command convertToRedline(const GrovePos &, const GrovePos &, unsigned int, const SString &) ; Command convertFromRedline(const GrovePos &) ; Command changeRedline(const GrovePos &, unsigned int, const SString &) ; Command insertRedline(const GrovePos &, unsigned int, const SString &) ; Command insertXinclude(const GrovePos &, const PropertyNode &, const GroveStripInfo & = GroveStripInfo(), bool = false) ; Command declareEntity(const GrovePos &, const PropertyNode &) ; SString errorMessage() const; };
GroveEditor
public member functionsCommand insertText(const GrovePos & pos, const SString & text) ;
Inserts text string at given position. If position is not within existing text, new GroveText node is created.
Command removeText(const GrovePos & pos, unsigned int count) ;
Removes count characters at current (text) position.
Command replaceText(const GrovePos & pos, unsigned int count, const SString & newText) ;
Replaces count characters at position pos with newText (pos should be text position)
Command insertElement(const GrovePos & pos, const SString & elementName, const PropertyNode & attrs = PropertyNode()) ;
Insert element with specified list of attributes at the current position.
Command removeNode(const GroveNode & node) ;
Remove specified node from the document tree.
Command splitElement(const GrovePos & pos) ;
Split element into two.
Command joinElements(const GroveElement & firstElement) ;
Join two neighbour elements. Both elements must be with the same name.
Command renameElement(const GrovePos & pos, const SString & newElementName) ;
Rename element at the specified position.
Command setAttribute(const GroveAttr & attr, const SString & newValue) ;
Set new attribute value.
Command addAttribute(const GroveElement & element, const PropertyNode & attrSpec = PropertyNode()) ;
Add new attribute to the element.
Command removeAttribute(const GroveAttr & attr) ;
Remove attribute.
Command renameAttribute(const GroveAttr & attr, const PropertyNode & attrSpec = PropertyNode()) ;
Rename attribute (and change it's specs).
Command mapXmlNs(const GroveElement & element, const SString & prefix, const SString & uri) ;
Add XMLNS mapping. Mapping to null uri means unmapping.
Command insertEntity(const GrovePos & pos, const SString & entityName) ;
Inserts entity reference to the given position.
Command cut(const GrovePos & from, const GrovePos & to) ;
Cut between specified positions.
Copy from between specified positions into the document fragment.
Command paste(const GroveDocumentFragment & clipboard, const GrovePos & to) ;
Paste document fragment to the specified position.
Command tagRegion(const GrovePos & from, const GrovePos & to, const SString & newElemName, const PropertyNode & attrMap = PropertyNode()) ;
Wrap specified range into new element.
Command untag(const GrovePos & pos) ;
Unwrap element at the specified position.
Command insertPi(const GrovePos & pos, const SString & target, const SString & text) ;
Inserts PI element at given position.
Command changePi(const GrovePos & pos, const SString & target, const SString & newtext) ;
Changes PI element at given position.
Command insertComment(const GrovePos & pos, const SString & text) ;
Inserts comment element at given position.
Command changeComment(const GrovePos & pos, const SString & newText) ;
Changes comment element at given position.
Command convertToRedline(const GrovePos & first, const GrovePos & last, unsigned int redlineMask, const SString & annotation) ;
Turns selected text into the redline.
Command convertFromRedline(const GrovePos & pos) ;
Expands current redline.
Command changeRedline(const GrovePos & pos, unsigned int redlineMask, const SString & annotation) ;
Change properties of the current redline.
Command insertRedline(const GrovePos & pos, unsigned int redlineMask, const SString & annotation) ;
Insert new (empty) redline.
Command insertXinclude(const GrovePos & pos, const PropertyNode & props, const GroveStripInfo & si = GroveStripInfo(), bool isText = false) ;
Insert new XInclude to pos. Property tree may have the following properties on the top level:
href (required) - the URL for the inclusion
xpointer (optional) - ID for inclusion
encoding (optional) - encoding
parse (optional, default=xml) - parse type
attrs - additional optional attributes. The children of 'attrs' must have name corresponding to the attribute name, value corresponding to the attribute URI, and child property 'value' which must hold the attribute value.
Command declareEntity(const GrovePos & pos, const PropertyNode & props) ;
Declare new entity or notation. This method does not create any entity references. Property tree may take the following properties on the top level:
name - entity/notation name
decl-type - entity declaration type, may be (internal, external, notation)
data-type - data type (cdata, ndata, sgml)
content - internal entity content or sysid
notation - notation name, meaningful for external entities only
SString errorMessage() const;
Returns error message.