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

#include <vtkPVXMLElement.h>

Inheritance diagram for vtkPVXMLElement:
Collaboration diagram for vtkPVXMLElement:

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)
 
vtkPVXMLElementGetParent ()
 
unsigned int GetNumberOfNestedElements ()
 
vtkPVXMLElementGetNestedElement (unsigned int index)
 
vtkPVXMLElementFindNestedElement (const char *id)
 
vtkPVXMLElementFindNestedElementByName (const char *name)
 
void FindNestedElementByName (const char *name, vtkCollection *elements)
 
void RemoveAllNestedElements ()
 
void RemoveNestedElement (vtkPVXMLElement *)
 
void ReplaceNestedElement (vtkPVXMLElement *elementToReplace, vtkPVXMLElement *element)
 
vtkPVXMLElementLookupElement (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 vtkPVXMLElementNew ()
 
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)
 
vtkPVXMLElementLookupElementInScope (const char *id)
 
vtkPVXMLElementLookupElementUpScope (const char *id)
 
void SetParent (vtkPVXMLElement *parent)
 

Protected Attributes

char * Name
 
char * Id
 
vtkPVXMLElementParent
 

Detailed Description

Definition at line 20 of file vtkPVXMLElement.h.

Constructor & Destructor Documentation

◆ vtkPVXMLElement()

vtkPVXMLElement::vtkPVXMLElement ( )
protected

Definition at line 56 of file vtkPVXMLElement.cxx.

References Id, Name, and Parent.

◆ ~vtkPVXMLElement()

vtkPVXMLElement::~vtkPVXMLElement ( )
overrideprotected

Definition at line 66 of file vtkPVXMLElement.cxx.

Member Function Documentation

◆ AddAttribute() [1/5]

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

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

Definition at line 140 of file vtkPVXMLElement.cxx.

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

◆ AddAttribute() [2/5]

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

Definition at line 117 of file vtkPVXMLElement.cxx.

References AddAttribute().

◆ AddAttribute() [3/5]

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

Definition at line 125 of file vtkPVXMLElement.cxx.

References AddAttribute().

◆ AddAttribute() [4/5]

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

Definition at line 99 of file vtkPVXMLElement.cxx.

References AddAttribute().

◆ AddAttribute() [5/5]

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

Definition at line 91 of file vtkPVXMLElement.cxx.

References AddAttribute().

◆ AddCharacterData()

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

Definition at line 250 of file vtkPVXMLElement.cxx.

References data.

Referenced by vtkPVXMLParser::CharacterDataHandler(), CopyAttributesTo(), and CopyTo().

◆ AddNestedElement() [1/2]

void vtkPVXMLElement::AddNestedElement ( vtkPVXMLElement element)

Definition at line 234 of file vtkPVXMLElement.cxx.

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.

Definition at line 240 of file vtkPVXMLElement.cxx.

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.

Definition at line 742 of file vtkPVXMLElement.cxx.

References AddCharacterData().

◆ CopyTo()

void vtkPVXMLElement::CopyTo ( vtkPVXMLElement other)

Copy the current XML element content into the provided one

Definition at line 721 of file vtkPVXMLElement.cxx.

References AddCharacterData(), and AddNestedElement().

◆ Encode()

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

Encode a string.

Definition at line 593 of file vtkPVXMLElement.cxx.

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.

Definition at line 753 of file vtkPVXMLElement.cxx.

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.

Definition at line 365 of file vtkPVXMLElement.cxx.

Referenced by LookupElementInScope(), and LookupElementUpScope().

◆ FindNestedElementByName() [1/2]

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

Locate a nested element with the given tag name.

Definition at line 381 of file vtkPVXMLElement.cxx.

References name.

◆ FindNestedElementByName() [2/2]

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

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

Definition at line 397 of file vtkPVXMLElement.cxx.

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.

Definition at line 47 of file vtkPVXMLElement.h.

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.

Definition at line 256 of file vtkPVXMLElement.cxx.

References name.

◆ GetAttributeOrEmpty()

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

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

Definition at line 55 of file vtkPVXMLElement.h.

References name.

◆ GetCharacterData()

const char * vtkPVXMLElement::GetCharacterData ( )

Get the character data for the element.

Definition at line 270 of file vtkPVXMLElement.cxx.

Referenced by GetCharacterDataAsVector().

◆ GetCharacterDataAsVector() [1/3]

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

Definition at line 543 of file vtkPVXMLElement.cxx.

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

◆ GetCharacterDataAsVector() [2/3]

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

Definition at line 537 of file vtkPVXMLElement.cxx.

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

