COVISE Core
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
Public Member Functions | Private Member Functions | Private Attributes | List of all members
coConfigImportReader Class Reference

#include <coConfigImportReader.h>

Public Member Functions

 coConfigImportReader (const QString &source, const QString &dest, const QString &transform, bool resolve_includes=true)
 
 ~coConfigImportReader ()
 
QDomDocument parse ()
 
QDomDocument write ()
 
void updatev0v1 ()
 Updates the current result DOM tree from version 0 to version 1. More...
 

Private Member Functions

QDomElement findMapping (const QString &mapping, const QDomNode &parent) const
 
QDomElement getOrCreateSection (QDomDocument &document, QDomNode &parent, const QString &name, const QString &hosts="")
 
QDomNode addChild (QDomNode &parent, const QDomNode &newChild)
 
void update (QDomElement &rootNode, QDomElement &updater)
 Updates a DOM tree using the instructions in updater More...
 
void updateNode (QDomElement &node, QDomElement &updateInstruction)
 Update a node with an instruction set. More...
 
void updateEntry (QDomElement &node, QDomElement &updateInstruction)
 Apply a single instruction. More...
 
void updateApplyInstruction (QDomElement &node, QDomElement &updateInstruction)
 Apply a single instruction. More...
 
void updateMergeNodes (QDomElement &section, QDomElement &node)
 Merges two tags. More...
 
QLinkedList< QDomNode > makeNonLiveList (QDomNodeList liveList) const
 Converts a QDomNodeList into a QValueList<QDomNode>. More...
 
QString domToString (const QDomDocument &doc) const
 

Private Attributes

QFile * source
 
QFile * dest
 
QFile * transform
 
QTextStream * sourceStream
 
QDomDocument transformerDoc
 
QDomElement transformer
 
QDomDocument result
 
QDomNode root
 
QDomNode global
 
QString errorMessage
 
QMap< QString, QDomElement > hostconfigs
 
int errorLine
 
int errorColumn
 
bool resolveIncludes
 

Constructor & Destructor Documentation

coConfigImportReader::coConfigImportReader ( const QString &  source,
const QString &  dest,
const QString &  transform,
bool  resolve_includes = true 
)
coConfigImportReader::~coConfigImportReader ( )

Member Function Documentation

QDomNode coConfigImportReader::addChild ( QDomNode &  parent,
const QDomNode &  newChild 
)
private
QString coConfigImportReader::domToString ( const QDomDocument &  doc) const
inlineprivate
QDomElement coConfigImportReader::findMapping ( const QString &  mapping,
const QDomNode &  parent 
) const
private
QDomElement coConfigImportReader::getOrCreateSection ( QDomDocument &  document,
QDomNode &  parent,
const QString &  name,
const QString &  hosts = "" 
)
private
QLinkedList< QDomNode > coConfigImportReader::makeNonLiveList ( QDomNodeList  liveList) const
inlineprivate

Converts a QDomNodeList into a QValueList<QDomNode>.

Parameters
liveListThe QDomNodeList to convert
Returns
The non-live list

This has to be done as a QDomNodeList changes as nodes are added to / removed from the tree.

QDomDocument coConfigImportReader::parse ( )
void coConfigImportReader::update ( QDomElement &  rootNode,
QDomElement &  updater 
)
private

Updates a DOM tree using the instructions in updater

Parameters
rootNodeDOM tree to update.
updaterupdate instructions.

Updater format:

<Entry>
  <Instruction>
  ...
  </Instruction>
</Entry>
<Entry>
  ...
</Entry>
...
void coConfigImportReader::updateApplyInstruction ( QDomElement &  node,
QDomElement &  instruction 
)
inlineprivate

Apply a single instruction.

Parameters
nodeNode to apply the instruction to.
instructionInstruction to apply. Please see the file config/transform.xml for a detailed documentation.
void coConfigImportReader::updateEntry ( QDomElement &  node,
QDomElement &  updateInstruction 
)
inlineprivate

Apply a single instruction.

Parameters
nodeNode to update according to the instruction scope (AllChildren, Child or Self).
updateInstructionInstruction to apply.
void coConfigImportReader::updateMergeNodes ( QDomElement &  section,
QDomElement &  node 
)
inlineprivate

Merges two tags.

Parameters
sectionSection where the target node resides.
nodeNode to merge.
void coConfigImportReader::updateNode ( QDomElement &  node,
QDomElement &  updateInstruction 
)
inlineprivate

Update a node with an instruction set.

Parameters
nodeNode to update.
updateInstructionInstruction set.

Instruction set format:

<Instruction scope="AllChildren|Child|Self" [param="parameter"]>
  Instruction1
  Instruction2
  ...
</Instruction>
void coConfigImportReader::updatev0v1 ( )

Updates the current result DOM tree from version 0 to version 1.

Note
Has to be called after parse().

Updater format:

<TRANSFORM>
  <UpdateV0V1>
    <Entry>
     ...
  </UpdateV0V1>
</TRANSFORM>
QDomDocument coConfigImportReader::write ( )

Member Data Documentation

QFile* coConfigImportReader::dest
private
int coConfigImportReader::errorColumn
private
int coConfigImportReader::errorLine
private
QString coConfigImportReader::errorMessage
private
QDomNode coConfigImportReader::global
private
QMap<QString, QDomElement> coConfigImportReader::hostconfigs
private
bool coConfigImportReader::resolveIncludes
private
QDomDocument coConfigImportReader::result
private
QDomNode coConfigImportReader::root
private
QFile* coConfigImportReader::source
private
QTextStream* coConfigImportReader::sourceStream
private
QFile* coConfigImportReader::transform
private
QDomElement coConfigImportReader::transformer
private
QDomDocument coConfigImportReader::transformerDoc
private

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