Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

Servers/Filters/vtkPVXMLElement.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   ParaView
00004   Module:    $RCSfile: vtkPVXMLElement.h,v $
00005 
00006   Copyright (c) Kitware, Inc.
00007   All rights reserved.
00008   See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00021 #ifndef __vtkPVXMLElement_h
00022 #define __vtkPVXMLElement_h
00023 
00024 #include "vtkObject.h"
00025 
00026 class vtkPVXMLParser;
00027 
00028 class VTK_EXPORT vtkPVXMLElement : public vtkObject
00029 {
00030 public:
00031   vtkTypeRevisionMacro(vtkPVXMLElement,vtkObject);
00032   void PrintSelf(ostream& os, vtkIndent indent);
00033   static vtkPVXMLElement* New();
00034 
00036 
00037   vtkGetStringMacro(Name);
00039 
00041 
00042   vtkGetStringMacro(Id);
00044 
00047   const char* GetAttribute(const char* name);
00048 
00050 
00052   int GetScalarAttribute(const char* name, int* value);
00053   int GetScalarAttribute(const char* name, float* value);
00054   int GetScalarAttribute(const char* name, double* value);
00056 
00058 
00060   int GetVectorAttribute(const char* name, int length, int* value);
00061   int GetVectorAttribute(const char* name, int length, float* value);
00062   int GetVectorAttribute(const char* name, int length, double* value);
00064 
00066   vtkPVXMLElement* GetParent();
00067 
00069   unsigned int GetNumberOfNestedElements();
00070 
00072   vtkPVXMLElement* GetNestedElement(unsigned int index);
00073 
00075   vtkPVXMLElement* FindNestedElement(const char* id);
00076 
00078   vtkPVXMLElement* LookupElement(const char* id);
00079 
00080 protected:
00081   vtkPVXMLElement();
00082   ~vtkPVXMLElement();
00083 
00084   char* Name;
00085   char* Id;
00086 
00087   // The raw property name/value pairs read from the XML attributes.
00088   char** AttributeNames;
00089   char** AttributeValues;
00090   unsigned int NumberOfAttributes;
00091   unsigned int AttributesSize;
00092 
00093   // The set of nested elements.
00094   unsigned int NumberOfNestedElements;
00095   unsigned int NestedElementsSize;
00096   vtkPVXMLElement** NestedElements;
00097 
00098   // The parent of this element.
00099   vtkPVXMLElement* Parent;
00100 
00101   // Method used by vtkPVXMLParser to setup the element.
00102   vtkSetStringMacro(Name);
00103   vtkSetStringMacro(Id);
00104   void ReadXMLAttributes(const char** atts);
00105   void AddNestedElement(vtkPVXMLElement* element);
00106   void AddCharacterData(const char* data, int length);
00107 
00108   void PrintXML(ostream& os, vtkIndent indent);
00109 
00110   // Internal utility methods.
00111   vtkPVXMLElement* LookupElementInScope(const char* id);
00112   vtkPVXMLElement* LookupElementUpScope(const char* id);
00113   void SetParent(vtkPVXMLElement* parent);
00114 
00115   //BTX
00116   friend class vtkPVXMLParser;
00117   //ETX
00118 
00119 private:
00120   vtkPVXMLElement(const vtkPVXMLElement&);  // Not implemented.
00121   void operator=(const vtkPVXMLElement&);  // Not implemented.
00122 };
00123 
00124 #endif

Generated on Tue May 30 12:31:47 2006 for ParaView by doxygen 1.3.5