◆ GetCharacterDataAsVector() [3/3]

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

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

Definition at line 531 of file vtkPVXMLElement.cxx.

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.

Definition at line 549 of file vtkPVXMLElement.cxx.

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.

Definition at line 349 of file vtkPVXMLElement.cxx.

Referenced by GetElementsByName(), and PrintSelf().

◆ GetNumberOfNestedElements()

unsigned int vtkPVXMLElement::GetNumberOfNestedElements ( )

Get the number of elements nested in this one.

Definition at line 343 of file vtkPVXMLElement.cxx.

Referenced by GetElementsByName(), and PrintSelf().

◆ GetParent()

vtkPVXMLElement * vtkPVXMLElement::GetParent ( )

Get the parent of this element.

Definition at line 337 of file vtkPVXMLElement.cxx.

References Parent.

Referenced by LookupElementUpScope().

◆ GetScalarAttribute() [1/3]

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

Definition at line 469 of file vtkPVXMLElement.cxx.

References GetVectorAttribute().

◆ GetScalarAttribute() [2/3]

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

Definition at line 463 of file vtkPVXMLElement.cxx.

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.

Definition at line 457 of file vtkPVXMLElement.cxx.

References GetVectorAttribute().

◆ GetVectorAttribute() [1/3]

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

Definition at line 517 of file vtkPVXMLElement.cxx.

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

◆ GetVectorAttribute() [2/3]

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

Definition at line 511 of file vtkPVXMLElement.cxx.

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

◆ 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.

Definition at line 505 of file vtkPVXMLElement.cxx.

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.

Definition at line 359 of file vtkPVXMLElement.cxx.

References LookupElementUpScope().

◆ LookupElementInScope()

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

Definition at line 404 of file vtkPVXMLElement.cxx.

References FindNestedElement(), name, and next.

Referenced by LookupElementUpScope().

◆ LookupElementUpScope()

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

Definition at line 428 of file vtkPVXMLElement.cxx.

References FindNestedElement(), GetParent(), LookupElementInScope(), and name.

Referenced by LookupElement().

◆ 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.

Definition at line 640 of file vtkPVXMLElement.cxx.

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

◆ New()

static vtkPVXMLElement* vtkPVXMLElement::New ( )
static

◆ PrintSelf()

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

Definition at line 75 of file vtkPVXMLElement.cxx.

References QtCompat::endl(), GetNestedElement(), GetNumberOfNestedElements(), Id, Name, and PrintSelf().

Referenced by PrintSelf().

◆ PrintXML() [1/2]

void vtkPVXMLElement::PrintXML ( )

Definition at line 276 of file vtkPVXMLElement.cxx.

Referenced by Equals().

◆ PrintXML() [2/2]

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

Serialize (as XML) in the given stream.

Definition at line 282 of file vtkPVXMLElement.cxx.

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

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

◆ ReadXMLAttributes()

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

Definition at line 175 of file vtkPVXMLElement.cxx.

References AddAttribute(), and count.

Referenced by vtkPVXMLParser::StartElement().

◆ RemoveAllNestedElements()

void vtkPVXMLElement::RemoveAllNestedElements ( )

Removes all nested elements.

Definition at line 199 of file vtkPVXMLElement.cxx.

◆ RemoveAttribute()

void vtkPVXMLElement::RemoveAttribute ( const char *  attrName)

Remove the attribute from the current element

Definition at line 771 of file vtkPVXMLElement.cxx.

References name.

◆ RemoveNestedElement()

void vtkPVXMLElement::RemoveNestedElement ( vtkPVXMLElement element)

Remove a particular element.

Definition at line 205 of file vtkPVXMLElement.cxx.

◆ ReplaceNestedElement()

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

Replace a particular element with another

Definition at line 220 of file vtkPVXMLElement.cxx.

◆ 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 "

Definition at line 152 of file vtkPVXMLElement.cxx.

References AddAttribute().

◆ SetParent()

void vtkPVXMLElement::SetParent ( vtkPVXMLElement parent)
protected

Definition at line 331 of file vtkPVXMLElement.cxx.

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

Definition at line 262 of file vtkPVXMLElement.h.

Referenced by PrintSelf(), and vtkPVXMLElement().

◆ Name

char* vtkPVXMLElement::Name
protected

Definition at line 261 of file vtkPVXMLElement.h.

Referenced by PrintSelf(), PrintXML(), and vtkPVXMLElement().

◆ Parent

vtkPVXMLElement* vtkPVXMLElement::Parent
protected

Definition at line 265 of file vtkPVXMLElement.h.

Referenced by GetParent(), SetParent(), and vtkPVXMLElement().


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