VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkXMLUtilities.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm 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 =========================================================================*/ 00023 #ifndef __vtkXMLUtilities_h 00024 #define __vtkXMLUtilities_h 00025 00026 #include "vtkObject.h" 00027 00028 class vtkXMLDataElement; 00029 00030 class VTK_IO_EXPORT vtkXMLUtilities : public vtkObject 00031 { 00032 public: 00033 static vtkXMLUtilities* New(); 00034 vtkTypeMacro(vtkXMLUtilities, vtkObject); 00035 00037 00040 static void EncodeString(const char *input, int input_encoding, 00041 ostream &output, int output_encoding, 00042 int special_entities = 0); 00044 00046 00051 static void CollateAttributes(vtkXMLDataElement*, 00052 ostream&, 00053 const char *sep = 0); 00055 00056 //BTX 00058 00065 static void FlattenElement(vtkXMLDataElement*, 00066 ostream&, 00067 vtkIndent *indent = 0, 00068 int indent_attributes = 1); 00070 00072 00075 static int WriteElementToFile(vtkXMLDataElement*, 00076 const char *filename, 00077 vtkIndent *indent = 0); 00078 //ETX 00080 00081 //BTX 00083 00092 static vtkXMLDataElement* ReadElementFromStream( 00093 istream&, int encoding = VTK_ENCODING_NONE); 00094 static vtkXMLDataElement* ReadElementFromString( 00095 const char *str, int encoding = VTK_ENCODING_NONE); 00096 static vtkXMLDataElement* ReadElementFromFile( 00097 const char *filename, int encoding = VTK_ENCODING_NONE); 00098 //ETX 00100 00102 00109 static void ReadElementFromAttributeArray( 00110 vtkXMLDataElement *element, 00111 const char** atts, 00112 int encoding); 00114 00115 //BTX 00117 00123 static int FindSimilarElements(vtkXMLDataElement *elem, 00124 vtkXMLDataElement *tree, 00125 vtkXMLDataElement ***results); 00126 //ETX 00128 00130 00133 static void FactorElements(vtkXMLDataElement *tree); 00134 static void UnFactorElements(vtkXMLDataElement *tree); 00136 00137 protected: 00138 vtkXMLUtilities() {}; 00139 ~vtkXMLUtilities() {}; 00140 00141 static int FactorElementsInternal(vtkXMLDataElement *tree, 00142 vtkXMLDataElement *root, 00143 vtkXMLDataElement *pool); 00144 static int UnFactorElementsInternal(vtkXMLDataElement *tree, 00145 vtkXMLDataElement *pool); 00146 00147 private: 00148 vtkXMLUtilities(const vtkXMLUtilities&); // Not implemented 00149 void operator=(const vtkXMLUtilities&); // Not implemented 00150 }; 00151 00152 #endif 00153 00154