atomicrex  0.1
An advanced atomistic model building tool
Public Member Functions | List of all members
atomicrex::XML::OElement Class Reference

#include <XMLUtilities.h>

Inheritance diagram for atomicrex::XML::OElement:
atomicrex::XML::Element

Public Member Functions

 OElement ()
 Constructor that creates a null element.
 
 OElement (const char *name)
 Constructor that creates an element with the given name.
 
 operator bool () const noexcept
 Returns whether this element object is null (i.e. not pointing to any XML element).
 
- Public Member Functions inherited from atomicrex::XML::Element
 Element (xmlNodePtr e=nullptr)
 Constructor that takes a LibXml element.
 
FPString textContent () const
 Returns the text content of the XML element.
 
int parseIntParameterElement (const char *tagName) const
 
int parseOptionalIntParameterElement (const char *tagName, int defaultValue) const
 
double parseFloatParameterElement (const char *tagName) const
 
double parseOptionalFloatParameterElement (const char *tagName, double defaultValue) const
 
FPString parseStringParameterElement (const char *tagName) const
 
FPString parseOptionalStringParameterElement (const char *tagName, const FPString &defaultValue=FPString()) const
 
FPString parsePathParameterElement (const char *tagName) const
 
FPString parseOptionalPathParameterElement (const char *tagName, const FPString &defaultValue=FPString()) const
 
double parseFloatParameterAttribute (const char *attributeName) const
 
double parseOptionalFloatParameterAttribute (const char *attributeName, double defaultValue) const
 
int parseIntParameterAttribute (const char *attributeName) const
 
int parseOptionalIntParameterAttribute (const char *attributeName, int defaultValue) const
 
FPString parseStringParameterAttribute (const char *attributeName) const
 
FPString parseOptionalStringParameterAttribute (const char *attributeName, const FPString &defaultValue=FPString()) const
 
FPString parsePathParameterAttribute (const char *attributeName) const
 
bool parseBooleanParameterAttribute (const char *attributeName) const
 
bool parseOptionalBooleanParameterAttribute (const char *attributeName, bool defaultValue) const
 
Element firstChildElement () const
 Returns the element's first child element if it has any.
 
Element firstChildElement (const char *tagName) const
 Returns the first child element with the given tag name if it has any.
 
Element expectChildElement (const char *tagName) const
 Returns the first child element with the given name, or throws an exception if it doesn't exist.
 
 operator bool () const noexcept
 Returns whether this element object is null (i.e. not pointing to any XML element).
 
bool tagEquals (const char *tagName) const
 Returns true if this element's tag name equals the given string.
 
void expectTag (const char *tagName) const
 Throws an exception if the element' tag doesn't equal the given string.
 
bool hasAttribute (const char *attrName) const
 Returns true if this XML element has an attribute with the given name.
 
int lineNumber () const
 Returns the line number of this element in the XML file.
 
Element nextSibling () const
 Returns the next sibling element from the children of this element's parent element.
 
Element nextSibling (const char *tagName) const
 Returns the next sibling element with the given tag name from the children of this element's parent element.
 
const char * tag () const
 Returns the tag name of this element.
 
 operator xmlNodePtr () const noexcept
 Returns the wrapped libxml element.
 
Element createIntParameterElement (const char *tagName, int value)
 Creates a child element with formatted text content.
 
Element createFloatParameterElement (const char *tagName, double value)
 Creates a child element with formatted text content.
 
Element createStringParameterElement (const char *tagName, const FPString &value)
 Creates a child element with formatted text content.
 
int attributeCount () const
 Returns the number of attributes of this element.
 
void appendChild (OElement &element)
 Appends a child element to this element.
 
void appendChild (OElement &&element)
 Appends a child element to this element.
 
void setAttribute (const char *attr, const FPString &value)
 Sets an attribute on this XML element.
 
void setTagName (const FPString &tagName)
 Changes the tag name of this element.
 
void setTextContent (const FPString &text)
 

Additional Inherited Members

- Protected Member Functions inherited from atomicrex::XML::Element
FPString resolveFilename (const FPString &filename) const
 
- Protected Attributes inherited from atomicrex::XML::Element
xmlNodePtr _el
 The internal pointer to the xmllib element.
 

Detailed Description

An output XML element from the DOM tree model used for file generation.

This is a thin wrapper class for elements of the LibXML library.


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