UpdaterScriptParser Class Reference

Interface to Mendeley updater .xml script files. More...

#include <updaterscriptparser.h>

Public Member Functions

 UpdaterScriptParser (QDomDocument &document)
 
void merge (const QDomDocument &otherDoc)
 Merges other script with current script. More...
 
QString setPackageName (const QString &name)
 Sets value of package name tags in the script file. More...
 

Detailed Description

Interface to Mendeley updater .xml script files.

When UpdaterScriptParser is constructed it operates on a pre-existing QDomDocument. The QDomDocument object must remain valid or any method that operates on its contents will crash the program.

It is safe to destroy the parser after the document is destroyed.

Definition at line 40 of file updaterscriptparser.h.

Member Function Documentation

void UpdaterScriptParser::merge ( const QDomDocument &  otherDoc)

Merges other script with current script.

This method doesn't merge entire XML file, instead it is assumed that the source document is either completely empty or already a valid updater script. These nodes get merged:

  • /packages/ *
  • /install/ *

The merge is done by making deep copies.

If this UpdaterScriptParser has a null document then the script will be generated by copying the otherDoc to current doc.

Definition at line 58 of file updaterscriptparser.cpp.

QString UpdaterScriptParser::setPackageName ( const QString &  name)

Sets value of package name tags in the script file.

More than one package in script is considered an error, and the method won't make any modifications and will return error message.

Modifies following paths:

  • /packages/package[0]/name/#text
  • /install/file[*]/package/#text - "file[*]" means every "file" element.
Returns
A null QString if successful. If failed then QString contains error message.

Definition at line 100 of file updaterscriptparser.cpp.


The documentation for this class was generated from the following files: