ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
vtkPVXMLElement Class Reference

#include <vtkPVXMLElement.h>

Inheritance diagram for vtkPVXMLElement:
[legend]
Collaboration diagram for vtkPVXMLElement:
[legend]

Public Member Functions

 vtkTypeMacro (vtkPVXMLElement, vtkObject)
 
void PrintSelf (ostream &os, vtkIndent indent) override
 
 vtkSetStringMacro (Name)
 
 vtkGetStringMacro (Name)
 
 vtkGetStringMacro (Id)
 
const char * GetAttribute (const char *name)
 
const char * GetAttributeOrEmpty (const char *name)
 
const char * GetAttributeOrDefault (const char *name, const char *notFound)
 
const char * GetCharacterData ()
 
int GetScalarAttribute (const char *name, int *value)
 
int GetScalarAttribute (const char *name, float *value)
 
int GetScalarAttribute (const char *name, double *value)
 
int GetVectorAttribute (const char *name, int length, int *value)
 
int GetVectorAttribute (const char *name, int length, float *value)
 
int GetVectorAttribute (const char *name, int length, double *value)
 
int GetCharacterDataAsVector (int length, int *value)
 
int GetCharacterDataAsVector (int length, float *value)
 
int GetCharacterDataAsVector (int length, double *value)
 
vtkPVXMLElement * GetParent ()
 
unsigned int GetNumberOfNestedElements ()
 
vtkPVXMLElement * GetNestedElement (unsigned int index)
 
vtkPVXMLElement * FindNestedElement (const char *id)
 
vtkPVXMLElement * FindNestedElementByName (const char *name)
 
void FindNestedElementByName (const char *name, vtkCollection *elements)
 
void RemoveAllNestedElements ()
 
void RemoveNestedElement (vtkPVXMLElement *)
 
void ReplaceNestedElement (vtkPVXMLElement *elementToReplace, vtkPVXMLElement *element)
 
vtkPVXMLElement * LookupElement (const char *id)
 
void AddAttribute (const char *attrName, const char *attrValue)
 
void AddAttribute (const char *attrName, unsigned int attrValue)
 
void AddAttribute (const char *attrName, double attrValue)
 
void AddAttribute (const char *attrName, double attrValue, int precision)
 
void AddAttribute (const char *attrName, int attrValue)
 
void RemoveAttribute (const char *attrName)
 
void SetAttribute (const char *attrName, const char *attrValue)
 
void AddNestedElement (vtkPVXMLElement *element, int setPrent)
 
void AddNestedElement (vtkPVXMLElement *element)
 
void PrintXML (ostream &os, vtkIndent indent)
 
void PrintXML ()
 
void Merge (vtkPVXMLElement *element, const char *attributeName)
 
void GetElementsByName (const char *name, vtkCollection *elements)
 
void GetElementsByName (const char *name, vtkCollection *elements, bool recursively)
 
bool Equals (vtkPVXMLElement *other)
 
void CopyTo (vtkPVXMLElement *other)
 
void CopyAttributesTo (vtkPVXMLElement *other)
 

Static Public Member Functions

static vtkPVXMLElement * New ()
 
static std::string Encode (const char *plaintext)
 

Protected Member Functions

 vtkPVXMLElement ()
 
 ~vtkPVXMLElement () override
 
 vtkSetStringMacro (Id)
 
void ReadXMLAttributes (const char **atts)
 
void AddCharacterData (const char *data, int length)
 
vtkPVXMLElement * LookupElementInScope (const char *id)
 
vtkPVXMLElement * LookupElementUpScope (const char *id)
 
void SetParent (vtkPVXMLElement *parent)
 

Protected Attributes

char * Name
 
char * Id
 
vtkPVXMLElement * Parent
 

Constructor & Destructor Documentation

◆ vtkPVXMLElement()

vtkPVXMLElement::vtkPVXMLElement ( )
protected

References Id, Name, and Parent.

◆ ~vtkPVXMLElement()

vtkPVXMLElement::~vtkPVXMLElement ( )
overrideprotected

Member Function Documentation

◆ AddAttribute() [1/5]

void vtkPVXMLElement::AddAttribute ( const char *  attrName,
const char *  attrValue 
)

Given it's name and value, add an attribute.

Referenced by AddAttribute(), Merge(), ReadXMLAttributes(), and SetAttribute().

◆ AddAttribute() [2/5]

void vtkPVXMLElement::AddAttribute ( const char *  attrName,
double  attrValue 
)

References AddAttribute().

◆ AddAttribute() [3/5]

void vtkPVXMLElement::AddAttribute ( const char *  attrName,
double  attrValue,
int  precision 
)

References AddAttribute().

◆ AddAttribute() [4/5]

void vtkPVXMLElement::AddAttribute ( const char *  attrName,
int  attrValue 
)

References AddAttribute().

◆ AddAttribute() [5/5]

void vtkPVXMLElement::AddAttribute ( const char *  attrName,
unsigned int  attrValue 
)

References AddAttribute().

◆ AddCharacterData()

void vtkPVXMLElement::AddCharacterData ( const char *  data,
int  length 
)
protected

◆ AddNestedElement() [1/2]

void vtkPVXMLElement::AddNestedElement ( vtkPVXMLElement *  element)

References AddNestedElement().

◆ AddNestedElement() [2/2]

void vtkPVXMLElement::AddNestedElement ( vtkPVXMLElement *  element,
int  setPrent 
)

Add a sub-element. The parent element keeps a reference to sub-element. If setParent is true, the nested element's parent is set as this.

References SetParent().

Referenced by AddNestedElement(), CopyTo(), vtkPVXMLParser::EndElement(), and Merge().

◆ CopyAttributesTo()

void vtkPVXMLElement::CopyAttributesTo ( vtkPVXMLElement *  other)

Copy the attributes from current XML element content into the provided one.

References AddCharacterData().

◆ CopyTo()

void vtkPVXMLElement::CopyTo ( vtkPVXMLElement *  other)

Copy the current XML element content into the provided one

References AddCharacterData(), and AddNestedElement().

◆ Encode()

std::string vtkPVXMLElement::Encode ( const char *  plaintext)
static

Encode a string.

References SNPRINTF.

Referenced by PrintXML().

◆ Equals()

bool vtkPVXMLElement::Equals ( vtkPVXMLElement *  other)

Return true if the current object has the same content as the other. The comparison implementation is pretty weak in the mean that we compare resulting XML string.

References PrintXML().

◆ FindNestedElement()

vtkPVXMLElement * vtkPVXMLElement::FindNestedElement ( const char *  id)

Find a nested element with the given id. Not that this searches only the immediate children of this vtkPVXMLElement.

Referenced by LookupElementInScope(), and LookupElementUpScope().

◆ FindNestedElementByName() [1/2]

vtkPVXMLElement * vtkPVXMLElement::FindNestedElementByName ( const char *  name)

Locate a nested element with the given tag name.

References name.

◆ FindNestedElementByName() [2/2]

void vtkPVXMLElement::FindNestedElementByName ( const char *  name,
vtkCollection *  elements 
)

Locate a set of nested elements with the given tag name.

References GetElementsByName().

◆ GetAttribute()

const char* vtkPVXMLElement::GetAttribute ( const char *  name)
inline

Get the attribute with the given name. If it doesn't exist, returns NULL.

References name, and NULL.

Referenced by GetVectorAttribute(), Merge(), and vtkPVXMLParser::StartElement().

◆ GetAttributeOrDefault()

const char * vtkPVXMLElement::GetAttributeOrDefault ( const char *  name,
const char *  notFound 
)

Get the attribute with the given name. If it doesn't exist, returns the provided notFound value.

References name.

◆ GetAttributeOrEmpty()

const char* vtkPVXMLElement::GetAttributeOrEmpty ( const char *  name)
inline

Get the attribute with the given name. If it doesn't exist, returns "".

References name.

◆ GetCharacterData()

const char * vtkPVXMLElement::GetCharacterData ( )

Get the character data for the element.

Referenced by GetCharacterDataAsVector().

◆ GetCharacterDataAsVector() [1/3]

int vtkPVXMLElement::GetCharacterDataAsVector ( int  length,
double *  value 
)

◆ GetCharacterDataAsVector() [2/3]

int vtkPVXMLElement::GetCharacterDataAsVector ( int  length,
float *  value 
)

◆ GetCharacterDataAsVector() [3/3]

int vtkPVXMLElement::GetCharacterDataAsVector ( int  length,
int *  value 
)

Get the character data converted to a scalar value. Returns length of vector read.

References data, GetCharacterData(), and vtkPVXMLVectorAttributeParse().

◆ GetElementsByName() [1/2]

void vtkPVXMLElement::GetElementsByName ( const char *  name,
vtkCollection *  elements 
)

Similar to DOM specific getElementsByTagName(). Returns a list of vtkPVXMLElements with the given name in the order in which they will be encountered in a preorder traversal of the sub-tree under this node. The elements are populated in the vtkCollection passed as an argument.

Referenced by FindNestedElementByName(), and GetElementsByName().

◆ GetElementsByName() [2/2]

void vtkPVXMLElement::GetElementsByName ( const char *  name,
vtkCollection *  elements,
bool  recursively 
)

◆ GetNestedElement()

vtkPVXMLElement * vtkPVXMLElement::GetNestedElement ( unsigned int  index)

Get the element nested in this one at the given index.

Referenced by GetElementsByName(), and PrintSelf().

◆ GetNumberOfNestedElements()

unsigned int vtkPVXMLElement::GetNumberOfNestedElements ( )

Get the number of elements nested in this one.

Referenced by GetElementsByName(), and PrintSelf().

◆ GetParent()

vtkPVXMLElement * vtkPVXMLElement::GetParent ( )

Get the parent of this element.

References Parent.

Referenced by LookupElementUpScope().

◆ GetScalarAttribute() [1/3]

int vtkPVXMLElement::GetScalarAttribute ( const char *  name,
double *  value 
)

References GetVectorAttribute().

◆ GetScalarAttribute() [2/3]

int vtkPVXMLElement::GetScalarAttribute ( const char *  name,
float *  value 
)

References GetVectorAttribute().

◆ GetScalarAttribute() [3/3]

int vtkPVXMLElement::GetScalarAttribute ( const char *  name,
int *  value 
)

Get the attribute with the given name converted to a scalar value. Returns whether value was extracted.

References GetVectorAttribute().

◆ GetVectorAttribute() [1/3]

int vtkPVXMLElement::GetVectorAttribute ( const char *  name,
int  length,
double *  value 
)

◆ GetVectorAttribute() [2/3]

int vtkPVXMLElement::GetVectorAttribute ( const char *  name,
int  length,
float *  value 
)

◆ GetVectorAttribute() [3/3]

int vtkPVXMLElement::GetVectorAttribute ( const char *  name,
int  length,
int *  value 
)

Get the attribute with the given name converted to a scalar value. Returns length of vector read.

References data, GetAttribute(), and vtkPVXMLVectorAttributeParse().

Referenced by GetScalarAttribute().

◆ LookupElement()

vtkPVXMLElement * vtkPVXMLElement::LookupElement ( const char *  id)

Lookup the element with the given id, starting at this scope.

References LookupElementUpScope().

◆ LookupElementInScope()

vtkPVXMLElement * vtkPVXMLElement::LookupElementInScope ( const char *  id)
protected

References FindNestedElement(), name, and next.

Referenced by LookupElementUpScope().

◆ LookupElementUpScope()

vtkPVXMLElement * vtkPVXMLElement::LookupElementUpScope ( const char *  id)
protected

◆ Merge()

void vtkPVXMLElement::Merge ( vtkPVXMLElement *  element,
const char *  attributeName 
)

Merges another element with this one, both having the same name. If any attribute, character data or nested element exists in both, the passed in one will override this one's. If they don't exist, they'll be added. If nested elements have the same names, the optional attributeName maybe passed in as another criteria to determine what to merge in case of same names.

References AddAttribute(), AddNestedElement(), GetAttribute(), and NULL.

◆ New()

static vtkPVXMLElement* vtkPVXMLElement::New ( )
static

◆ PrintSelf()

void vtkPVXMLElement::PrintSelf ( ostream &  os,
vtkIndent  indent 
)
override

◆ PrintXML() [1/2]

void vtkPVXMLElement::PrintXML ( )

Referenced by Equals().

◆ PrintXML() [2/2]

void vtkPVXMLElement::PrintXML ( ostream &  os,
vtkIndent  indent 
)

Serialize (as XML) in the given stream.

References Encode(), Name, and vtkIsSpace().

Referenced by Equals(), and vtkPVXMLParser::PrintXML().

◆ ReadXMLAttributes()

void vtkPVXMLElement::ReadXMLAttributes ( const char **  atts)
protected

References AddAttribute(), and count.

Referenced by vtkPVXMLParser::StartElement().

◆ RemoveAllNestedElements()

void vtkPVXMLElement::RemoveAllNestedElements ( )

Removes all nested elements.

◆ RemoveAttribute()

void vtkPVXMLElement::RemoveAttribute ( const char *  attrName)

Remove the attribute from the current element

References name.

◆ RemoveNestedElement()

void vtkPVXMLElement::RemoveNestedElement ( vtkPVXMLElement *  element)

Remove a particular element.

◆ ReplaceNestedElement()

void vtkPVXMLElement::ReplaceNestedElement ( vtkPVXMLElement *  elementToReplace,
vtkPVXMLElement *  element 
)

Replace a particular element with another

◆ SetAttribute()

void vtkPVXMLElement::SetAttribute ( const char *  attrName,
const char *  attrValue 
)

Given it's name and value, set an attribute. If an attribute with the given name already exists, it replaces the old attribute. chars that need to be XML escaped will be done so internally for example " will be converted to "

References AddAttribute().

◆ SetParent()

void vtkPVXMLElement::SetParent ( vtkPVXMLElement *  parent)
protected

References Parent.

Referenced by AddNestedElement().

◆ vtkGetStringMacro() [1/2]

vtkPVXMLElement::vtkGetStringMacro ( Id  )

Get the id of the element. This is assigned by the XML parser and can be used as an identifier to an element.

◆ vtkGetStringMacro() [2/2]

vtkPVXMLElement::vtkGetStringMacro ( Name  )

◆ vtkSetStringMacro() [1/2]

vtkPVXMLElement::vtkSetStringMacro ( Id  )
protected

◆ vtkSetStringMacro() [2/2]

vtkPVXMLElement::vtkSetStringMacro ( Name  )

Set/Get the name of the element. This is its XML tag. (<Name/>).

◆ vtkTypeMacro()

vtkPVXMLElement::vtkTypeMacro ( vtkPVXMLElement  ,
vtkObject   
)

Member Data Documentation

◆ Id

char* vtkPVXMLElement::Id
protected

Referenced by PrintSelf(), and vtkPVXMLElement().

◆ Name

char* vtkPVXMLElement::Name
protected

◆ Parent

vtkPVXMLElement* vtkPVXMLElement::Parent
protected

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