LibMusicXML 3.22
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
xmlelement Class Reference

A generic xml element representation. More...

#include <xml.h>

Inheritance diagram for xmlelement:
ctree< xmlelement > visitable smartable musicxml< k_stem > musicxml< k_accent > musicxml< k_strong_accent > musicxml< k_staccato > musicxml< k_tenuto > musicxml< k_breath_mark > musicxml< k_trill_mark > musicxml< k_inverted_mordent > musicxml< k_mordent > musicxml< k_turn > musicxml< k_tremolo > musicxml< k_arpeggiate > musicxml< k_inverted_turn > musicxml< k_accidental_mark > musicxml< k_notehead > musicxml< k_fermata > musicxml< k_harmonic > musicxml< k_snap_pizzicato > musicxml< k_staccatissimo > musicxml< k_up_bow > musicxml< k_down_bow > musicxml< k_note > musicxml< k_measure > musicxml< k_movement_title > musicxml< k_key > musicxml< k_clef > musicxml< k_time > musicxml< k_part > musicxml< elt >

Public Types

typedef ctree< xmlelement >::iterator iterator
 
- Public Types inherited from ctree< xmlelement >
typedef SMARTP< xmlelementtreePtr
 the node sub elements type
 
typedef std::vector< treePtrbranchs
 the node sub elements container type
 
typedef branchs::iterator literator
 the current level iterator type
 
typedef treeIterator< treePtriterator
 the top -> bottom iterator type
 

Public Member Functions

virtual void acceptIn (basevisitor &visitor)
 
virtual void acceptOut (basevisitor &visitor)
 
int getInputLineNumber ()
 
void setValue (unsigned long value)
 
void setValue (long value)
 
void setValue (int value)
 
void setValue (float value)
 
void setValue (const std::string &value)
 
void setName (const std::string &name)
 
int getType () const
 
const std::string & getName () const
 
const std::string & getValue () const
 returns the element value as a string
 
 operator long () const
 returns the element value as a long
 
 operator int () const
 returns the element value as a int
 
 operator float () const
 returns the element value as a float
 
bool operator== (const xmlelement &elt) const
 elements comparison
 
bool operator!= (const xmlelement &elt) const
 
long add (const Sxmlattribute &attr)
 adds an attribute to the element
 
const std::vector< Sxmlattribute > & attributes () const
 
const Sxmlattribute getAttribute (const std::string &attrname) const
 
const std::string getAttributeValue (const std::string &attrname) const
 
long getAttributeLongValue (const std::string &attrname, long defaultvalue) const
 
int getAttributeIntValue (const std::string &attrname, int defaultvalue) const
 
float getAttributeFloatValue (const std::string &attrname, float defaultvalue) const
 
ctree< xmlelement >::iterator find (int type)
 
ctree< xmlelement >::iterator find (int type, ctree< xmlelement >::iterator start)
 
const std::string getValue (int subElementType)
 
int getIntValue (int subElementType, int defaultvalue)
 
long getLongValue (int subElementType, long defaultvalue)
 
float getFloatValue (int subElementType, float defaultvalue)
 
bool hasSubElement (int subElementType)
 returns true if subelement exists
 
bool hasSubElement (int subElementType, std::string value)
 returns true if subelement with given value exists
 
bool empty () const
 
- Public Member Functions inherited from ctree< xmlelement >
branchselements ()
 
const branchselements () const
 
virtual void push (const treePtr &t)
 
virtual int size () const
 
iterator begin ()
 
iterator end ()
 
iterator erase (iterator i)
 
iterator insert (iterator before, const treePtr &value)
 
literator lbegin ()
 
literator lend ()
 
- Public Member Functions inherited from smartable
unsigned refs () const
 gives the reference count of the object
 
void addReference ()
 addReference increments the ref count and checks for refCount overflow
 
void removeReference ()
 removeReference delete the object when refCount is zero

 

Static Public Member Functions

static SMARTP< xmlelementcreate (int inputLineNumber)
 
- Static Public Member Functions inherited from ctree< xmlelement >
static treePtr new_tree ()
 

Protected Member Functions

 xmlelement (int inputLineNumber)
 
- Protected Member Functions inherited from smartable
 smartable (const smartable &)
 
virtual ~smartable ()
 destructor checks for non-zero refCount
 
smartableoperator= (const smartable &)
 

Protected Attributes

int fType
 
int fInputLineNumber
 

Detailed Description

An element is represented by its name, its value,
the lists of its attributes and its enclosed elements.
Attributes and elements must be added in the required
order.

Member Function Documentation

◆ acceptIn()

virtual void acceptIn ( basevisitor visitor)
virtual

Reimplemented from visitable.

◆ acceptOut()

virtual void acceptOut ( basevisitor visitor)
virtual

Reimplemented from visitable.

◆ empty()

bool empty ( ) const
inlinevirtual

Reimplemented from ctree< xmlelement >.