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 00082 00091 static vtkXMLDataElement* ReadElementFromStream( 00092 istream&, int encoding = VTK_ENCODING_NONE); 00093 static vtkXMLDataElement* ReadElementFromString( 00094 const char *str, int encoding = VTK_ENCODING_NONE); 00095 static vtkXMLDataElement* ReadElementFromFile( 00096 const char *filename, int encoding = VTK_ENCODING_NONE); 00097 //ETX 00099 00101 00108 static void ReadElementFromAttributeArray( 00109 vtkXMLDataElement *element, 00110 const char** atts, 00111 int encoding); 00113 00115 00121 static int FindSimilarElements(vtkXMLDataElement *elem, 00122 vtkXMLDataElement *tree, 00123 vtkXMLDataElement ***results); 00124 //ETX 00126 00128 00131 static void FactorElements(vtkXMLDataElement *tree); 00132 static void UnFactorElements(vtkXMLDataElement *tree); 00134 00135 protected: 00136 vtkXMLUtilities() {}; 00137 ~vtkXMLUtilities() {}; 00138 00139 static int FactorElementsInternal(vtkXMLDataElement *tree, 00140 vtkXMLDataElement *root, 00141 vtkXMLDataElement *pool); 00142 static int UnFactorElementsInternal(vtkXMLDataElement *tree, 00143 vtkXMLDataElement *pool); 00144 00145 private: 00146 vtkXMLUtilities(const vtkXMLUtilities&); // Not implemented 00147 void operator=(const vtkXMLUtilities&); // Not implemented 00148 }; 00149 00150 #endif 00151 00152